You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A simple out-of-box karma setup fails to run. I've made a sample repo to reproduce this issue here. All details such as error message are also included in the repo. To run the repo, clone it and run npm run test to see the error. Ideas are welcomed on how to fix this.
ERROR
An error was thrown in afterAll
Error: Can't find ./index [<repo-clone-path>/index.ts] (required by <repo-clone-path>/index.test.ts)
require@node_modules/karma-typescript/dist/client/commonjs.js:13:23
require/<@node_modules/karma-typescript/dist/client/commonjs.js:18:24
global.wrappers["<repo-clone-path>/index.test.ts"]<@index.test.ts:1:1 <- index.test.js:39:22
require@node_modules/karma-typescript/dist/client/commonjs.js:17:25
@node_modules/karma-typescript/dist/client/commonjs.js:38:16
@node_modules/karma-typescript/dist/client/commonjs.js:37:40
@node_modules/karma-typescript/dist/client/commonjs.js:40:3
karma.conf.js
module.exports=function(config){config.set({// base path that will be used to resolve all patterns (eg. files, exclude)basePath: '',// frameworks to use// available frameworks: https://www.npmjs.com/search?q=keywords:karma-adapterframeworks: ['jasmine','karma-typescript'],// list of files / patterns to load in the browserfiles: ["*.test.ts"],// list of files / patterns to excludeexclude: [],// preprocess matching files before serving them to the browser// available preprocessors: https://www.npmjs.com/search?q=keywords:karma-preprocessorpreprocessors: {"*.ts": "karma-typescript"},// test results reporter to use// possible values: 'dots', 'progress'// available reporters: https://www.npmjs.com/search?q=keywords:karma-reporterreporters: ['progress'],// web server portport: 9876,// enable / disable colors in the output (reporters and logs)colors: true,// level of logging// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUGlogLevel: config.LOG_INFO,// enable / disable watching file and executing tests whenever any file changesautoWatch: true,// start these browsers// available browser launchers: https://www.npmjs.com/search?q=keywords:karma-launcherbrowsers: ['Firefox'],// Continuous Integration mode// if true, Karma captures browsers, runs the tests and exitssingleRun: false,// Concurrency level// how many browser instances should be started simultaneouslyconcurrency: Infinity})}
Environment
OS: Ubuntu
Browser: Firefox 100
IDE: Visual Studio Code
The text was updated successfully, but these errors were encountered:
@chickencoding123 Karma is not capable of analyzing the imports graph to determine all files which need to be served or loaded - they need to be listed explicitly. So that's why you get an error: transpiled index.ts is not served by Karma dev-server and not loaded by the test page. The solution is to change files: ["*.test.ts"] to files: ["*.ts"] to ensure that index.ts is correctly included.
See #2966 and #3335 for discussions about this feature.
A simple out-of-box karma setup fails to run. I've made a sample repo to reproduce this issue here. All details such as error message are also included in the repo. To run the repo, clone it and run
npm run test
to see the error. Ideas are welcomed on how to fix this.ERROR
karma.conf.js
Environment
The text was updated successfully, but these errors were encountered: