computmaxer / karma-jspm

Other
74 stars 50 forks source link

testing files returning 404 #68

Closed yordis closed 9 years ago

yordis commented 9 years ago

This is my karma configuration. Basically I am trying to just load the testing files and give me 404 for the files.

At the same I want to understand why is trying to pull jspm_packages/system-polyfills.src.js.

{
  "dependencies": {
    "jspm": "^0.15.7"
  },
  "devDependencies": {
    "chai": "^3.0.0",
    "karma": "^0.12.37",
    "karma-jspm": "^2.0.0-beta.1",
    "karma-mocha": "^0.2.0",
    "karma-mocha-reporter": "^1.0.2",
    "karma-phantomjs-launcher": "^0.2.0",
    "karma-sinon-chai": "^1.0.0",
    "mocha": "^2.2.5",
    "phantomjs": "^1.9.17",
    "phantomjs-polyfill": "0.0.1"
  },
  "jspm": {
    "main": "src/liquid",
    "directories": {},
    "dependencies": {
      "bootstrap": "github:twbs/bootstrap@^3.3.5",
      "classnames": "github:JedWatson/classnames@^2.1.2",
      "css": "github:systemjs/plugin-css@^0.1.13",
      "font": "github:systemjs/system-font@master",
      "less": "github:aaike/jspm-less-plugin@^0.0.5",
      "react": "npm:react@^0.14.0-beta1",
      "react-dom": "npm:react-dom@^0.14.0-beta1"
    },
    "devDependencies": {
      "babel": "npm:babel-core@^5.1.13",
      "babel-runtime": "npm:babel-runtime@^5.1.13",
      "core-js": "npm:core-js@^0.9.4"
    }
  }
}
WARN [watcher]: Pattern "{PATH}/jspm_packages/system-polyfills.src.js" does not match any file.
INFO [karma]: Karma v0.12.37 server started at http://localhost:9876/
INFO [launcher]: Starting browser PhantomJS
INFO [PhantomJS 1.9.8 (Mac OS X 0.0.0)]: Connected on socket 0_HAsSDiLTc3h8HNoxn4 with id 88612377
WARN [web-server]: 404: /test/components/button/button.spec.js
module.exports = function(config) {
  config.set({
    basePath: '',
    port: 9876,
    colors: true,
    autoWatch: false,
    singleRun: true,
    logLevel: config.LOG_INFO,

    jspm: {
      loadFiles: [
        'test/**/*.spec.js'
      ],
      serveFiles: [
        'src/**/*.js'
      ]
    },
    exclude: [],

    browsers: ['PhantomJS'],
    reporters: ['mocha'],
    frameworks: [
      'jspm',
      'mocha',
      'sinon-chai'
    ],
    plugins: [
      'karma-jspm',
      'karma-sinon-chai',
      'karma-mocha',
      'karma-mocha-reporter',
      'karma-phantomjs-launcher'
    ],
    preprocessors: {

    }
  })
}
yordis commented 9 years ago

One thing I notice is about karma add /base/ prefix in every URL

yordis commented 9 years ago

This is the way I fixed it right now but I don't understand why I have to proxy everything now. I think this is just the work around :-1:


proxies: {
      '/src/': '/base/src/',
      '/test/': '/base/test/',
      '/jspm_packages/': '/base/jspm_packages/'
    },
unional commented 9 years ago

Here is another way. Keep the baseURL = "base".

You can check out the sample I have: https://github.com/unional/karma-jspm-sample

yordis commented 9 years ago

@unional thank you very much but I don't think that should be the solution because config.js is the global configuration for the project, I shouldn't "hack" the system config just for get around with the testing environment.

At the same and very important look this that's basically trying to do what you are saying, so that mean, that's not working properly I guess @matoilic can actually say if I am wrong about that

unional commented 9 years ago

Yeah, I also realize what I have is not correct for the reason that you mentioned. Still looking for answer.

unional commented 9 years ago

I used karma-systemjs and able to make it work with a PR.

yordis commented 9 years ago

@unional I think that could a good idea and I never get the idea about this project because the way I see jspm is just management tool on top of System, so, look the code, outside of try to change some system stuff in the adapter I really don't see the point what could be the difference between this and karma-systemjs

ghost commented 9 years ago

@yordis I would use karma-systemjs except you must explicity list all the packages you installed via JSPM, which isn't ideal for me because I update deps often.

yordis commented 9 years ago

ups missclick

kubawalinski commented 9 years ago

@yordis I got the same issue. Thanks very much for the fix via proxies. I am looking for a better solution, though. Have you found any better way of fixing this? Do you think it is worth investigating the adapter.js file you mentioned earlier?

yordis commented 9 years ago

@kubawalinski I didn't find any solution for now, like I said in some comment is weird because they actually change the baseUrl of System in that plugin but for some reason doesn't work so I just stay with this work around :disappointed:

I didn't try to fix it, sorry about that

maxwellpeterson-wf commented 9 years ago

Please follow #91 for updates on this issue.