karma-runner / karma-runner/karma

basePath does not work properly in some circumstances

Open
#1,636 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

I am running karma using gulp. This is a gulp task module I require:

``` js
var karma = require("karma");

module.exports = function (done) {
new karma.Server({
configFile: '../../../karma.conf.js',
singleRun: true
}, function (exitCode) {
done();
}).start();
};
```

The module file is on path `root/tasks/test/karma.js`. I have a `root/karma.conf.js` as you can see... It contains this:

``` js
module.exports = function (config) {
config.set({
basePath: __dirname,
frameworks: ['jasmine'],
files: [
{pattern: 'src/nodelist.js', included: true},
{pattern: 'tests/*.js', included: true}
],
exclude: [],
reporters: ['progress'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Firefox'],
captureTimeout: 6000,
singleRun: false
});
};
```

It works now properly, but when I try to use `basePath: "root",` then it sets the basePath to `root/../../../` which I think is because the `configFile: '../../../karma.conf.js',` part of the gulp task. I use win7 x64. Any idea why this happens?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.