Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"env": {
"browser": true,
"node": true,
"es6": true
"es6": true,
"jest": true
},
"rules": {
"no-console": "off",
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ npm-*
*-debug.log

# build folders
dist
dist
coverage
1 change: 1 addition & 0 deletions jest-preprocess.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('babel-jest').createTransformer();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does createTransformer() do?

Copy link
Contributor Author

@joshpensky joshpensky Mar 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the transformer is what allows Jest to transpile all of our TS code to JS so it can run its tests

I'm not sure if this needs to be explicitly stated in its own file anymore, but it's listed under the TS section for Jest! https://jestjs.io/docs/en/getting-started#using-typescript

18 changes: 18 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
transform: {
'^.+\\.tsx?$': 'ts-jest',
},
testRegex: '((\\.|/)(test|spec))\\.tsx?$',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
testPathIgnorePatterns: ['node_modules', '.cache'],
globals: {
__PATH_PREFIX__: '',
'ts-jest': {
diagnostics: false,
},
},
setupFilesAfterEnv: ['jest-extended'],
testURL: 'http://localhost',
collectCoverageFrom: ['src/**/*.ts'],
watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname'],
};
Loading