Am using Ember CLI and trying to use Karma with EmberScript, Emblem, and Mocha. If this works, it’s going to be epic! So far, however, no joy.
When I run karma start
I get this:
INFO [karma]: Karma v0.12.16 server started at http://localhost:9876/
INFO [launcher]: Starting browser PhantomJS
WARN [preprocess]: Can not load "ember-script", it is not registered!
Perhaps you are missing some plugin?
WARN [preprocess]: Can not load "emblem"!
ReferenceError: file is not defined
at createEmblemPreprocessor (/Users/aries/Workspace/paperhat/paperhat/node_modules/karma-emblem-preprocessor/lib/main.js:25:146)
at Array.invoke [as 0] (/Users/aries/Workspace/paperhat/paperhat/node_modules/karma/node_modules/di/lib/injector.js:75:15)
at get (/Users/aries/Workspace/paperhat/paperhat/node_modules/karma/node_modules/di/lib/injector.js:48:43)
at instantiatePreprocessor (/Users/aries/Workspace/paperhat/paperhat/node_modules/karma/lib/preprocessor.js:65:37)
at Array.forEach (native)
at /Users/aries/Workspace/paperhat/paperhat/node_modules/karma/lib/preprocessor.js:86:31
at /Users/aries/Workspace/paperhat/paperhat/node_modules/karma/lib/file_list.js:219:17
at Object.oncomplete (fs.js:107:15)
INFO [PhantomJS 1.9.7 (Mac OS X)]: Connected on socket rH4Ye5MolJkmrMdVOZaH with id 3064553
PhantomJS 1.9.7 (Mac OS X) ERROR
SyntaxError: Parse error
at /Users/aries/Workspace/paperhat/paperhat/app/app.em:1
Clearly, it is not loading the EmberScript and Emblem plugins. But I installed these using:
npm install karma-ember-preprocessor --save-dev
npm install karma-emblem-preprocessor --save-dev
My karma.conf file looks like this:
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['mocha'],
files: [
'vendor/jquery/dist/jquery.min.js',
'vendor/handlebars/handlebars.js',
'vendor/ember/ember.js',
'app/app.em',
'tests/*.em',
'app/templates/*.emblem'
],
browsers: ['PhantomJS'],
singleRun: true,
autoWatch: false,
plugins: [
'karma-mocha',
'karma-ember-preprocessor',
'karma-emblem-preprocessor',
'karma-phantomjs-launcher'
],
exclude: [],
preprocessors: {
"**/*.emblem": 'emblem',
'**/*.em': ['ember-script']
},
emberScriptPreprocessor: {
// options passed to the ember script compiler
options: {
bare: true,
sourceMap: true
},
// transforming the filenames
transformPath: function(path) {
return path.replace(/\.em/, '.js');
}
},
reporters: ['progress'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO
});
};
The package.json
file contains this (among other things, of course):
"devDependencies": {
"body-parser": "^1.2.0",
"broccoli-coffee": "^0.1.0",
"broccoli-ember-hbs-template-compiler": "^1.5.0",
"broccoli-ember-script": "^0.1.1",
"broccoli-emblem-compiler": "^0.3.16",
"broccoli-stylus-single": "^0.1.2",
"ember-cli": "0.0.28",
"express": "^4.1.1",
"glob": "^3.2.9",
"karma": "^0.12.16",
"karma-chrome-launcher": "^0.1.4",
"karma-ember-preprocessor": "^1.5.0",
"karma-ember-script-preprocessor": "^0.1.3",
"karma-emblem-preprocessor": "^0.1.3",
"karma-jasmine": "^0.1.5",
"karma-mocha": "^0.1.3",
"karma-phantomjs-launcher": "^0.1.4",
"karma-qunit": "^0.1.1",
"loom-generators-ember-appkit": "^1.1.1",
"mocha": "^1.19.0",
"originate": "0.1.5",
"qunitjs": "^1.12.0"
}
And bower.json
includes this:
"dependencies": {
"handlebars": "~1.3.0",
"jquery": "^1.11.1",
"qunit": "~1.12.0",
"ember-qunit": "~0.1.5",
"ember": "1.5.1",
"ember-data": "1.0.0-beta.7",
"ember-resolver": "stefanpenner/ember-jj-abrams-resolver#master",
"ic-ajax": "~1.x",
"loader": "stefanpenner/loader.js#1.0.0",
"ember-cli-shims": "stefanpenner/ember-cli-shims#0.0.1",
"ember-load-initializers": "stefanpenner/ember-load-initializers#0.0.1",
"bootstrap": "~3.1.1",
"mocha": "~1.19.0"
}
Is there something I’m missing on the front end? I can find no documentation on this at all. Anyone?
TIA, Chas.