Skip to content

Commit

Permalink
update(web-testing): more jest configuration
Browse files Browse the repository at this point in the history
issue #105
  • Loading branch information
sabertazimi committed Aug 4, 2021
1 parent 1f41e63 commit f5484c0
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions notes/web/javascript/javascriptAdvancedNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -7401,10 +7401,13 @@ const paths = pathsToModuleNameMapper(compilerOptions.paths, {

module.exports = {
roots: ['<rootDir>/src'],
collectCoverage: true,
coverageDirectory: 'coverage',
transform: {
'^.+\\.jsx?$': '<rootDir>/jest.transformer.js',
'^.+\\.tsx?$': 'ts-jest',
},
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$',
transformIgnorePatterns: ['node_modules/(?!(gatsby)/)'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
moduleNameMapper: {
'.+\\.(css|styl|less|sass|scss)$': 'identity-obj-proxy',
Expand All @@ -7416,20 +7419,22 @@ module.exports = {
'^@layouts/(.*)$': '<rootDir>/src/layouts/$1',
'^@types/(.*)$': '<rootDir>/src/types/$1',
},
testPathIgnorePatterns: ['node_modules', '\\.cache', '<rootDir>.*/build'],
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$',
globals: {
window: {},
'ts-jest': {
tsConfig: './tsconfig.json',
},
},
setupFiles: ['./jest.stubs.js'],
testURL: 'http://localhost/',
testURL: 'http://localhost',
testEnvironment: 'jsdom',
setupFiles: ['<rootDir>/jest.setup.js'],
setupTestFrameworkScriptFile: '<rootDir>/src/setupEnzyme.ts',
collectCoverage: true,
};
```
`jest.stubs.js`:
`jest.setup.js`:
```js
// Global/Window object Stubs for Jest
Expand Down

0 comments on commit f5484c0

Please sign in to comment.