Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const { defaults } = require("jest-config");
module.exports = {
testEnvironment: "node",
setupFiles: [
"/../apollo-server-env/dist/index.js"
],
preset: "ts-jest",
testMatch: null,
testRegex: "/__tests__/.*\\.test\\.(js|ts)$",
testPathIgnorePatterns: [
"/node_modules/",
"/dist/"
],
moduleFileExtensions: [...defaults.moduleFileExtensions, "ts", "tsx"],
moduleNameMapper: {
'^__mocks__/(.*)$': '/../../__mocks__/$1',
// This regex should match the packages that we want compiled from source
// through `ts-jest`, as opposed to loaded from their output files in
// `dist`.
// We don't want to match `apollo-server-env` and
// `apollo-engine-reporting-protobuf`, because these don't depend on
// compilation but need to be initialized from as parto of `prepare`.
'^(?!apollo-server-env|apollo-engine-reporting-protobuf)(apollo-(?:federation|gateway|server|datasource|cache-control|tracing|engine)[^/]*|graphql-extensions)(?:/dist)?((?:/.*)|$)': '/../../packages/$1/src$2'
},
clearMocks: true,
globals: {
"ts-jest": {
tsConfig: "/src/__tests__/tsconfig.json",
diagnostics: false
}
module.exports = {
coverageDirectory: '/coverage',
coverageReporters: ['lcov'],
modulePathIgnorePatterns: ['/scripts/', '/.*/__mocks__'],
moduleNameMapper: {
"\\.(css|less|sass|scss)$": "/config/jest/__mocks__/styleMock.js",
"\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "/config/jest/__mocks__/fileMock.js",
"\\.svg$": "/config/jest/__mocks__/svgrMock.js"
},
rootDir: path.resolve(__dirname, '..', '..'),
setupFilesAfterEnv: ['/config/jest/setup/index.js'],
transform: {
'^.+\\.[jt]sx?$': '/config/jest/babel-transformer.js'
},
moduleFileExtensions: [...defaults.moduleFileExtensions, 'ts', 'tsx'],
transformIgnorePatterns: ['/node_modules', '/.*/dist'],
// watchPlugins: [
// 'jest-watch-typeahead/filename',
// 'jest-watch-typeahead/testname'
// ]
}
verbose: true,
globalSetup: './tools/testing/jest-setup.ts',
globalTeardown: './tools/testing/jest-teardown.ts',
// coverageReporters: [`json-summary`, `text`, `html`, `cobertura`],
collectCoverageFrom: [
'**/*.{js,ts}',
'!**/node_modules/**',
'!**/dist/**',
'!**/index.cdn.ts'
],
roots: pkgs.filter(p => !p.endsWith('-types')).map(p => `${p}/src`),
transform: {
'^.+\\.tsx?$': 'ts-jest'
},
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.[jt]sx?$',
moduleFileExtensions: [...defaults.moduleFileExtensions, 'ts', 'tsx']
}
const { defaults } = require("jest-config");
module.exports = {
preset: "ts-jest",
roots: ["/lib"],
testEnvironment: "node",
transform: {
"^.+\\.tsx?$": "ts-jest"
},
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.ts?$",
moduleFileExtensions: ["ts", "tsx", ...defaults.moduleFileExtensions]
};
// module.exports = {
// preset: "ts-jest",
// testEnvironment: "node",
// roots: ["/lib"],
// transform: {
// "^.+\\.tsx?$": "ts-jest"
// },
// // testMatch: ["**/__tests__/**/*.ts?(x)", "**/?(*.)+(spec|test).ts?(x)"],
// testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
// moduleFileExtensions: ["ts", "tsx", ...defaults.moduleFileExtensions]
// };
// // (/__tests__/.*|(\.|/)(test|spec))\.tsx?$
const {defaults} = require('jest-config');
module.exports = {
verbose: true,
moduleFileExtensions: [...defaults.moduleFileExtensions, 'ts', 'tsx'],
setupFiles: [
"/__test__/setup/test-shim.js",
"/__test__/setup/test-setup.js",
],
preset: "ts-jest/presets/js-with-ts",
transform: {
"^.+\\.(ts|tsx)$": "ts-jest"
},
moduleNameMapper: {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "/tests/setup/fileMock.js",
"\\.(css|less)$": "/tests/setup/styleMock.js"
},
moduleDirectories: [
"node_modules",
"dist"
],
const { defaults } = require('jest-config')
module.exports = {
preset: 'react-native',
moduleFileExtensions: [...defaults.moduleFileExtensions, 'ts', 'tsx'],
transform: {
'^.+\\.(js)$': '/node_modules/babel-jest',
'\\.(ts|tsx)$': '/node_modules/ts-jest/preprocessor.js',
},
testRegex: '(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$',
testPathIgnorePatterns: ['\\.snap$', '/node_modules/', '/lib/'],
cacheDirectory: '.jest/cache',
}
const { defaults } = require('jest-config');
module.exports = {
bail: true,
moduleFileExtensions: [...defaults.moduleFileExtensions, 'ts', 'tsx'],
roots: ['.'],
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
transform: {
'^.+\\.tsx?$': 'ts-jest',
},
verbose: true,
"moduleDirectories": ["node_modules", "src"]
};
verbose: true,
rootDir: '../../',
coverageDirectory: '/build/coverage',
collectCoverageFrom: ['src/**/*.js?(x)'],
coverageReporters: ['json', 'html', 'text', 'lcov'],
transform: {
'^.+\\.jsx?$': 'babel-jest',
'\\.(jpg|png|gif|eot|otf|webp|svg|ttf|woff|mp4|webm|wav|mp3|m4a|aac|oga|css|less)$':
'/configs/jest/fileTransform.js'
},
globals: {
'babel-jest': {
useBabelrc: true
}
},
moduleFileExtensions: [...defaults.moduleFileExtensions],
projects: [
{
rootDir: '.',
displayName: 'Main',
runner: '@jest-runner/electron/main',
testEnvironment: 'node',
testMatch: ['**/main/__tests__/**/*.(spec|test).js']
},
{
rootDir: '.',
displayName: 'Renderer',
runner: '@jest-runner/electron',
testEnvironment: '@jest-runner/electron/environment',
testMatch: ['**/renderer/__tests__/**/*.(spec|test).jsx']
}
]
const { defaults } = require('jest-config')
module.exports = {
transform: {
...defaults.transform,
'^.+\\.tsx?$': 'ts-jest',
},
testPathIgnorePatterns: [
...defaults.testPathIgnorePatterns,
'/examples/.*/plugins/',
'/packages/cli/',
],
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$',
testURL: 'http://localhost/',
moduleFileExtensions: ['ts', 'tsx', ...defaults.moduleFileExtensions],
}
const path = require('path');
const {defaults} = require('jest-config');
module.exports = {
moduleFileExtensions: [...defaults.moduleFileExtensions],
testEnvironment: 'node',
collectCoverage: true,
coverageDirectory: path.join(__dirname, 'coverage'),
coverageReporters: [...defaults.coverageReporters, 'html'],
coveragePathIgnorePatterns: [...defaults.coveragePathIgnorePatterns, 'samples/'],
transform: {},
collectCoverageFrom: [
'**/*.{js}',
'!**/node_modules/**',
'!**/samples/**',
'!**/coverage/**',
'!jest.*'
]
};