docbrown/jest.config.js
ludwiczakpawel 245e70d4a8
Crayons: Buttons vs CTAs (#15311)
* init

* buttons

* buttons, ctas, icons

* ctas fix

* links vs ctas

* alias

* fixes

* add tests for Buttons component

* add tooltip to button story controls

* add link and CTA tests

* add prop types

* docs

* designs

* docs

* focus visible moved to global place

* Updated some component snapshot tests.

* Mocked react-inlinesvg module because of https://github.com/gilbarbara/react-inlinesvg/issues/145\#issuecomment-623453339

* tests

* Copy updates

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* missed spots

* Apply suggestions from code review

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* danger accent colors

* node

* colors

* adding code comment

* better prop name: style -> variant

* button new

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
Co-authored-by: Nick Taylor <nick@dev.to>
2021-11-30 20:40:32 +01:00

58 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',
'^@images(.*)$': '<rootDir>/app/assets/images$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',
};