Can't find test files
Actual behavior
I can start karma, everything seems to run ok, but It doesn't find any test files.
Enviroment Details
I'm using the following karma.config :
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://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],
// list of files / patterns to load in the browser
files: [
'node_modules/angular2/bundles/angular2-polyfills.js', // Required for all major browsers
'node_modules/es6-shim/es6-shim.min.js' // Required by PhantomJS2
],
// list of files to exclude
exclude: [],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'dist/app/**/!(*.spec).js': ['coverage']
},
// test results reporter to use
// possible values: 'dots', 'progress', 'mocha', 'coverage'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['mocha', 'coverage'],
mochaReporter: {
colors: {
success: 'blue',
info: 'bgGreen',
warning: 'cyan',
error: 'bgRed'
}
},
// web server port
port: 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_DEBUG
logLevel: config.LOG_DEBUG,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['PhantomJS2'], // 'Chrome'
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,
// Concurrency level
// how many browser should be started simultanous
concurrency: Infinity
})
};
I have a test files named as : app.spec.js for example all around in dist/app but when running it doesn't find any.
Sorry for the code formatting, couldn't get the `` to work properly.
Sorry for the code formatting, couldn't get the `` to work properly.
I fixed it for you, the trick is to use three backticks before and after.
I have a test files named as : app.spec.js for example all around in dist/app but when running it doesn't find any.
You need to add it to the files array. For example
files = [
'node_modules/angular2/bundles/angular2-polyfills.js', // Required for all major browsers
'node_modules/es6-shim/es6-shim.min.js', // Required by PhantomJS2
'dist/app/*.spec.js'
]
@dignifiedquire I've also added 'node_modules/systemjs/dist/system.js', and I'm getting the following system-related error : Chrome 48.0.2564 (Windows 8.1 0.0.0) ERROR Uncaught TypeError: Unexpected anonymous System.register call. at C:/Users/taigi100/Desktop/Refact/node_modules/systemjs/dist/system.js:5. It seems to be working if I'm just starting the server and accessing it tho.
Sounds like you haven't configured systemjs for your tests take a look at https://github.com/rolaveric/karma-systemjs
@dignifiedquire I can't seem to figure out a proper way to set it up, here is what I've got so far : karma.config.js : http://pastie.org/10755078 system.config.js: http://pastie.org/10755080 error : http://prntscr.com/adjfc1
Sorry for the unrelated questions :(
Hello I'm facing a similar issue my tests are located under src/user/, as soon I move them to src/api/user karma is not able to find them anymore. Here is my karma config; module.exports = function (config) { config.set({ basePath: '', frameworks: ["jasmine", "karma-typescript"], files: [ "src//*.ts", ], preprocessors: { "/*.ts": "karma-typescript" }, reporters: ["progress", "coverage", "karma-typescript"], browsers: ['ChromeHeadless'], autoWatch: true, singleRun: false, concurrency: Infinity }); };
I hope you have resolved your issues by now. Please use StackOverflow for questions and support in the future as we want to keep issue tracker for bug reports and feature requests.