storybook/jest.config.js

68 lines
2.2 KiB
JavaScript
Raw Normal View History

module.exports = {
2017-12-23 21:12:27 +01:00
cacheDirectory: '.cache/jest',
clearMocks: true,
moduleNameMapper: {
2017-06-05 00:58:23 +02:00
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/__mocks__/fileMock.js',
'\\.(css|scss)$': '<rootDir>/__mocks__/styleMock.js',
'\\.(md)$': '<rootDir>/__mocks__/htmlMock.js',
},
projects: [
'<rootDir>',
'<rootDir>/examples/cra-kitchen-sink',
2019-01-09 22:27:31 +08:00
'<rootDir>/examples/cra-ts-kitchen-sink',
'<rootDir>/examples/html-kitchen-sink',
'<rootDir>/examples/riot-kitchen-sink',
'<rootDir>/examples/svelte-kitchen-sink',
'<rootDir>/examples/vue-kitchen-sink',
'<rootDir>/examples/angular-cli',
2018-12-04 12:02:22 +01:00
'<rootDir>/examples/preact-kitchen-sink',
'<rootDir>/examples/cra-react15',
],
roots: [
'<rootDir>/addons',
'<rootDir>/app',
'<rootDir>/lib',
'<rootDir>/examples/official-storybook',
],
transform: {
2018-08-15 17:26:24 +03:00
'^.+\\.jsx?$': '<rootDir>/scripts/babel-jest.js',
'^.+\\.tsx?$': '<rootDir>/scripts/babel-jest.js',
},
testMatch: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
testPathIgnorePatterns: [
'/node_modules/',
'/dist/',
'addon-jest.test.js',
'/cli/test/',
'/examples/cra-kitchen-sink/src/App.test.js',
'/examples/cra-react15/src/App.test.js',
'/examples/cra-ts-kitchen-sink/src/components/',
2019-04-25 22:54:53 +02:00
'/examples/angular-cli/src/app/*',
],
collectCoverage: false,
2017-05-23 20:56:54 +02:00
collectCoverageFrom: [
2018-12-16 12:12:26 +02:00
'app/**/*.{js,jsx,ts,tsx}',
'lib/**/*.{js,jsx,ts,tsx}',
'addons/**/*.{js,jsx,ts,tsx}',
2019-03-18 22:27:32 +01:00
],
coveragePathIgnorePatterns: [
'/node_modules/',
'/cli/test/',
'/dist/',
'/generators/',
'/dll/',
'/__mocks__ /',
2017-05-23 20:56:54 +02:00
],
snapshotSerializers: ['jest-emotion', 'enzyme-to-json/serializer'],
coverageDirectory: 'coverage',
setupFilesAfterEnv: ['./scripts/jest.init.js'],
2019-03-18 22:27:32 +01:00
coverageReporters: ['lcov'],
testEnvironment: 'jest-environment-jsdom-thirteen',
setupFiles: ['raf/polyfill'],
testURL: 'http://localhost',
2018-10-12 22:30:39 -07:00
modulePathIgnorePatterns: ['/dist/.*/__mocks__/'],
2018-12-16 12:12:26 +02:00
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx', 'json', 'node'],
2019-03-18 22:27:32 +01:00
watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname'],
};