karma-runner / karma-runner/karma

Files in the 'files' config have incorrect path on Windows

Open
#1,799 2 comments 0 reactions 0 assignees View on GitHub
needs: investigation windows
Dominant language
JavaScript
Stars
12k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

With the following config in `karma.conf.js`

```
files: [
{pattern: 'node_modules/chai/chai.js', included: false},
{pattern: 'src/**/*.js', included: false},
{pattern: 'test/**/*.js', included: false}
]
```

when I view the available files for possible filtering in `test-main.js` (I use `require.js`)

```
Object.keys(window.__karma__.files).forEach(function (file) {
console.log(file);
});
```

I get file names like '/basesrc/Jxl.js', '/basesrc/core/Finalizer.js' and so on in Windows (note the absence of the forward slash between /base and src.

In OSX, the files are correctly reported as '/base/src/Jxl.js', '/base/src/core/Finalizer.js' and so on. This is causing a situation wherein I'm having to fudge the paths manually before running tests on Windows.

Contributor guide

Open the contributing guide

Research direction

Start with the `files` configuration in `karma.conf.js` and the file-key generation consumed by `test-main.js`. Reproduce the configuration on Windows and compare the resulting `window.__karma__.files` paths with the expected `/base/src/...` form; done means the separator is preserved and the existing file-filtering flow works without path fudging.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.