Skip to content

Commit

Permalink
Using ts-jest for tests to simplify config and adding sourcemap gener…
Browse files Browse the repository at this point in the history
…ation to fix debugging (#1620)
  • Loading branch information
jhsware committed Dec 17, 2022
1 parent 9a7b2c0 commit 2836945
Show file tree
Hide file tree
Showing 8 changed files with 227 additions and 87 deletions.
6 changes: 6 additions & 0 deletions .babelrc.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"plugins": [
"inferno",
"@babel/plugin-transform-modules-commonjs"
]
}
27 changes: 3 additions & 24 deletions jest.config-nodom.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,13 @@
import defaultSettings from "./jest.config.js";

export default {
collectCoverageFrom: [
"packages/*/src/**/*.ts",
"!**/*.ts.js",
"!**/inferno-utils/**/*",
"!**/inferno-router/**/utils.ts",
],
coverageDirectory: "coverage",
coverageReporters: ["html", "lcov", "text"],
globals: {
usingJSDOM: true,
usingJest: true
},
moduleFileExtensions: ["ts", "tsx", "js", "jsx"],
moduleNameMapper: {
"^inferno-router/utils": "<rootDir>/packages/inferno-router/src/utils.ts",
"^inferno(.*?)$": "<rootDir>/packages/inferno$1/src/index.ts",
"mobx": "<rootDir>/node_modules/mobx/dist/mobx.cjs.development.js"
},
...defaultSettings,
setupFiles: [],
testMatch: [
"<rootDir>/packages/*/__tests__/**/*spec.server-nodom.@(js|ts)?(x)"
],
testPathIgnorePatterns: [
"<rootDir>/packages/inferno/__tests__/transition.spec.jsx",
],
transform: {
"^.+\\.jsx?$": "<rootDir>/jest.babel.transform.js",
"^.+\\.tsx?$": "<rootDir>/jest.ts.transform.js"
},
testEnvironment: "node",
testRunner: "jest-jasmine2",
reporters: [["jest-silent-reporter", { "useDots": true }]]
}
3 changes: 2 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export default {
preset: "ts-jest",
collectCoverageFrom: [
"packages/*/src/**/*.ts",
"!**/*.ts.js",
Expand Down Expand Up @@ -27,7 +28,7 @@ export default {
],
transform: {
"^.+\\.jsx?$": "<rootDir>/jest.babel.transform.js",
"^.+\\.tsx?$": "<rootDir>/jest.ts.transform.js"
"^.+\\.tsx?$": [ "ts-jest", { "babelConfig": "<rootDir>/.babelrc.test" } ],
},
testEnvironment: "jsdom",
testRunner: "jest-jasmine2",
Expand Down
39 changes: 0 additions & 39 deletions jest.ts.transform.js

This file was deleted.

0 comments on commit 2836945

Please sign in to comment.