Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Messages and Red Lights Displayed in IntelliJ IDEA Editor although test was fixed #570

Closed
pahund opened this issue Apr 28, 2016 · 12 comments
Labels

Comments

@pahund
Copy link

pahund commented Apr 28, 2016

Issue description or question

When I'm working on a test and doing some refactoring, the refactoring in progress results in a compile error. Wallaby displays this error next to the code that I'm working on and shows a red light at the beginning of the line. So far so good, that is expected.

However, when the refactoring is finished and the code compiles again, the error message in the editor stays and the line continues to be marked red, while Wallaby tool window correctly reports “no failing tests”.

I have to restart my Wallaby.js run configuration to get a green light on the refactored code line.

I made a video to demonstrate the bug: https://youtu.be/0woztRC_Kl0

Wallaby.js configuration file

module.exports = wallaby => ({
    files: [
        "frontend/app/**/*.js",
        "frontend/app/**/*.scss",
        "frontend/test/testdata.json",
        "frontend/test/testUtils.js"
    ],

    tests: [
        "frontend/test/**/*Test.js"
    ],

    env: {
        type: "node",
        runner: "/usr/local/bin/node"
    },

    testFramework: "mocha",

    compilers: {
        "**/*.js": wallaby.compilers.babel()
    },

    bootstrap: () => {
        const path = require("path");
        const setupPath = path.join(wallaby.localProjectDir, "frontend/test/setup");
        require(setupPath);
    }
});

Code editor or IDE name and version

IntelliJ IDEA Ultimate 2016.1.1

OS name and version

OS X El Capitan 10.11.4

@ArtemGovorov
Copy link
Member

Thanks for the detailed description and the video!
We have had a similar issue reported internally some time ago and IIRC it was related to an issue in Babel with generating correct source maps. What Babel version are you using?

@ArtemGovorov
Copy link
Member

Quick note, as a faster workaround for glitches like this one, you may hit Alt + Enter and choose Run file tests instead of restarting wallaby.js.

@ArtemGovorov
Copy link
Member

Could you please also share your .babelrc file?

@ArtemGovorov
Copy link
Member

ArtemGovorov commented Apr 28, 2016

Another workaround for the issue is to use a block statement:

it('has a child <h3> element', () => {
  childOf...
});

instead of the arrow function expression:

it('has a child <h3> element', () => 
  childOf...
);

@pahund
Copy link
Author

pahund commented Apr 28, 2016

Hi @ArtemGovorov, thanks for the quick reply!
I'm using Babel 6.7.5, my .babelrc looks like this:

{
  "presets": ["es2015", "react"]
}

@pahund
Copy link
Author

pahund commented Apr 28, 2016

In my webpack config, I use devtool "#source-map", but webpack is not involved in my test setup. I'm assuming the source maps come from some config inside Wallaby?

@ArtemGovorov
Copy link
Member

ArtemGovorov commented Apr 28, 2016

Babel generates source maps when compiling your files, wallaby just uses those maps to map error stacks from the actually executed compiled code back to your original code. There was an issue with babel generated source maps that was causing a similar issue.

@pahund
Copy link
Author

pahund commented Apr 28, 2016

So could I work around by configuring wallaby to use a different type of source map, e.g. inline? How would I do that?

@ArtemGovorov
Copy link
Member

No, the source map type doesn't matter. There's no workaround that can be done with some configuration. You may use this workaround for now.

@pahund
Copy link
Author

pahund commented Apr 29, 2016

OK, thanks

@ArtemGovorov
Copy link
Member

ArtemGovorov commented May 2, 2016

After a careful investigation, it turned out to be an issue in wallaby.js, not in babel generated source maps (even though it is related to the way babel generates source maps for arrow functions with no body).

The issue is fixed in wallaby core v1.0.223 (you may restart your IDE and start wallaby to force the update). Thanks again for the detailed description and the issue video, it was very helpful in finding out the reason and fixing it.

@pahund
Copy link
Author

pahund commented May 2, 2016

Thanks for acting so quickly! Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants