Skip to content

Commit

Permalink
feat: hoisted jest config
Browse files Browse the repository at this point in the history
Signed-off-by: Wouter Termont <woutermont@gmail.com>
  • Loading branch information
woutermont committed Apr 26, 2021
1 parent 2a9fe60 commit 595afac
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 128 deletions.
61 changes: 61 additions & 0 deletions packages/jest-config/jest-preset.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

module.exports = {
//bail: 1, // set to stop testing after N failures
//clearMocks: true, // set to run jest.clearAllMocks() before each test
collectCoverage: true,
collectCoverageFrom: [
"**/*.{ts,js}",
"!public-api.ts",
"!node_modules",
"!dist"
],
coverageDirectory: "<rootDir>/../", // since current reporters only output json summary
coverageProvider: "babel", // maybe change to v8 for speed, if it detects full coverage good enough
coverageReporters: [ "json-summary", "text-summary", "text" ], // disabled json, lcov and clover reporters
errorOnDeprecated: true,
globals: {
'ts-jest': {
tsconfig: {
//"allowJs": true,
//"allowUnreachableCode": true,
"baseUrl": "<rootDir>/",
//"checkJs": true,
//"composite": true,
"declaration": false, // differs from tsconfig
//"declarationMap": true,
"downlevelIteration": true,
//"emitDecoratorMetadata": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true,
"importHelpers": true,
"inlineSourceMap": true, // differs from tsconfig
"inlineSources": true, // differs from tsconfig
"module": "es2020", // differs from tsconfig; switch to es2020 in v27
"moduleResolution": "node",
//"newLine": "LF",
"noFallthroughCasesInSwitch": true,
//"noImplicitOverride": true,
"noImplicitReturns": true,
//"noPropertyAccessFromIndexSignature": true,
//"noUncheckedIndexedAccess": true,
//"noUnusedLocals": true,
//"noUnusedParameters": true,
"outDir": "<rootDir>/dist",
"sourceMap": false, // differs from tsconfig
"strict": false, // differs from tsconfig; should be true !
"target": "es2020"
}
},
},
moduleFileExtensions: [ "ts", "js" ],
preset: "ts-jest",
// resetMocks: true, // set to run jest.resetAllMocks() before each test
// restoreMocks: true, // set to run jest.restoreAllMocks() before each test
testMatch: [ "**/*.spec.ts" ],
// testTimeout: 300000,
transform: {
'^.+\\.ts?$': 'ts-jest'
},
// verbose: true,
};
25 changes: 0 additions & 25 deletions packages/jest-config/jest.config.js

This file was deleted.

98 changes: 0 additions & 98 deletions packages/jest-config/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions packages/jest-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@
"url": "https://github.com/digita-ai/dgt-config/issues"
},
"peerDependencies": {
"jest": "^26.6.3",
"jest-mock-extended": "^1.0.13"
"@types/jest": "^26.0.22",
"jest-mock-extended": "^1.0.13",
"jest": "^26.6.3"
},
"dependencies": {
"@types/jest": "^26.0.22",
"@types/node": "^14.14.41",
"ts-jest": "^26.5.5",
"ts-node": "^9.1.1",
"typescript": "^4.2.3"
}
}

0 comments on commit 595afac

Please sign in to comment.