Giter Site home page Giter Site logo

mocha-intellij's Introduction

official JetBrains project

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.

mocha-intellij's People

Contributors

losnikitos avatar mortonfox avatar segrey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mocha-intellij's Issues

Possible to get more complete dump (or diff) on failed assertions?

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.

Tests occasionally terminated when large files are open

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.

Theoretical bug in "before all" hook detection

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.

live templates for Mocha

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.

Plugin does not correctly show describe statement for skipped dynamically generated tests

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:

screenshot from 2016-11-21 16-10-13

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.

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.