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

Update tests to be more resilient against assert message changes in Node core #10111

Closed
not-an-aardvark opened this issue Mar 21, 2018 · 0 comments · Fixed by #10182
Closed
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion chore This change is not user-facing good first issue Good for people who haven't worked on ESLint before

Comments

@not-an-aardvark
Copy link
Member

Our tests for RuleTester currently make assertions about the error messages that RuleTester outputs. These tests have been broken a few times in the past due to changes in the error messages created by Node's assert module (e.g. #9688, nodejs/node#19467 (comment)). Having the tests break is generally inconvenient (among other things, Node runs the eslint tests as part of citgm in order to detect regressions), so we should try to make these tests more robust.

One way to do it would be to dynamically generate an expected error message as part of the test. For example, we could replace the code here:

assert.throws(() => {
    ruleTester.run(/* ... */)
}, /Bad var\.((.*==)|(.*strictEqual)).*Bad error message/);

...with something like this:

const nodeAssert = require("assert");

assert.throws(() => {
    ruleTester.run(/* ... */)
}, new nodeAssert.AssertionError({ actual: "Bad var.", expected: "Bad error message", operator: "===" }).message);
@not-an-aardvark not-an-aardvark added accepted There is consensus among the team that this change meets the criteria for inclusion chore This change is not user-facing labels Mar 21, 2018
@platinumazure platinumazure added the good first issue Good for people who haven't worked on ESLint before label Mar 27, 2018
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Oct 26, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Oct 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion chore This change is not user-facing good first issue Good for people who haven't worked on ESLint before
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants