Comments (3)
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.
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.
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)
- Mocha fails after second run HOT 1
- Mocha tests with Babel 6 problems HOT 4
- How to use report options HOT 3
- gmt returns 0 on error HOT 1
- Node 5 issue HOT 2
- Unable to see mocha logs in console HOT 2
- Allow to run a single test file HOT 6
- Always return zero exit code if force: true is in options HOT 2
- it.only and describe.only don't work with mocha 3 (they work when running mocha directly, not via grunt-mocha) HOT 4
- Error - Cannot find module 'coverage/blanket' HOT 6
- Mocha exploded when generating coverage reports HOT 6
- Use CaptureFile to append to file instead of truncate?
- Console.log errors and stack traces when they occur (e.g. as a console.log in afterEach) rather than after all tests complete HOT 2
- Running multiple configurations in one command causes tests not to run HOT 3
- Compilers option is not working HOT 3
- Mocha exploded after grunt update HOT 5
- Freezes on mocha 6 HOT 2
- Cannot read property 'toString' of undefined with mocha 6.x upgrade HOT 3
- option to pass config file HOT 1
- 'mocha-junit-reporter' renderOption mochaFile path issue HOT 4
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-mocha-test.