1
0
mirror of synced 2025-12-19 18:10:59 -05:00
Files
docs/jest.config.js
Vanessa Yuen a8d54c9af7 Improvements in tools to help merge crowdin PRs (#18409)
- add `script/test-render-translation.js` to render all translated content to catch malformed liquid that would cause render errors
- improve test output for `script/fix-translation-errors.js` and `tests/content/lint-files.js`
- make it so `script/reset-translated-file.js` can handle files that have been renamed
2021-03-26 19:21:45 +00:00

47 lines
1.1 KiB
JavaScript

// https://jestjs.io/docs/en/configuration.html
const isBrowser = process.env.BROWSER
const isActions = Boolean(process.env.GITHUB_ACTIONS)
const testTranslation = Boolean(process.env.TEST_TRANSLATION)
let reporters = ['default']
if (testTranslation) {
// only use custom reporter if we are linting translations
reporters = ['<rootDir>/tests/helpers/lint-translation-reporter.js']
} else if (isActions) {
reporters.push('jest-github-actions-reporter')
}
module.exports = {
coverageThreshold: {
global: {
branches: 95,
functions: 95,
lines: 95,
statements: -5
}
},
preset: isBrowser
? 'jest-puppeteer'
: undefined,
reporters,
modulePathIgnorePatterns: [
'assets/'
],
setupFilesAfterEnv: ['jest-expect-message'],
...isBrowser ? {} : { testEnvironment: 'node' },
testPathIgnorePatterns: [
'node_modules/',
'vendor/',
'tests/fixtures/',
'tests/helpers/',
'tests/javascripts/',
...isBrowser ? [] : ['tests/browser/browser.js']
],
testMatch: [
'**/tests/**/*.js'
],
testLocationInResults: isActions
}