Convert Jest configuration to TypeScript (#561)
This commit is contained in:
parent
c6122eea93
commit
8fa10a5919
5 changed files with 760 additions and 533 deletions
|
@ -1,8 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
...require("@snowpack/app-scripts-react/jest.config.js")(),
|
|
||||||
"snapshotSerializers": ["enzyme-to-json/serializer"],
|
|
||||||
"moduleNameMapper": {
|
|
||||||
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/src/__mocks__/fileMock.js",
|
|
||||||
"\\.(css|less)$": "<rootDir>/src/__mocks__/styleMock.js"
|
|
||||||
}
|
|
||||||
};
|
|
16
jest.config.ts
Normal file
16
jest.config.ts
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
// See: https://github.com/snowpackjs/snowpack/issues/3242
|
||||||
|
// @ts-ignore
|
||||||
|
import snowpackConfig from "@snowpack/app-scripts-react/jest.config.js";
|
||||||
|
import { Config } from "@jest/types";
|
||||||
|
|
||||||
|
const config: Config.InitialOptions = {
|
||||||
|
...snowpackConfig(),
|
||||||
|
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
|
||||||
|
snapshotSerializers: ["enzyme-to-json/serializer"],
|
||||||
|
moduleNameMapper: {
|
||||||
|
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/src/__mocks__/fileMock.js",
|
||||||
|
"\\.(css|less)$": "<rootDir>/src/__mocks__/styleMock.js"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default config;
|
|
@ -26,4 +26,5 @@ import Adapter from 'enzyme-adapter-react-16';
|
||||||
configure({ adapter: new Adapter() });
|
configure({ adapter: new Adapter() });
|
||||||
|
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
|
// @ts-ignore
|
||||||
global.MutationObserver = window.MutationObserver;
|
global.MutationObserver = window.MutationObserver;
|
|
@ -41,6 +41,7 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.10.5",
|
"@babel/core": "^7.10.5",
|
||||||
"@babel/preset-typescript": "^7.10.4",
|
"@babel/preset-typescript": "^7.10.4",
|
||||||
|
"@jest/types": "^26.6.2",
|
||||||
"@snowpack/app-scripts-react": "^1.10.0",
|
"@snowpack/app-scripts-react": "^1.10.0",
|
||||||
"@snowpack/plugin-postcss": "1.0.4",
|
"@snowpack/plugin-postcss": "1.0.4",
|
||||||
"@snowpack/plugin-webpack": "2.0.12",
|
"@snowpack/plugin-webpack": "2.0.12",
|
||||||
|
@ -57,6 +58,7 @@
|
||||||
"@testing-library/react": "^10.4.6",
|
"@testing-library/react": "^10.4.6",
|
||||||
"@types/dot": "^1.1.4",
|
"@types/dot": "^1.1.4",
|
||||||
"@types/enzyme": "^3.10.5",
|
"@types/enzyme": "^3.10.5",
|
||||||
|
"@types/enzyme-adapter-react-16": "^1.0.6",
|
||||||
"@types/file-saver": "^2.0.1",
|
"@types/file-saver": "^2.0.1",
|
||||||
"@types/jest": "^26.0.4",
|
"@types/jest": "^26.0.4",
|
||||||
"@types/lodash": "^4.14.165",
|
"@types/lodash": "^4.14.165",
|
||||||
|
@ -77,7 +79,7 @@
|
||||||
"eslint-plugin-react": "^7.20.5",
|
"eslint-plugin-react": "^7.20.5",
|
||||||
"grunt": "^1.2.1",
|
"grunt": "^1.2.1",
|
||||||
"grunt-contrib-copy": "^1.0.0",
|
"grunt-contrib-copy": "^1.0.0",
|
||||||
"jest": "^25.4.0",
|
"jest": "^26.6.3",
|
||||||
"mutationobserver-shim": "^0.3.7",
|
"mutationobserver-shim": "^0.3.7",
|
||||||
"postcss": "^7.0.32",
|
"postcss": "^7.0.32",
|
||||||
"postcss-cli": "^7.1.1",
|
"postcss-cli": "^7.1.1",
|
||||||
|
@ -86,6 +88,7 @@
|
||||||
"react-is": "^16.13.1",
|
"react-is": "^16.13.1",
|
||||||
"react-scripts": "^3.4.1",
|
"react-scripts": "^3.4.1",
|
||||||
"snowpack": "2.11.1",
|
"snowpack": "2.11.1",
|
||||||
|
"ts-node": "^9.1.1",
|
||||||
"typescript": "^3.8.3"
|
"typescript": "^3.8.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue