Open tkrotoff opened 9 years ago
+1, base
is making things hard, especially interoperability with different test systems.
+1, html page setup with karma 'base' will not be able to be open correctly by other web servers.
If nothing else, we should figure out what advantages (if any) the base prefix provides.
+1, this is a regular source of annoyance in XHR paths.
Seems there is now an easy way to deal with this by using the "proxies" setting. See http://karma-runner.github.io/1.0/config/files.html >> Loading Assets.
@jamesdanged Can you show an example of how to address this problem using the proxies
setting?
Proposal:
/
relating to the base directory (e.g. no more /base
path, direct root of your git project). The server would have one "virtual" file, e.g. "/" itself from which it serves the client HTML that kicks off the test. We may want to make this virtual name configurable, so that e.g. one could instruct it to be served from and opened from /test/karma.html
, for even better compatibility with a real HTML one might have at /test/qunit.html
in that same directory - so that any relative URLs are resolved the same way.FWIW I don't know why base
. The middleware code seems too compact and difficult to follow. We've wondered if we could rework it with express somehow.
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?
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.
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.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
.