karma-runner / karma-runner/karma
Get rid of the "base" directory
- Dominant language
- JavaScript
- Stars
- 12k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
Following a question I've asked (without success) on the mailing-list few months ago: [Why a directory named "base" is prepended to all the loaded files?](https://groups.google.com/forum/#!topic/karma-users/rxMCVcXBes0/discussion)
With Karma all files are inside a directory named "base". I don't see the need for this added complexity.

In comparison, when using Jasmine directly (gulp-jasmine-browser or by writing my own SpecRunner.html), there is no "indirection": all files are loaded from the root directory => much easier, the way it should be.

- I have to prepend "base" to my XHRs for them to work (~~or add "urlRoot: 'base'" to karma.conf.js~~ => does not work anymore). I'm not the only one in this case: https://github.com/pizzapanther/Karma-Read-JSON/blob/v1.1.0/karma-read-json.js#L27.
- This makes it difficult to run unit tests using both Karma and (original) Jasmine.
- Also source maps don't work (I use TypeScript) when debugging my tests using Karma `singleRun: true`.
In Chrome when I click on a .ts file, I get a 404 because Karma tries to fetch `/base/Hello.spec.ts` instead of `/Hello.spec.ts`.
Contributor guide
Research direction
Start with karma.conf.js and reproduce the issue using singleRun: true, checking XHR requests and source-map requests in Chrome. Trace where the /base/ prefix is introduced; done means loaded files, XHRs, and TypeScript source maps work without that prefix while Karma behavior remains compatible.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100