docbrown/jest.config.js
dependabot[bot] d394786fba
Bump jsdom from 16.7.0 to 18.0.0 (#15047)
* Bump jsdom from 16.7.0 to 18.0.0

Bumps [jsdom](https://github.com/jsdom/jsdom) from 16.7.0 to 18.0.0.
- [Release notes](https://github.com/jsdom/jsdom/releases)
- [Changelog](https://github.com/jsdom/jsdom/blob/master/Changelog.md)
- [Commits](https://github.com/jsdom/jsdom/compare/16.7.0...18.0.0)

---
updated-dependencies:
- dependency-name: jsdom
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Added custom environment for JS DOM to support text encoding/decoding.

* Fixed yarn.lock merge conflict.

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Nick Taylor <nick@dev.to>
Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
2021-10-12 14:32:30 -06:00

57 lines
2 KiB
JavaScript

// Consistent timezone for testing.
// This does not work on windows, see https://github.com/nodejs/node/issues/4230
/* eslint-env node */
process.env.TZ = 'UTC';
module.exports = {
setupFilesAfterEnv: ['./testSetup.js'],
collectCoverageFrom: [
'bin/*.js',
'app/javascript/**/*.{js,jsx}',
// This exclusion avoids running coverage on Barrel files, https://twitter.com/housecor/status/981558704708472832
'!app/javascript/**/index.js',
'!app/javascript/packs/**/*.js', // avoids running coverage on webpacker pack files
'!**/__tests__/**',
'!**/__stories__/**',
'!app/javascript/storybook-static/**/*.js',
// We do not need code coverage on files that are prop types
// or eslint configuration files.
'!app/javascript/**/*PropTypes.js',
'!./**/.eslintrc.js',
// Ignore Storybook configuration files
'!app/javascript/.storybook/**/*.{js,jsx}',
],
coverageThreshold: {
global: {
statements: 41,
branches: 38,
functions: 40,
lines: 42,
},
},
moduleNameMapper: {
'\\.(svg|png|css)$': '<rootDir>/empty-module.js',
'^@crayons(.*)$': '<rootDir>/app/javascript/crayons$1',
'^@utilities(.*)$': '<rootDir>/app/javascript/utilities$1',
'^@components(.*)$': '<rootDir>/app/javascript/shared/components$1',
'^react$': 'preact/compat',
'^react-dom$': 'preact/compat',
},
// The webpack config folder for webpacker is excluded as it has a test.js file that gets
// picked up by jest if this folder is not excluded causing a false negative of a test suite failing.
testPathIgnorePatterns: [
'/node_modules/',
'<rootDir>/config/webpack',
// Allows developers to add utility modules that jest won't run as test suites.
'/__tests__/utilities/',
'<rootDir>/app/javascript/storybook-static',
'<rootDir>/cypress',
],
watchPlugins: [
'jest-watch-typeahead/filename',
'jest-watch-typeahead/testname',
],
testEnvironment: './customJsDomEnvironment.js',
};