Skip to content

Update missing should type check calls - #3672

Merged
sokra merged 1 commit into
webpack:masterfrom
alistairjcbrown:update-noncalling-typechecks
Jan 2, 2017
Merged

sokra merged 1 commit into
webpack:masterfrom
alistairjcbrown:update-noncalling-typechecks

Conversation

@alistairjcbrown

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Test bugfix

Did you add tests for your changes?

This PR is only tests

If relevant, link to documentation update:

N/A

Summary

should type checks need to be called to error if the type check fails. Without calling, the test essentially has an empty body and will pass regardless.

Change made using find/replace in sublime

  • Find: (\.be\.[^(;]+);
  • Replace: \1();

Does this PR introduce a breaking change?

No

Other information

None

// Arbitrary assertion; can't use .ok() as it could be 0,
// can't use typeof as that depends on webpack config.
require.resolve(`./sync/${name}Test`).should.not.be.undefined;
require.resolve(`./sync/${name}Test`).should.not.be.undefined();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

One thing I just noticed -- you can't access .should on undefined, it's TypeError!

You're supposed to use expect(value).to.not.be.undefined(), but the test runner doesn't expose expect

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah that's true.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@Kovensky null also - the should documentation uses should(null).not.be.ok(); (rather than expect), which is what I've used for the compareLocations tests for undefined in #3670

@sokra
sokra merged commit 849385a into webpack:master Jan 2, 2017
@sokra

sokra commented Jan 2, 2017

Copy link
Copy Markdown
Member

Thanks

@alistairjcbrown
alistairjcbrown deleted the update-noncalling-typechecks branch January 2, 2017 12:12
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.

4 participants