mirror of
https://github.com/trezor/trezor-suite.git
synced 2026-02-20 00:33:07 +01:00
- remove re-exports, use direct imports from @suite/intl - resolve cir. dep. between suite-data and package/suite - update imports from @suite-common/intl-types to @suite/intl - update imports from src/support/messages to @suite/intl - remove @suite-common/intl-types - move Translation from @trezor/suite to the new package
89 lines
2.6 KiB
JavaScript
89 lines
2.6 KiB
JavaScript
const version = require('./package.json').suiteVersion;
|
|
const baseConfig = require('../../jest.config.base');
|
|
|
|
// all tests have same UTC timezone
|
|
process.env.TZ = 'UTC';
|
|
process.env.LANG = 'en-US';
|
|
process.env.VERSION = version;
|
|
|
|
const babelConfig = {
|
|
presets: [
|
|
['@babel/preset-env', { targets: { node: 'current' }, modules: 'commonjs' }],
|
|
'@babel/preset-typescript',
|
|
[
|
|
'@babel/preset-react',
|
|
{
|
|
runtime: 'automatic',
|
|
},
|
|
],
|
|
],
|
|
};
|
|
|
|
/**
|
|
* @type {import('jest').Config}
|
|
*/
|
|
module.exports = {
|
|
roots: [
|
|
'<rootDir>/src',
|
|
'<rootDir>/__mocks__',
|
|
'<rootDir>/../../suite-common/test-utils/__mocks__',
|
|
],
|
|
setupFiles: [
|
|
'jest-canvas-mock', // for lottie-react
|
|
],
|
|
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
|
|
moduleNameMapper: {
|
|
'^@suite-common/(.+)': '<rootDir>/../../suite-common/$1',
|
|
'^@trezor/(.+)': '<rootDir>/../$1',
|
|
'^src/(.+)': '<rootDir>/src/$1',
|
|
'\\.(mp4)$': '<rootDir>/__mocks__/import-mp4.js',
|
|
'\\.(svg)$': '<rootDir>/__mocks__/import-svg.js',
|
|
...baseConfig.moduleNameMapper,
|
|
},
|
|
moduleFileExtensions: ['js', 'ts', 'tsx'],
|
|
coverageDirectory: './coverage',
|
|
collectCoverage: true,
|
|
collectCoverageFrom: [
|
|
'<rootDir>/src/actions/**',
|
|
'<rootDir>/src/hooks/**',
|
|
'<rootDir>/src/middlewares/**',
|
|
'<rootDir>/src/reducers/**',
|
|
'<rootDir>/src/storage/**',
|
|
'<rootDir>/src/utils/**',
|
|
'!**/constants/**',
|
|
'!**/__tests__/**',
|
|
'!**/__fixtures__/**',
|
|
'!<rootDir>/src/hooks/**/useTrading*',
|
|
],
|
|
modulePathIgnorePatterns: ['node_modules'],
|
|
watchPathIgnorePatterns: ['<rootDir>/libDev'],
|
|
testPathIgnorePatterns: [
|
|
'/node_modules/',
|
|
'/libDev/',
|
|
'/lib/',
|
|
'/dist/',
|
|
'/build/',
|
|
'/build-electron/',
|
|
'/coverage/',
|
|
'/public/',
|
|
],
|
|
|
|
transformIgnorePatterns: [
|
|
'/node_modules/(?!d3-(.*)|internmap|@walletconnect|uint8arrays|@noble)/',
|
|
],
|
|
testMatch: ['**/*.test.(ts|tsx|js)'],
|
|
transform: {
|
|
'(d3-|internmap|esm).*\\.js$': ['babel-jest', babelConfig],
|
|
'\\.(js|jsx|ts|tsx)$': ['babel-jest', babelConfig],
|
|
},
|
|
verbose: false,
|
|
watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname'],
|
|
testEnvironment: 'jsdom',
|
|
fakeTimers: {
|
|
enableGlobally: false,
|
|
// https://jestjs.io/docs/28.x/upgrading-to-jest28#faketimers
|
|
legacyFakeTimers: true,
|
|
},
|
|
workerIdleMemoryLimit: 0.2,
|
|
};
|