Giter VIP home page Giter VIP logo

Comments (6)

lewisl9029 avatar lewisl9029 commented on May 20, 2024

I'm seeing this issue too on v1.1.1.

SystemJS under karma tries to load from /base/jspm_packages/ whereas my actual modules folder is at /www/jspm_packages/ as configured in package.json.

Seems like the SystemJS baseURL for karma-jspm is hard-coded atm: c14be8a

from karma-jspm.

maxwellpeterson-wf avatar maxwellpeterson-wf commented on May 20, 2024

All files served by karma's built-in server need to be prefaced with /base as that is where it serves them from. The files being served must at least be included in serveFiles or loadFiles options.

If your jspm_packages are in /www/jspm_packages/ you will need to change your jspm packages configuration to www/jspm_packages/ directory like so:

jspm: {
    packages: "www/jspm_packages/"
}

It will then make a request to /base/www/jspm_packages/ which should resolve correctly.

from karma-jspm.

lewisl9029 avatar lewisl9029 commented on May 20, 2024

Hi,

I do have this set in karma.conf.js:

    jspm: {
      packages: 'www/jspm_packages/',
      loadFiles: [
        'www/**/*-test.unit.js'
      ],
      serveFiles: [
        'www/**/*.js'
      ],
      config: 'www/config.js'
    },

But I still get

WARN [web-server]: 404: /base/jspm_packages/github/angular/[email protected]

when I do

import angular from 'angular';

in my test.

As a side note, the test completes properly when I change this from the generated www/config.js:

System.config({
  "paths": {
    ...
    "github:*": "jspm_packages/github/*.js"
  }
});

to

System.config({
  "paths": {
    ...
    "github:*": "www/jspm_packages/github/*.js"
  }
});

But then module loading in my application breaks down.

Looks like my issue has something to do with config.js being placed in a different location from karma.conf.js, and thus using different relative paths (and the jspm.packages config in karma.conf.js doesn't seem to be working?). Doesn't look like this is the case for Frikki though.

from karma-jspm.

djindjic avatar djindjic commented on May 20, 2024

Hi @lewisl9029,
I've just followed your config and it has help me very much, thanks! I found an solution latest problem, so you can set karma proxies to get it work without changing config.js. Somethink like this:

proxies: {
  '/base/jspm_packages/': '/base/www/jspm_packages/'
}

Also, I want to ask @maxwellpeterson-wf are jspm.packages and jspm.config settings removed? I cant find it in issues but it seems to be true. It sounds so logical for me because package.json already has this configuration.
I'm not an node expert but does it possible to eliminate need for proxies with this package.json config too?

from karma-jspm.

capaj avatar capaj commented on May 20, 2024

@djindjic that proxy works for you? I have no idea why but I cannot get a proxy to a directory work at all. I always have to spin up another node server running on different port and use it as base. Like this: https://gist.github.com/capaj/8db4533c3a1cab1bf930

Could you post your full karma.conf.js?

from karma-jspm.

djindjic avatar djindjic commented on May 20, 2024

You can take a look to my jspm-sample project
I'm very interested to hear your opinion about my workflow if it works for you.

from karma-jspm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.