diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 00000000..78eac0c5 --- /dev/null +++ b/jest.config.js @@ -0,0 +1,27 @@ +const tsConfig = require('./tsconfig'); + +module.exports = { + preset: "ts-jest", + testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$", + globals: { + "ts-jest": { + tsConfig: { + ...tsConfig.compilerOptions, + types: ["jest", "node"] + }, + diagnostics: { + ignoreCodes: [151001] + }, + } + }, + moduleNameMapper: { + "@src/(.*)": "/src/$1" + }, + moduleFileExtensions: [ + "ts", + "tsx", + "js", + "jsx", + "json" + ], +}; diff --git a/package.json b/package.json index 5aad0f0f..2a494e3c 100644 --- a/package.json +++ b/package.json @@ -58,30 +58,6 @@ "lint": "bash hooks/pre-commit", "pretty": "bash scripts/pretty.sh" }, - "jest": { - "preset": "ts-jest", - "testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$", - "moduleFileExtensions": [ - "ts", - "tsx", - "js", - "jsx", - "json" - ], - "moduleNameMapper": { - "@src/(.*)": "/src/$1" - }, - "globals": { - "ts-jest": { - "tsConfig": "tsconfig.test.json", - "diagnostics": { - "ignoreCodes": [ - 151001 - ] - } - } - } - }, "author": "Colin Caine", "repository": { "type": "git", diff --git a/tsconfig.json b/tsconfig.json index 10575ca4..6f8a1d65 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,7 +6,7 @@ "outDir": "build/tsc-out", "sourceMap": true, "target": "es2017", - "lib": ["es2017","es2019.array","dom", "dom.iterable"], + "lib": ["es2017","es2019.array", "es2018.promise", "dom", "dom.iterable"], "types": ["web-ext-types"], "experimentalDecorators": true, "alwaysStrict": true, diff --git a/tsconfig.test.json b/tsconfig.test.json deleted file mode 100644 index cb433ed0..00000000 --- a/tsconfig.test.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "compilerOptions": { - "allowJs": true, - "moduleResolution": "node", - "noImplicitAny": false, - "noEmitOnError": true, - "outDir": "build/tsc-out", - "sourceMap": true, - "target": "es2017", - "lib": ["es2017", "es2019.array", "es2018.promise", "dom", "dom.iterable"], - "typeRoots": ["node_modules/@types"], - "types": ["jest", "node"], - "experimentalDecorators": true, - "alwaysStrict": true, - "baseUrl": "src/", - "paths": { - "@src/*": ["*"] - } - }, - "include": [ - "./src/**/*" - ], - "exclude": [ - "./src/**/*.test.ts" - ] -}