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

πŸ—οΈ Add an eslint rule to prevent misuse of expect #13426

Merged
merged 3 commits into from Feb 13, 2018
Merged

πŸ—οΈ Add an eslint rule to prevent misuse of expect #13426

merged 3 commits into from Feb 13, 2018

Conversation

rsimha
Copy link
Contributor

@rsimha rsimha commented Feb 10, 2018

This PR adds a couple of .eslint rules to prevent the misuse of expect. The plugin used is https://www.npmjs.com/package/eslint-plugin-chai-expect

See #13422 for why this was necessary, and #13422 (comment) for context around the new lint rules being added by this PR

Follow up to #13424
Fixes #13422

@rsimha
Copy link
Contributor Author

rsimha commented Feb 10, 2018

@jeffkaufman We can merge this once you send out your PR with the fixes.

jeffkaufman added a commit to jeffkaufman/amphtml that referenced this pull request Feb 12, 2018
None of these were broken tests, just awkward uses of expect caught by the linter in ampproject#13426
@rsimha rsimha changed the title Add an eslint rule to prevent misuse of expect πŸ—οΈ Add an eslint rule to prevent misuse of expect Feb 13, 2018
rsimha pushed a commit that referenced this pull request Feb 13, 2018
* fix-tests: expect is not assert

With Chai, instead of expect(condition) you need to use
expect(variable).stuff.in.english or assert(condition).

In cases where the tests were silently failing I've used `iter.skip` for the
whole test, or commented out the check if only part of the test was being
skipped.  (I don't like commenting out code, but is there a better way to skip
just a small part of a test?)

Addresses #13422

* fix lint error

* Fix lint-level misuses of expect.

None of these were broken tests, just awkward uses of expect caught by the linter in #13426

* use ideomatic expect, not assert, for comparing strict equality

* two more fixes
@rsimha rsimha merged commit 70a338a into ampproject:master Feb 13, 2018
@rsimha rsimha deleted the 2018-02-10-Expect branch February 13, 2018 16:12
protonate pushed a commit to protonate/amphtml that referenced this pull request Feb 26, 2018
* fix-tests: expect is not assert

With Chai, instead of expect(condition) you need to use
expect(variable).stuff.in.english or assert(condition).

In cases where the tests were silently failing I've used `iter.skip` for the
whole test, or commented out the check if only part of the test was being
skipped.  (I don't like commenting out code, but is there a better way to skip
just a small part of a test?)

Addresses ampproject#13422

* fix lint error

* Fix lint-level misuses of expect.

None of these were broken tests, just awkward uses of expect caught by the linter in ampproject#13426

* use ideomatic expect, not assert, for comparing strict equality

* two more fixes
RanAbram pushed a commit to RanAbram/amphtml that referenced this pull request Mar 12, 2018
* fix-tests: expect is not assert

With Chai, instead of expect(condition) you need to use
expect(variable).stuff.in.english or assert(condition).

In cases where the tests were silently failing I've used `iter.skip` for the
whole test, or commented out the check if only part of the test was being
skipped.  (I don't like commenting out code, but is there a better way to skip
just a small part of a test?)

Addresses ampproject#13422

* fix lint error

* Fix lint-level misuses of expect.

None of these were broken tests, just awkward uses of expect caught by the linter in ampproject#13426

* use ideomatic expect, not assert, for comparing strict equality

* two more fixes
protonate pushed a commit to protonate/amphtml that referenced this pull request Mar 15, 2018
* fix-tests: expect is not assert

With Chai, instead of expect(condition) you need to use
expect(variable).stuff.in.english or assert(condition).

In cases where the tests were silently failing I've used `iter.skip` for the
whole test, or commented out the check if only part of the test was being
skipped.  (I don't like commenting out code, but is there a better way to skip
just a small part of a test?)

Addresses ampproject#13422

* fix lint error

* Fix lint-level misuses of expect.

None of these were broken tests, just awkward uses of expect caught by the linter in ampproject#13426

* use ideomatic expect, not assert, for comparing strict equality

* two more fixes
thekorn pushed a commit to edelight/amphtml that referenced this pull request Sep 11, 2019
None of these were broken tests, just awkward uses of expect caught by the linter in ampproject#13426
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants