Git Product home page Git Product logo

Comments (9)

itsjamie avatar itsjamie commented on August 28, 2024

Hello! I believe the issue is in the grunt task itself upon further inspection..

Example

from grunt-simple-mocha.

yaymukund avatar yaymukund commented on August 28, 2024

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.

itsjamie avatar itsjamie commented on August 28, 2024

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.

yaymukund avatar yaymukund commented on August 28, 2024

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.

itsjamie avatar itsjamie commented on August 28, 2024

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.

gregrperkins avatar gregrperkins commented on August 28, 2024

This is a pretty gnarly issue and has been bugging me for a while... Mocha needs uncaughtExceptions 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 uncaughtExceptions 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.

gregrperkins avatar gregrperkins commented on August 28, 2024

#29 if you think this is worth it

from grunt-simple-mocha.

Bartvds avatar Bartvds commented on August 28, 2024

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.

searls avatar searls commented on August 28, 2024

👍 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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.