-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(prefer-explicit-assert): add 'assertion' config option (#220) Closes #218 * docs: add skovy as a contributor (#221) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> * feat: new no-wait-for-snapshot rule (#223) Closes: #214 * docs: add Gpx as a contributor [skip ci] (#224) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> * docs(no-wait-for-snapshot): fix link to rule doc (#225) * docs: add jdanil as a contributor [skip ci] (#226) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> * Update .travis.yml * feat: support ESLint 7.x (#139) Closes #138 * docs: add MichaelDeBoey as a contributor [skip ci] (#231) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> * chore: update dependencies + run prettier on codebase (#232) * chore: update dependencies * chore: run Prettier on full codebase Co-authored-by: Spencer Miskoviak <5247455+skovy@users.noreply.github.com> Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> Co-authored-by: Giorgio Polvara <polvara@gmail.com> Co-authored-by: Josh David <joshua.david@uqconnect.edu.au> Co-authored-by: Mario Beltrán Alarcón <belco90@gmail.com>
- Loading branch information
1 parent
44de9fc
commit 4b7300e
Showing
29 changed files
with
617 additions
and
15,086 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
module.exports = { extends: ['@commitlint/config-conventional'] }; | ||
module.exports = { | ||
extends: ['@commitlint/config-conventional'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Ensures no snapshot is generated inside of a `wait` call' (no-wait-for-snapshot) | ||
|
||
Ensure that no calls to `toMatchSnapshot` or `toMatchInlineSnapshot` are made from within a `waitFor` method (or any of the other async utility methods). | ||
|
||
## Rule Details | ||
|
||
The `waitFor()` method runs in a timer loop. So it'll retry every n amount of time. | ||
If a snapshot is generated inside the wait condition, jest will generate one snapshot per loop. | ||
|
||
The problem then is the amount of loop ran until the condition is met will vary between different computers (or CI machines). This leads to tests that will regenerate a lot of snapshots until the condition is matched when devs run those tests locally updating the snapshots; e.g devs cannot run `jest -u` locally or it'll generate a lot of invalid snapshots who'll fail during CI. | ||
|
||
Note that this lint rule prevents from generating a snapshot from within any of the [async utility methods](https://testing-library.com/docs/dom-testing-library/api-async). | ||
|
||
Examples of **incorrect** code for this rule: | ||
|
||
```js | ||
const foo = async () => { | ||
// ... | ||
await waitFor(() => expect(container).toMatchSnapshot()); | ||
// ... | ||
}; | ||
|
||
const bar = async () => { | ||
// ... | ||
await waitFor(() => expect(container).toMatchInlineSnapshot()); | ||
// ... | ||
}; | ||
|
||
const baz = async () => { | ||
// ... | ||
await wait(() => { | ||
expect(container).toMatchSnapshot(); | ||
}); | ||
// ... | ||
}; | ||
``` | ||
|
||
Examples of **correct** code for this rule: | ||
|
||
```js | ||
const foo = () => { | ||
// ... | ||
expect(container).toMatchSnapshot(); | ||
// ... | ||
}; | ||
|
||
const bar = () => { | ||
// ... | ||
expect(container).toMatchInlineSnapshot(); | ||
// ... | ||
}; | ||
``` | ||
|
||
## Further Reading | ||
|
||
- [Async Utilities](https://testing-library.com/docs/dom-testing-library/api-async) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.