computmaxer / karma-jspm

Other
74 stars 50 forks source link

WARN [web-server]: 404 #70

Closed roine closed 9 years ago

roine commented 9 years ago

Karma gives me a 404,

WARN [web-server]: 404: /source/components/todotable/todotable.spec.js

The file is served at /base/source/components/todotable/todotable.spec.js, but JSPM is not adding the base prefix.

Here's my JSPM config in package.json

jspm: {
      useBundles: true,
      loadFiles: ['source/components/**/*.spec.js'],
      serveFiles: ['source/components/**/!(*.spec).js']
    },
unional commented 9 years ago

I get mine to work with keeping baseURL: "base"

I'll create a sample project and share it.

unional commented 9 years ago

Just uploaded. You can get it form here: https://github.com/unional/karma-jspm-sample

ghost commented 9 years ago
 jspm: {
            serveFiles: [
                './.build/app/**/*.js'],

            loadFiles: [
                './src/app/**/**.spec.js'
            ]
        },

I have ./build/jspm_packages ./build/app/main - src files are in .build/app/*

my test srcs are in ./src/app/*/.spec.js

get

17 07 2015 19:40:41.905:WARN [web-server]: 404: /src/app/api/websql/websql.spec.js
17 07 2015 19:40:41.908:WARN [web-server]: 404: /src/app/transaction/transaction.service.spec.js`

System.config({
  "baseURL": "/",
ghost commented 9 years ago

I can't set baseURL twice anymore.

I'm stuck with 404's on my specs now.

@jayudey-wf is there any work being done to fix our 404 issues? Seems to be an issue for multple people and setups.

Currently my UT's are broken even with @omerts fix.

maxwellpeterson-wf commented 9 years ago

@robertbaker try removing your baseURL setting from config.js (letting karma-jspm set it for you) or set it to 'base'

ghost commented 9 years ago

I did.

I only have baseURL set in my package.json

it's set to .build

No difference

maxwellpeterson-wf commented 9 years ago

This project doesn't support having a custom baseURL at the moment. You would need to remove it from there as well. That is just not something we have ever needed to do based on our project structures.

I would like to add support for it, but with the inability to set baseURL more than once I'm not sure what the best approach is.

unional commented 9 years ago

I'm now using karma-systemjs instead of karma-jspm and seems to be working fine. You can customize the baseURL there:

config.set({
    ...,
    systemjs: {
        configFile: "yourApp/config.js",
        config: { baseURL: "testDir", ...}
    }
});
ghost commented 9 years ago

@unional do you have to specify all of the jspm packages you are using in your unit tests + code. That's my main problem with it. I update stuff too often to keep changing the config with new version numbers.

unional commented 9 years ago

You update the jspm packages as you would normally in your real config.js file. in the karma.conf.js you don't have to do that as it reads that config file as in systemjs: { configFile: "..." }.

riddla commented 9 years ago

Maybe you can/should mention the baseURL: "/base/" setting within the README? It did resolve my setup problems as well ...

maxwellpeterson-wf commented 9 years ago

Please follow #91 for updates on this issue