Files
zeekay c671872b0b The packages this repo publishes carry our scope
webapp/platform publishes six packages and the channels app carries a seventh
in-tree, and every one of them went out under @mattermost — types, client,
components, shared, eslint-plugin, compass-icons and mattermost-redux — while
the plugin that consumes them already asks for @hanzoteam/types and
@hanzoteam/client by name. It could not build: it was asking a registry for a
package nobody publishes.

They are @hanzoteam/* now, and mattermost-redux is @hanzoteam/redux, moved to
src/packages/@hanzoteam/redux so the directory matches the alias that always
pointed there.

@mattermost/calls-common and @mattermost/desktop-api stay. Those are published
by someone else and resolved from npm; renaming a package we merely consume
would name a thing that does not exist.

The jest moduleNameMapper entries needed doing by hand — they spell the scope
inside a regex, so a sweep over the plain name walks straight past them, and a
missed one fails at require time rather than at build.
2026-08-28 23:44:39 -07:00

60 lines
2.3 KiB
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
/** @type {import('jest').Config} */
const config = {
testPathIgnorePatterns: ['/node_modules/'],
clearMocks: true,
collectCoverageFrom: [
'src/**/*.{js,jsx,ts,tsx}',
],
coveragePathIgnorePatterns: [
'/node_modules/',
'@hanzoteam/redux/src/selectors/create_selector',
],
coverageReporters: ['json', 'lcov', 'text-summary'],
fakeTimers: {
doNotFake: ['performance'],
},
moduleNameMapper: {
'^@hanzoteam/(components)$': '<rootDir>/../platform/$1/src',
'^@hanzoteam/(client)$': '<rootDir>/../platform/$1/src',
'^@hanzoteam/(types)/(.*)$': '<rootDir>/../platform/$1/src/$2',
'^@hanzoteam/shared/(.*)$': '<rootDir>/../platform/shared/src/$1',
'^@hanzoteam/redux/test/(.*)$':
'<rootDir>/src/packages/@hanzoteam/redux/test/$1',
'^@hanzoteam/redux/(.*)$': '<rootDir>/src/packages/@hanzoteam/redux/src/$1',
'^pdfjs-dist/.*': '<rootDir>/src/tests/pdfjs_mock.ts',
'^.+\\.(jpg|jpeg|png|apng|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/src/tests/image_url_mock.json',
'^.+\\.(css|less|scss)$': 'identity-obj-proxy',
'^.*i18n.*\\.(json)$': '<rootDir>/src/tests/i18n_mock.json',
},
moduleDirectories: ['src', 'node_modules'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
transformIgnorePatterns: [
'node_modules/(?!react-native|react-router|pdfjs-dist|p-queue|p-timeout|@hanzoteam/compass-icons|cidr-regex|ip-regex|serialize-error|@tiptap|marked|lowlight|devlop|fault|hast-util-to-text|@types/hast|unist-util-find-after)',
],
transform: {
'^.+\\.(js|jsx|ts|tsx|mjs)$': 'babel-jest',
},
setupFiles: ['jest-canvas-mock'],
setupFilesAfterEnv: ['<rootDir>/src/tests/setup_jest.ts'],
testEnvironment: 'jsdom',
testTimeout: 60000,
testEnvironmentOptions: {
url: 'http://localhost:8065',
},
watchPlugins: [
'jest-watch-typeahead/filename',
'jest-watch-typeahead/testname',
],
snapshotFormat: {
escapeString: true,
printBasicPrototype: true,
},
};
module.exports = config;