2016-08-04 51 views
0

Wenn ich von Chrome zu PhantomJS wechseln bekomme ich die errorhWie verwende ich PhantomJS mit Aurelia?

folgende
Starting 'unit'... 
03 08 2016 21:39:43.629:INFO [karma]: Karma v0.13.22 server started at http://localhost:9876/ 
03 08 2016 21:39:43.643:INFO [launcher]: Starting browser PhantomJS 
03 08 2016 21:39:44.355:INFO [PhantomJS 2.1.1 (Linux 0.0.0)]: Connected on socket /#ns0iei_Fprf487aCAAAA with id 15517298 
PhantomJS 2.1.1 (Linux 0.0.0) ERROR 
    SyntaxError: Expected an identifier but found 'originalDefine' instead 
    at /home/xenoterracide/IdeaProjects/rpf-ui/test/aurelia-karma.js:49 


{ uid: 0, 
    name: 'unit', 
    branch: false, 
    error: 1, 
    duration: [ 1, 91922852 ], 
    time: 1470278384500 } 
1 

Hier die karma.conf.js von Aurelia erzeugt wird.

"use strict"; 
const path = require('path'); 
const project = require('./aurelia_project/aurelia.json'); 
const tsconfig = require('./tsconfig.json'); 

let testSrc = [ 
    { pattern: project.unitTestRunner.source, included: false }, 
    'test/aurelia-karma.js' 
]; 

let output = project.platform.output; 
let appSrc = project.build.bundles.map(x => path.join(output, x.name)); 
let entryIndex = appSrc.indexOf(path.join(output, project.build.loader.configTarget)); 
let entryBundle = appSrc.splice(entryIndex, 1)[0]; 
let files = [entryBundle].concat(testSrc).concat(appSrc); 

module.exports = function(config) { 
    config.set({ 
    basePath: '', 
    frameworks: [project.testFramework.id], 
    files: files, 
    exclude: [], 
    preprocessors: { 
     [project.unitTestRunner.source]: [project.transpiler.id] 
    }, 
    typescriptPreprocessor: { 
     typescript: require('typescript'), 
     options: tsconfig.compilerOptions 
    }, 
    reporters: ['progress'], 
    port: 9876, 
    colors: true, 
    logLevel: config.LOG_INFO, 
    autoWatch: true, 
    browsers: ['PhantomJS'], 
    singleRun: false 
    }); 
}; 

Antwort

1

Ich stieß gerade jetzt auf dieses Problem. I ‚gelöst‘ es von aurelia-karma.js in Zeile 49 von Modifizierung:

let originalDefine = global.define; 

zu:

var originalDefine = global.define; 

Derzeit keine Zeit hat, eine Ursache dafür zu finden, kann zurückkommen und später bearbeiten. Vermutlich könnte es sich um ein Problem mit dem Typoskript/-transpilieren mit let Kompatibilität handeln.

(Knoten v4.4.7, Karma 0.13.22, Jasmin v2.4.1, Aurelia-cli v0.17.0)