Karma basePath is defaulting to C:\

gulp, javascript, karma-jasmine, karma-runner

Solution

Set the basePath to the local CWD directory path with:

basePath: process.cwd(), //  this gets the path which gulp is running in terminal
files: [
 {patterns:'bower_components/**/*.js',included:true},
 {patterns:'src/*.js', included:true},
 {patterns:'tests/*Spec.js', included:true}
],
exclude: []

`process.cwd()` gets the CLI path, the path which node is running in the terminal.

Problem

I am trying to run jasmine Specs through karma but when karma looks for my included files it uses a basepath of `C:\` even though the configuration file is in `C:\dev\project\`. I am running Karma in a gulp task: ``` var karma = require('karma').server; gulp.task('test', function (done) { karma.start({configFile: '../../../karma.conf.js', singleRun: true}, done); }); ``` The settings that relate to this issue: ``` basePath: '', files: [ {patterns:'bower_components/**/*.js',included:true}, {patterns:'src/*.js', included:true}, {patterns:'tests/*Spec.js', included:true} ], exclude: [] ``` When I run `gulp test` the log from karma spits out this: ``` WARN [watcher]: Pattern "C:/bower_components/**/*.js" does not match any file. WARN [watcher]: Pattern "C:/src/*.js" does not match any file. WARN [watcher]: Pattern "C:/tests/*Spec.js" does not match any file. ``` I'm new to karma and am not really sure what the issue is here. I tried a `basePath` of `''`, `'./'`, and `'/'`.

Original source