Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Resolve the root project directory:
const ROOT = resolve(__dirname, '..', '..');
const config = {
rootDir: ROOT,
// Needed for jest-screenshots
testRunner: 'jest-circus/runner',
testEnvironment: resolve(__dirname, 'jest-environment.js'),
globalSetup: 'jest-environment-puppeteer/setup',
globalTeardown: 'jest-environment-puppeteer/teardown',
setupFilesAfterEnv: ['expect-puppeteer'],
transform: {
...tsjPreset.transform
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
testMatch: ['**/test/**/test*.ts?(x)'],
testPathIgnorePatterns: ['/build/', '/lib/', '/node_modules/'],
globals: {
'ts-jest': {
tsConfig: resolve(ROOT, 'tsconfig.test.json')
}
}
};
/**
* Exports.
*/
module.exports = config;
/* eslint-disable import/no-extraneous-dependencies */
const { defaults: tsjPreset } = require('ts-jest/presets');
// 🔰 Tips, if `tsconfig.json`, here will be open
const { pathsToModuleNameMapper } = require('ts-jest/utils');
const { compilerOptions } = require('./tsconfig');
module.exports = {
transform: {
...tsjPreset.transform,
'^.+\\.tsx?$': 'ts-jest',
},
moduleFileExtensions: ['ts', 'js'],
//
// 🔰 Tips, if `tsconfig.json`, here will be open
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: '/' }),
//
modulePathIgnorePatterns: ['/_dist/', '/_deploy/'],
testRegex: 'src.*\\.(test|spec).(ts|tsx|js)$',
collectCoverageFrom: [
'src/**/*.{js,jsx,tsx,ts}',
'!**/node_modules/**',
'!**/vendor/**',
'!**/dist/**',
'!**/_dist/**',
'!**/_deploy/**',
/* eslint-disable import/no-extraneous-dependencies */
const { defaults: tsjPreset } = require('ts-jest/presets');
// 🔰 Tips, if `tsconfig.json`, here will be open
const { pathsToModuleNameMapper } = require('ts-jest/utils');
const { compilerOptions } = require('./tsconfig');
module.exports = {
transform: {
...tsjPreset.transform,
'^.+\\.(t|j)s$': 'ts-jest',
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'json'],
//
// 🔰 Tips, if `tsconfig.json`, here will be open
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: '/' }),
//
testRegex: '.e2e-(test|spec).ts$',
collectCoverageFrom: [
'src/**/*.{js,jsx,tsx,ts}',
'!**/node_modules/**',
'!**/vendor/**',
'!**/dist/**',
'!**/_dist/**',
'!**/_deploy/**',
],
const { defaults: tsjPreset } = require('ts-jest/presets');
module.exports = {
...tsjPreset,
preset: 'react-native',
transform: {
...tsjPreset.transform,
'\\.js$': '/node_modules/react-native/jest/preprocessor.js',
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
// This is the only part which you can keep
// from the above linked tutorial"s config:
cacheDirectory: '.jest/cache',
};
// Resolve the root project directory:
const ROOT = resolve(__dirname, '..', '..');
const config = {
rootDir: ROOT,
// Needed for jest-screenshots
testRunner: 'jest-circus/runner',
testEnvironment: resolve(__dirname, 'jest-environment.js'),
globalSetup: 'jest-environment-puppeteer/setup',
globalTeardown: 'jest-environment-puppeteer/teardown',
setupFilesAfterEnv: ['expect-puppeteer'],
transform: {
...tsjPreset.transform
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
testMatch: ['**/test/**/test*.ts?(x)'],
testPathIgnorePatterns: ['/build/', '/lib/', '/node_modules/'],
globals: {
'ts-jest': {
tsConfig: resolve(ROOT, 'tsconfig.test.json')
}
}
};
/**
* Exports.
*/
module.exports = config;
setupFiles: ['./tests/setup.js'],
moduleFileExtensions: [
'ts',
'tsx',
'js',
'jsx',
'json',
],
testPathIgnorePatterns: [
'/node_modules/',
'_site',
'site',
],
transform: {
// '\\.tsx?$': 'ts-jest',
...tsjPreset.transform,
// '\\.tsx?$': './node_modules/antd-tools/lib/jest/codePreprocessor',
// '\\.js$': './node_modules/antd-tools/lib/jest/codePreprocessor',
'^.+\\.js$': '/node_modules/react-native/jest/preprocessor.js',
'\\.png': '/tests/imageStub.js',
},
testRegex: libDir === 'dist' ? 'demo\\.test\\.js$' : '.*\\.test\\.js$',
collectCoverageFrom: [
'components/**/*.{ts,tsx}',
'!components/*/style/*.{ts,tsx}',
],
transformIgnorePatterns: [
`node_modules/(?!(${transformPackages.join('|')})/)`,
],
globals: {
'ts-jest': {
'!src/**/*.d.ts',
'!src/**/*.test.ts',
'!src/**/*.test.tsx',
'!**/node_modules/**',
],
coverageThreshold: {
global: {
branches: 30,
functions: 30,
lines: 40,
statements: 50,
},
},
transform: {
...tsjPreset.transform,
'\\.(svg)$': '/jest.transformer.js',
},
testMatch: tsjPreset.testMatch,
moduleFileExtensions: tsjPreset.moduleFileExtensions,
setupFilesAfterEnv: [require.resolve('./jest.setup.js')],
moduleNameMapper: {
'\\.css$': '/jest.styleMock.js',
},
};
const { defaults: tsjPreset } = require('ts-jest/presets')
const { resolveCwd } = require('just-scripts')
const path = require('path')
module.exports = {
transform: {
...tsjPreset.transform,
},
testRegex: '/test/.*-test\\.tsx?$',
globals: {
'ts-jest': {
isolatedModules: true,
tsConfig: resolveCwd('tsconfig.json'),
packageJson: resolveCwd('package.json'),
},
},
coverageDirectory: './coverage/',
coverageReporters: ['json', 'lcov'],
setupFilesAfterEnv: [path.join(__dirname, 'jestSetup.fluent-ui-react.js')],
verbose: false,
}
const { defaults: tsjPreset } = require('ts-jest/presets')
module.exports = {
collectCoverageFrom: [
'src/**/*.js',
'src/**/*.jsx',
'src/**/*.ts',
'src/**/*.tsx',
],
coveragePathIgnorePatterns: ['/node_modules/', '.*\\.d\\.ts'],
coverageThreshold: { global: { lines: 95 } },
resetMocks: true,
restoreMocks: true,
testEnvironment: 'node',
testRegex: '(/(test|__tests__)/(?![_.]).*|(\\.|/)(test|spec))\\.[jt]sx?$',
transform: { ...tsjPreset.transform },
}