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

Use test plan for compartment tests #316

Merged
merged 2 commits into from May 18, 2020
Merged

Conversation

kriskowal
Copy link
Member

This brings the compartment tests in conformance with the style @Chris-Hibbert and I discussed to best signal test completion and ensure that all planned assertions have an opportunity to fail the test. Using async tests precludes the need for calling end explicitly (it is implied by the resolution of the returned promise), but plan is necessary to ensure a test that goes off the rails fails.

@kriskowal kriskowal force-pushed the kris/plan-compartment-tests branch from c85b132 to 718a7c2 Compare May 15, 2020 23:07
@kriskowal kriskowal marked this pull request as ready for review May 15, 2020 23:07
@Chris-Hibbert
Copy link
Contributor

I don't completely get this. What has to be true of an async test so that we can be sure that the test didn't go sideways somewhere? i.e. How did you decide which tests needed t.plan() and which ones were safe?

@kriskowal
Copy link
Member Author

@Chris-Hibbert All tests should have plan. I’ve not yet improved all of the tests, but it sounds from your tenor like I missed a few. I can look into that. That is to say, these tests may use async to signal end, but they must all call plan first to ensure that any assertion that gets called after end or not at all (“go off the rails”) causes the test to fail.

@@ -7,7 +7,7 @@ import { resolveNode, makeNodeImporter } from './node.js';

const { test } = tap;

test('import for side effect', async t => {
test('import for side effect', async _t => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the tests in this file (from which t.end() were removed) are missing t.plan(). From the description at the top level, They should either retain t.end() (i.e. revert the file), or have t.plan() added.

Comment on lines +4 to +5
/* eslint max-lines: 0 */

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests in this file look good.

@kriskowal
Copy link
Member Author

Thanks! Sorry for the noise. I’ve gone through the import tests and gotten them all to follow the rule.

Copy link
Contributor

@erights erights left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@erights
Copy link
Contributor

erights commented May 17, 2020

But please wait for @Chris-Hibbert 's approval. He knows the testing issues better than I.

Copy link
Contributor

@Chris-Hibbert Chris-Hibbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. Thanks.

@kriskowal kriskowal merged commit 08baeeb into master May 18, 2020
@kriskowal kriskowal deleted the kris/plan-compartment-tests branch May 18, 2020 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants