2020-09-27 15:10:11 +03:00
|
|
|
// https://jestjs.io/docs/en/configuration.html
|
|
|
|
|
|
|
|
const isBrowser = process.env.BROWSER
|
|
|
|
const isActions = Boolean(process.env.GITHUB_ACTIONS)
|
2021-02-01 19:59:33 +03:00
|
|
|
|
2023-01-03 23:44:48 +03:00
|
|
|
const reporters = ['default']
|
2021-02-01 19:59:33 +03:00
|
|
|
|
2023-01-03 23:44:48 +03:00
|
|
|
if (isActions) {
|
2021-02-01 19:59:33 +03:00
|
|
|
reporters.push('jest-github-actions-reporter')
|
|
|
|
}
|
2020-09-27 15:10:11 +03:00
|
|
|
|
2022-07-26 20:53:23 +03:00
|
|
|
export default {
|
2020-09-27 15:10:11 +03:00
|
|
|
coverageThreshold: {
|
|
|
|
global: {
|
|
|
|
branches: 95,
|
|
|
|
functions: 95,
|
|
|
|
lines: 95,
|
2021-07-15 00:35:01 +03:00
|
|
|
statements: -5,
|
|
|
|
},
|
2020-09-27 15:10:11 +03:00
|
|
|
},
|
2021-07-15 00:35:01 +03:00
|
|
|
preset: isBrowser ? 'jest-puppeteer' : undefined,
|
2022-02-24 03:30:14 +03:00
|
|
|
moduleNameMapper: {
|
|
|
|
// fix for "Unexpected token 'export'" error when running jest
|
|
|
|
'@primer/behaviors': '<rootDir>/node_modules/@primer/behaviors/dist/cjs/index.js',
|
|
|
|
},
|
2021-02-01 19:59:33 +03:00
|
|
|
reporters,
|
2021-07-15 00:35:01 +03:00
|
|
|
modulePathIgnorePatterns: ['assets/'],
|
2022-11-30 19:26:58 +03:00
|
|
|
setupFilesAfterEnv: ['./jest.setup.js', 'jest-expect-message'],
|
2021-07-15 00:35:01 +03:00
|
|
|
...(isBrowser ? {} : { testEnvironment: 'node' }),
|
2020-09-27 15:10:11 +03:00
|
|
|
testPathIgnorePatterns: [
|
|
|
|
'node_modules/',
|
|
|
|
'vendor/',
|
2021-02-09 19:52:28 +03:00
|
|
|
'tests/fixtures/',
|
2020-11-24 23:41:50 +03:00
|
|
|
'tests/helpers/',
|
2021-02-09 19:52:28 +03:00
|
|
|
'tests/javascripts/',
|
2021-07-15 00:35:01 +03:00
|
|
|
...(isBrowser ? [] : ['tests/browser/browser.js']),
|
2020-09-27 15:10:11 +03:00
|
|
|
],
|
2021-07-15 00:35:01 +03:00
|
|
|
testMatch: ['**/tests/**/*.js'],
|
|
|
|
testLocationInResults: isActions,
|
2022-07-26 20:53:23 +03:00
|
|
|
globalSetup: './script/start-server-for-jest.js',
|
|
|
|
globalTeardown: './script/kill-server-for-jest.js',
|
2020-09-27 15:10:11 +03:00
|
|
|
}
|