Open FlippieCoetser opened 2 years ago
This two-step process works:
tsc --project tsconfig.json
karma start
Here is a copy of the tsconfig.json:
tsconfig.json
{ "compilerOptions": { "module": "es2020", "moduleResolution": "node", "target": "es2020", "declaration": true, "noImplicitAny": false, "noImplicitThis": true, "noResolve": true, "allowJs": true, "allowSyntheticDefaultImports": true, "esModuleInterop": true, }, "exclude": [ "node_modules", "karma.conf.js" ] }
Here is a copy of the karma,conf.js:
karma,conf.js
module.exports = function(config) { config.set({ basePath: "", frameworks: ["jasmine"], files: [ { pattern: "**/*.test.js", type: "module", included: true }, { pattern: "**/*.js", type: "module", included: false } ], exclude: [], preprocessors: {}, reporters: ["spec"], port: 9876, colors: true, logLevel: config.LOG_INFO, autoWatch: true, browsers: ["Chrome"], singleRun: true, concurrency: Infinity }); };
This one-step process using karma-typescript does not work:
karma-typescript
Here is a copy of the karma,conf.js after installing karma-typescript:
module.exports = function(config) { config.set({ basePath: "", frameworks: ["jasmine", "karma-typescript"], files: [ { pattern: "**/*.test.ts", type: "module", included: true }, { pattern: "**/*.ts", type: "module", included: false } ], exclude: [], preprocessors: { "**/*.ts": ["karma-typescript"] }, reporters: ["spec", "karma-typescript"], port: 9876, colors: true, logLevel: config.LOG_INFO, autoWatch: true, browsers: ["Chrome"], singleRun: true, concurrency: Infinity }); };
Here is a screenshot of the errors:
How can I set up karma to use the typescript files rather than the compiled javascript files?
Please remove the output js files created by tsc, otherwise they will be used instead of the expected output of karma-typescript.
This two-step process works:
tsc --project tsconfig.json
karma start
Here is a copy of the
tsconfig.json
:Here is a copy of the
karma,conf.js
:This one-step process using
karma-typescript
does not work:Here is a copy of the
karma,conf.js
after installingkarma-typescript
:Here is a screenshot of the errors:![image](https://user-images.githubusercontent.com/3672126/132948957-1fb445d6-ecc1-40a1-b466-9092d1076daf.png)
How can I set up karma to use the typescript files rather than the compiled javascript files?