karma-jspm icon indicating copy to clipboard operation
karma-jspm copied to clipboard

No Babel transpilation in PhantomJS

Open jstaro opened this issue 8 years ago • 3 comments

My config works fine in Chrome, but in PhantomJS, as soon as I try to import an ES6 class in my spec files, karma spits out a not-so-helpful Attempting to configurable [sic] attribute of unconfigurable property.

I can import ES5 modules just fine in specs.

Not importing anything in my spec files, but rewriting the Jasmine tests using ES6 fat arrow syntax makes PhantomJS balk with a SyntaxError: Parse error message.

All this makes me believe files are not being transpiled.

karma.conf.js

module.exports = function (config) {
    config.set({
        frameworks: ['jspm', 'jasmine', 'phantomjs-shim'],
        jspm: {
            loadFiles: ['specs/**/*.js'],
            serveFiles: ['app/**/*.js']
        },
        browsers: ['PhantomJS']
    });
}

package versions

[...]
  "devDependencies": {
    "jasmine-core": "^2.4.1",
    "jspm": "^0.16.15",
    "karma": "^0.13.15",
    "karma-chrome-launcher": "^0.2.2",
    "karma-jasmine": "^0.3.6",
    "karma-jasmine-diff-reporter": "^0.3.1",
    "karma-jspm": "^2.0.2",
    "karma-phantomjs-launcher": "^0.2.1",
    "karma-phantomjs-shim": "^1.1.2",
    "phantomjs": "^1.9.19"
  },
  "jspm": {
    "dependencies": {
      "angular": "github:angular/bower-angular@^1.4.8",
      "angular-ui-router": "github:angular-ui/ui-router@^0.2.15",
      "jasmine": "npm:jasmine@^2.4.1",
      "lodash": "npm:lodash@^3.10.1",
      "text": "github:systemjs/plugin-text@^0.0.4"
    },
    "devDependencies": {
      "babel": "npm:babel-core@^5.8.24",
      "babel-runtime": "npm:babel-runtime@^5.8.24",
      "core-js": "npm:core-js@^1.1.4"
    }
  }
[...]

jstaro avatar Dec 08 '15 13:12 jstaro

+1

Offirmo avatar Mar 03 '16 22:03 Offirmo

I'm having this same issue with typescript transpilation. Tests run fine in Chrome but fail in Phantom.

If I re-write my tests to be vanilla js they are interpreted and run fine

dpix avatar Jun 22 '16 01:06 dpix

I managed to fix this by including core-js before loading my tests

dpix avatar Jun 22 '16 08:06 dpix