Skip to content

Commit 6b8d9ec

Browse files
committed
Add ts-jest to transform tests
1 parent b86bfdc commit 6b8d9ec

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/main/resources/handlebars/typescript-fetch/package.mustache

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"typings": "./dist/index.d.ts",
1515
"scripts" : {
1616
"build": "tsc --outDir dist/",
17+
"test": "jest",
1718
"prepublishOnly": "npm run build"
1819
},
1920
"dependencies": {
@@ -23,9 +24,16 @@
2324
"@types/jest": "^25.2.1",
2425
"@types/node": "^13.13.0",
2526
"jest": "^25.4.0",
27+
"ts-jest": "^25.4.0",
2628
"typescript": "^3.8.3"
27-
}{{#npmRepository}},{{/npmRepository}}
28-
{{#npmRepository}}
29+
},
30+
"jest": {
31+
"transform": {
32+
"^.+\\.tsx?$": "ts-jest"
33+
},
34+
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
35+
"moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json", "node"]
36+
}{{#npmRepository}},
2937
"publishConfig":{
3038
"registry":"{{npmRepository}}"
3139
}

src/main/resources/handlebars/typescript-fetch/tsconfig.mustache

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
},
1515
"exclude": [
1616
"dist",
17-
"node_modules"
17+
"node_modules",
18+
"**/*.spec.ts"
1819
]
1920
}

0 commit comments

Comments
 (0)