karma-runner / karma-coffee-preprocessor Goto Github PK
View Code? Open in Web Editor NEWA Karma plugin. Compile coffee script on the fly.
License: MIT License
A Karma plugin. Compile coffee script on the fly.
License: MIT License
Tests using latest versions of karma are spewing out these messages:
DEPRECATED: use your own version of lodash, this will go away in [email protected]
Here is the reason:
If there's a transpilation error, we get a nice log message indicating where the error occurred, but the process hangs indefinitely because the finish callback is never executed (rightfully so, since it would probably cause many other errors down the line).
Unfortunately this has the nasty side effect that anything depending on the process to finish (e.g. a deployment script) will hang indefinitely as well. I think it'd be nice to add the ability to have a callback executed in the event of a transpilation error. I've made the corresponding change here:
But just wanted to hear feedback before making a pull request.
Show line numbers.
Extracted from karma-runner/karma#550
The dependency should be updated.
push readme.md to npm
I got warning when trying to install this module
npm WARN package.json [email protected] No README data
Cheers
When trying to install karma and other tests, get the following errors:
npm ERR! peerinvalid The package karma does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer [email protected] wants karma@~0.9
npm ERR! peerinvalid Peer [email protected] wants karma@>=0.9.3
npm ERR! peerinvalid Peer [email protected] wants karma@>=0.9
npm ERR! peerinvalid Peer [email protected] wants karma@>=0.9
npm ERR! peerinvalid Peer [email protected] wants karma@>=0.9
npm ERR! peerinvalid Peer [email protected] wants karma@>=0.9
npm ERR! peerinvalid Peer [email protected] wants karma@>=0.9
npm ERR! peerinvalid Peer [email protected] wants karma@>=0.11.14
npm ERR! peerinvalid Peer [email protected] wants karma@>=0.9
It works by using 0.1.3 of the preprocessor, but I was wondering if there is another way to get them all installed? 0.1.3 breaks our build server
The latest karma (v1.1.1) is throwing a warning with karma-coffee-preprocessor:
DEPRECATED: use your own version of lodash, this will go away in [email protected]
and I've pinpointed it to this line:
https://github.com/karma-runner/karma-coffee-preprocessor/blob/v1.0.0/index.js#L27
Could you change it so that lodash is a proper dependency?
Sorry, I am a little confused where exactly to report this issue (lazd/gulp-karma#26) that I am seeing when using gulp watch coffee files. The reason I thought may be it could do something with this preprocessor, was that the error goes away if I switch from coffee specs to javascript specs. Any direction would be appreciated. Thank you.
The following coffee fails the preprocessor with
ERROR [preprocessor.coffee]: unexpected INDENT
This is just one of many valid coffee files that work with my Rails application but fail with the preprocessor.
App.factory 'Comments', ['$resource', ($resource) ->
$resource '/comments/:id',{id:'@id'}
update: { method: 'PUT' }
]
I'm having trouble getting Require.js to recognize the files loaded by the coffee-script preprocessor. Require.js implicitly adds a '.js' extension to all the referenced locations. It can't find the files loaded by the CS preprocessor because they are loaded into the browser with the '.coffee' extension.
The file contents are being compiled to js... is there any way we can change the extension to match so that everything will act consistently?
In version 1.6 CoffeeScript added support for source maps. It would be great to automatically set this up for people using the preprocessor.
I'm maintaining a project that is still relying on Karma 0.9 – many of its modules is still strictly relying on 0.9 or is at least not compatible with Karma 0.11 that this module now requires as of b099260.
While it of course isn't an issue in itself that a new version of this modules requires a newer version of Karma it is an issue that the latest version of Karma 0.9 doesn't specify any specific version of this module causing Karma 0.9 to depend on 0.2.0 of this module that in turns requires karma to be 0.11 (I guess it's due to https://github.com/karma-runner/karma/blob/8c38782c015f5d6e9d891771ff07f83423b22377/package.json#L107)
I'm not sure where the error is to be found here – if it is Karma 0.9 that should have specified its version better, if its this module that should have done something in another way or if its my project that should have specified some more elaborate dependencies. Anyhow – since it's the release of 0.2.0 that caused this I thought this would be a good place for a first report of it.
Below is the full error from npm when trying a fresh install of my project:
npm ERR! peerinvalid The package karma does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer [email protected] wants karma@~0.9.4 || ~0.10
npm ERR! peerinvalid Peer [email protected] wants karma@>=0.9
npm ERR! peerinvalid Peer [email protected] wants karma@~0.9
npm ERR! peerinvalid Peer [email protected] wants karma@~0.9
npm ERR! peerinvalid Peer [email protected] wants karma@>=0.9
npm ERR! peerinvalid Peer [email protected] wants karma@>=0.9.3
npm ERR! peerinvalid Peer [email protected] wants karma@>=0.9
npm ERR! peerinvalid Peer [email protected] wants karma@>=0.9
npm ERR! peerinvalid Peer [email protected] wants karma@>=0.9
npm ERR! peerinvalid Peer [email protected] wants karma@>=0.9
npm ERR! peerinvalid Peer [email protected] wants karma@>=0.9
npm ERR! peerinvalid Peer [email protected] wants karma@>=0.11.14
npm ERR! peerinvalid Peer [email protected] wants karma@>=0.9
It would be nice to get support for literate coffeescript. Currently, if there are literate comments in any of the code the preprocessor will treat them as code and throw compile errors.
The preprocessor also fails tests that are passed when the javascript is compiled already. I've tried to figure out why, and haven't been able to. I thought the best way to get your attention was to raise an issue.
running karma start karma.conf
from the CLI incorrectly states the line number/file:
TypeError: 'undefined' is not a function (evaluating 'escape(value)')
at http://localhost:9876/base/app/scripts/services/webstorage.js?1380664051000:36
at http://localhost:9876/base/test/spec/services/webstorage.js?1380664031000:23
at http://localhost:9876/base/test/spec/services/webstorage.js?1380664031000:99
PhantomJS 1.9.2 (Mac OS X): Executed 72 of 72 (1 FAILED) (0.343 secs / 0.254 secs)
Where it should show the line number from the coffee script file.
Is there something I should be doing to get the correct info or is this a bug?
I may be completely misunderstanding how things work. The sample config in the README shows transformPath as:
transformPath: function(path) {
return path.replace(/\.js$/, '.coffee');
}
However, it seems like the .js and .coffee are swapped. Using it this way I get a lot of Uncaught SyntaxErrors from Karma for each coffeescript file. If I switch it around (or just leave it out completely), then things just work. Should it be like this (or am I confused?):
transformPath: function(path) {
return path.replace(/\.coffee$/, '.js');
}
It would be nice to support CoffeeScript v2 but maybe this needs to be a separate preprocessor?
Hi,
Is there a reason why the loosened coffeescript dependency that was commited to in ed41be7 has not been packaged and released yet?
Cheers,
T.
Based on #4
I believe there are two options:
//# sourceMappingURL=/path/to/file.js.map
X-SourceMap: /path/to/file.js.map
I installed the plugin with the command ; npm install --save-dev karma-coffee-preprocessor
I then configured my test config file as follows:
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['jasmine'],
files: [
'../bower_components/angular/angular.js',
'../bower_components/angular-ui-router/release/angular-ui-router.js',
'../bower_components/angular-mocks/angular-mocks.js',
'../src/scripts/**/*.coffee',
'unit-tests/**/*.js'
],
exclude: [
],
preprocessors: {
'../src/scripts/**/*.coffee': ['coffee']
},
coffeePreprocessor: {
options: {
bare: true,
sourceMap: false
},
transformPath: function(path) {
return path.replace(/\.coffee$/, '.js')
}
},
reporters: ['progress'],
port: 9876,
colors: true,
logLevel: config.LOG_DEBUG,
autoWatch: true,
browsers: ['PhantomJS'],
singleRun: false,
concurrency: Infinity
})
}
But when I try to start my test I have this error :
Can not load "coffee", it is not registered!
Perhaps you are missing some plugin?
/opt/node/lib/node_modules/karma/node_modules/di/lib/injector.js:9
throw error('No provider for "' + name + '"!');
^
Error: No provider for "framework:jasmine"! (Resolving: framework:jasmine)
at error (/opt/node/lib/node_modules/karma/node_modules/di/lib/injector.js:22:12)
at Object.parent.get (/opt/node/lib/node_modules/karma/node_modules/di/lib/injector.js:9:13)
at get (/opt/node/lib/node_modules/karma/node_modules/di/lib/injector.js:54:19)
at /opt/node/lib/node_modules/karma/lib/server.js:138:20
at Array.forEach (native)
at Server._start (/opt/node/lib/node_modules/karma/lib/server.js:137:21)
at invoke (/opt/node/lib/node_modules/karma/node_modules/di/lib/injector.js:75:15)
at Server.start (/opt/node/lib/node_modules/karma/lib/server.js:102:18)
at Object.exports.run (/opt/node/lib/node_modules/karma/lib/cli.js:243:26)
at Object.<anonymous> (/opt/node/lib/node_modules/karma/bin/karma:3:23)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Function.Module.runMain (module.js:447:10)
at startup (node.js:146:18)
Can anyone help me ?
npm WARN package.json [email protected] No README data
I've been receiving this error since the 0.0.2 update, and can't roll back to the previous version.
The bare arg passed to the compiler should be configurable.
Hi, can anyone help me to setup karma to show error line numbers correctly for CoffeScript tests?
For the following test the report contains text test_spec.coffee:3:26
. I assume that 3 is the line number, which is not quite right. It should be 2, not 3.
describe 'test', ->
it 'fails', -> expect(false).toBe true
Test output:
Chrome 30.0.1599 (Mac OS X 10.8.4) test fails FAILED
Expected false to be true.
Error: Expected false to be true.
at null.<anonymous> (...test_spec.coffee:3:26)
My config:
preprocessors: {
'**/*.coffee': ['coffee']
},
coffeePreprocessor: {
options: {
bare: true,
sourceMap: true
},
transformPath: function(path) {
return path.replace(/\.js$/, '.coffee');
}
}
I am using:
[email protected]
[email protected]
[email protected]
Thank you
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.