Mocha reporter for WebStorm and other IntelliJ IDEs (IntelliJ IDEA, PhpStorm, RubyMine, PyCharm, etc).
No need to install it manually, it's bundled with NodeJS plugin.
License: Apache License 2.0
On a failed assertion, the error message doesn't provide a very detailed dump of the relevant data structures. Here's an example —
AssertionError: expected { Object (block, subBlocks, ...) }
to deeply equal { block: 'commentBlk', subBlocks: [] }
It would be great to see more properties + values dumped than just the highly truncated { Object (block, subBlocks, ...) }
representation.
If I'm not mistaken, the Jetbrains "Jest" integration even provides an actual diff which would be ideal.
My Node.js Mocha tests get occasionally terminated (and not even started) with the following error output on the console:
/usr/local/bin/node /path/to/project/node_modules/mocha/bin/_mocha /path/to/additional/testfile --ui bdd --reporter "/Users/myuser/Library/Application Support/IntelliJIdea15/NodeJS/js/mocha-intellij/lib/mochaIntellijReporter.js" --recursive /path/to/project/test
[ '"postgres://configForDatabase"' ]
Error: EAGAIN: resource temporarily unavailable, write
at Error (native)
at Object.fs.writeSync (fs.js:658:20)
at Object.writeSync (/Users/myuser/Library/Application Support/IntelliJIdea15/NodeJS/js/mocha-intellij/lib/mochaIntellijUtil.js:129:15)
at /Users/myuser/Library/Application Support/IntelliJIdea15/NodeJS/js/mocha-intellij/lib/mochaIntellijReporter.js:272:14
at Tree.writeln (/Users/myuser/Library/Application Support/IntelliJIdea15/NodeJS/js/mocha-intellij/lib/mochaIntellijTree.js:21:5)
at TestNode.Node.register (/Users/myuser/Library/Application Support/IntelliJIdea15/NodeJS/js/mocha-intellij/lib/mochaIntellijTree.js:109:13)
at registerTestNode (/Users/myuser/Library/Application Support/IntelliJIdea15/NodeJS/js/mocha-intellij/lib/mochaIntellijReporter.js:114:12)
at /Users/myuser/Library/Application Support/IntelliJIdea15/NodeJS/js/mocha-intellij/lib/mochaIntellijReporter.js:289:9
at Array.forEach (native)
at /Users/myuser/Library/Application Support/IntelliJIdea15/NodeJS/js/mocha-intellij/lib/mochaIntellijReporter.js:288:13
at executeSafely (/Users/myuser/Library/Application Support/IntelliJIdea15/NodeJS/js/mocha-intellij/lib/mochaIntellijUtil.js:114:5)
at Runner.<anonymous> (/Users/myuser/Library/Application Support/IntelliJIdea15/NodeJS/js/mocha-intellij/lib/mochaIntellijReporter.js:270:5)
at emitNone (events.js:72:20)
at Runner.emit (events.js:166:7)
at start (/path/to/project/node_modules/mocha/lib/runner.js:732:10)
at Runner.run (/path/to/project/node_modules/mocha/lib/runner.js:757:5)
at Mocha.run (/path/to/project/node_modules/mocha/lib/mocha.js:486:17)
at Object.<anonymous> (/path/to/project/node_modules/mocha/bin/_mocha:393:18)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Function.Module.runMain (module.js:467:10)
at startup (node.js:136:18)
at node.js:963:3
It happens reproducible when larger files are open (e.g. JavaScript file with more than 500 lines). When I close all open files, the tests mostly succeed. So it seems to be a performance issue…?
My configuration: OS X 10.11.2 on rather powerful a MacBook Pro; IntelliJ IDEA 15.0.2; Node.js 4.2.3; Mocha 2.3.3.; and I use ESLint as Code Quality Tool. It is a node.js project with about 1200 Test Cases, split above various files.
Hooks can have a user-defined title
which is always appended to the default. In the case of "before all" hooks, the default is '"before all" hook
. Given the reporter's logic, it may fail to recognize a "before all" hook with a custom title.
"Before each" hooks do not seem to have this problem, and are determined differently. Haven't looked at the "after" hooks implementation.
Not sure where these should live, but they may be useful to include in the Node.js plugin somehow.
Please let me know if you feel like doing anything with them.
I don't see a way to do a --watch so it will automatically run tests when the files are saved. Is this currently possible?
The mocha intellij plugin will not correctly show describe statements for skipped tests.
For example:
const assert = require('assert');
describe.only('Mocha issues with skipped tests', function() {
describe('Skip one, not the other', function() {
it.skip('Skip', function() {
//this.skip();
});
it('Do not skip', function() {
assert.equal(true, true);
});
})
});
Generates the following output in mocha:
> mocha
Mocha issues with skipped tests
Skip one, not the other
- Skip
✓ Do not skip
1 passing (6ms)
1 pending
However the UI does not show the Skip test.
See the following image:
I would expect to see the skipped tests as well. This can be problematic when tests are dynamically generated. For example:
const assert = require('assert');
describe('Mocha issues with generated tests', function () {
let tests = ['one', 'two'];
// generate tests
tests.forEach(function (test) {
describe(`Test for -> ${test}`, function () {
it(`it() statement on ${test}`, function () {
if (test === 'two') {
this.skip();
}
assert.equal(true, true);
});
});
});
});
The seconds describe (Test for -> two) will not even show as a node.
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.