karma-runner / karma-runner/karma

Get rid of the "base" directory

Open
#1,607 8 comments 14 reactions 0 assignees View on GitHub
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.

![karma](https://cloud.githubusercontent.com/assets/643434/10287677/ce113626-6b94-11e5-8289-6d88ec1dabee.png)

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.

![gulp-jasmine-browser](https://cloud.githubusercontent.com/assets/643434/10287469/6ef36a7a-6b93-11e5-986f-cb4958dcf62c.png)
- 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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.