Skip to content

Commit

Permalink
finish configuring ts-jest
Browse files Browse the repository at this point in the history
Signed-off-by: Danilo Romano <[email protected]>
  • Loading branch information
Danilo Romano committed Mar 16, 2022
1 parent 4346d01 commit af96205
Show file tree
Hide file tree
Showing 16 changed files with 8,994 additions and 1,413 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"typescript.tsdk": "/home/Danilo/Projects/erick-wendel/semana-js-expert/6.0/spotify-radio/node_modules/typescript/lib"
}
47 changes: 47 additions & 0 deletions jest.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

/** @type {import('@jest/types').Config.InitialOptions} */
const defaultConfig= {
coverageDirectory: "coverage",
coverageProvider: "v8",
coverageReporters: ["text", "lcov"],
coverageThreshold: {
global: {
branches: 100,
functions: 100,
lines: 100,
statements: 100
}
},
maxWorkers: "50%",
watchPathIgnorePatterns: ["node_modules"],
transformIgnorePatterns: ["node_modules"],
globals:{
"ts-jest":{
useESM:true
}
},
extensionsToTreatAsEsm: [".ts"]

}

/** @type {import('@jest/types').Config.InitialOptions} */
export default {
preset: "ts-jest",
projects: [{
...defaultConfig,
transform:{},
testEnvironment: "node",
displayName: "backend",
collectCoverageFrom: [
"server/",
"!server/index.ts"
],
transformIgnorePatterns: [
...defaultConfig.transformIgnorePatterns,
"public"
],
testMatch: [
"**/tests/**/server/**/*.test.ts"
],
}]
}
10 changes: 7 additions & 3 deletions nodemon.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"watch": ["server"],
"watch": [
"server"
],
"ext": "ts,json",
"ignore": ["server/**/*.spec.ts"],
"exec": "npx ts-node --transpile-only server/index.ts"
"ignore": [
"server/**/*.spec.ts"
],
"exec": "node --no-warnings --experimental-specifier-resolution=node --loader ts-node/esm server/index.ts"
}
Loading

0 comments on commit af96205

Please sign in to comment.