GithubHelp home page GithubHelp logo

Comments (3)

pghalliday avatar pghalliday commented on July 2, 2024

I have found in the past that calling mocha programatically is not the same as calling it from the command line and the same arguments are not necessarily supported (we had a similar issue with --require which I managed to simulate).

I believe in this case you can specify the ui option as a field in mochaTestConfig as follows:

grunt.initConfig({
    mochaTest: {
      files: ['test/**/*.js']
    },
    mochaTestConfig: {
      options: {
        ui: 'tdd'        
      }
    }
  });

As it may not be possible to support all command line arguments (or even simulate them as I did with --require) I don't think I want to open the can of worms that might come with trying to support the mocha.opts file.

To get a fuller idea of what is supported in the mochaTestConfig options you might take a look at this:

https://github.com/visionmedia/mocha/wiki/Using-mocha-programmatically

from grunt-mocha-test.

goloroden avatar goloroden commented on July 2, 2024

First of all: Thanks a lot for replying that fast :-)!

I understand the issue you have, and your suggestion of using

ui: 'tdd'

works perfectly. The downside is that if you also want to be able to run mocha from the command line, you need the additional mocha.opts file with the very same options inside.

But anyway, it works.

Thanks for your help :-)!

from grunt-mocha-test.

pghalliday avatar pghalliday commented on July 2, 2024

Your welcome.

Yeah, I can see the problem. I'm tempted to raise an issue against Mocha - it seems to me that attempting to fix that here would be very fragile if mocha ever changed its options (I think this is already a problem with the way I dealt with --require)

from grunt-mocha-test.

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.