Comments (9)
Hello! I believe the issue is in the grunt task itself upon further inspection..
from grunt-simple-mocha.
Hmm, I can't replicate this, and I'm inclined to think it's a bug with the Mocha API interface.
But I'll take a closer look when I get a chance. I'd love to build on the Mocha API interface when I get some time..
from grunt-simple-mocha.
Yea.. I didn't run into this error until I started adding in Webdriver tests via GhostDriver on phantomJS, so maybe there needs to be something additional added, I'll also be looking and see if I can get a solution. As it would be great to not have to use a hacked together solution with alerts and AJAX bridges etc to get front-end testing now that we have a proper selenium driver for PhantomJS.
Thanks for any effort you put in 👍
Hopefully the magic 🎱 will help me in my quest :)
from grunt-simple-mocha.
Thanks for the issue! Are you already aware of the wildly popular grunt-mocha? It's designed for tests using PhantomJS, and there seems to be a lot of code dedicated to printing the results correctly.
I mainly didn't like its dependency on PhantomJS, but you're already using PhantomJS so maybe that won't be an issue for you.. :)
from grunt-simple-mocha.
The only reason I haven't hopped over to grunt-mocha is that the project was to support testing on PhantomJS before it was supported. Now, PhantomJS provides a native WebDriver called GhostDriver. So the way that grunt-mocha communicates is neat, but unneeded now. I haven't looked deeply at the source for it but I know older similar types of libraries used iframe + alerts to provide communication, I'd rather be able to use the JSONWireProtocol. I may just use grunt exec or shell and run mocha directly to get the results.. Hm.
from grunt-simple-mocha.
This is a pretty gnarly issue and has been bugging me for a while... Mocha needs uncaughtException
s to be ignored when running under node, and grunt really doesn't like that (it exits grunt.fail.fatal
hard on any of them: https://github.com/gruntjs/grunt/blob/master/lib/grunt.js#L58-60). Ben didn't want to modify that handler (gruntjs/grunt#592), so... https://github.com/gregrperkins/grunt-mocha-hack was my attempt, but it's really rather disgusting. Hopefully the domain solution will be less disgusting in the near future, once uncaughtException
s don't propagate up (per nodejs/node-v0.x-archive#4375). I didn't want to use grunt-mocha since I expect node.js file interfaces and such in a lot of tests and code under test, and my impression is that those aren't replicated in phantom.
from grunt-simple-mocha.
#29 if you think this is worth it
from grunt-simple-mocha.
So it looks like 3 out of 3 serverside grunt + mocha modules on npm have this issue. Maybe you guy's should team up? :)
from grunt-simple-mocha.
👍 this appears to be an issue with how Mocha#run
works. AFAIK it's exiting as soon as the first error is encountered.
Here's my own custom grunt task that also demonstrates this:
Mocha = require('mocha')
module.exports = (grunt) ->
_ = grunt.util._
grunt.registerMultiTask "spec", "run specs (under mocha)", ->
done = @async()
mocha = new Mocha(@options())
@filesSrc.forEach(mocha.addFile.bind(mocha))
grunt.file.expand("#{process.cwd()}/spec/helpers/**/*").forEach (f) -> require(f)
mocha.run (errorCount) -> done(errorCount == 0)
from grunt-simple-mocha.
Related Issues (20)
- Running from a grunt-regarde task only runs tests on first pass HOT 1
- Should not hide exceptions HOT 7
- var paths = this.filesSrc.map(path.resolve) show the test src path HOT 6
- Simplemocha broke on Grunt 0.4 HOT 4
- Taks cannot be proceeded after upgrading Node to v0.10.x HOT 3
- Feature request: specify destination for results HOT 2
- Setting working directory HOT 1
- Should pass `--grep` from command line
- Using Assertion Libs HOT 1
- Calling path.resolve from tests with "./" relative notation resolves it starting from project's root HOT 1
- Add coffeescript example
- Reporters HOT 4
- The clause(grep: "*-test") in the example Gruntfile.js is likely to misguide users. HOT 1
- The `grep` option may cause confusion HOT 5
- Update readme and usage description on npmjs.com HOT 1
- reporter spec won't print stack trace when using simplemocha HOT 1
- How to run mocha in verbose mode? HOT 2
- Expose a way to emulate `-r` option
- Not able to set reporter options when using MochaAwesome as the reporter
- Please update npm dependency: mocha
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grunt-simple-mocha.