Skip to content

Commit

Permalink
Bump kcd-scripts to 11.x
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Jun 8, 2021
1 parent b6a7c70 commit d1c9869
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -50,7 +50,7 @@
"@testing-library/jest-dom": "^5.11.6",
"@types/react-dom": "^17.0.0",
"dotenv-cli": "^4.0.0",
"kcd-scripts": "^10.1.1",
"kcd-scripts": "^11.1.0",
"npm-run-all": "^4.1.5",
"react": "^17.0.1",
"react-dom": "^17.0.1",
Expand Down
10 changes: 5 additions & 5 deletions src/__tests__/cleanup.js
Expand Up @@ -54,14 +54,14 @@ describe('fake timers and missing act warnings', () => {
jest.useRealTimers()
})

test('cleanup does not flush immediates', () => {
test('cleanup does not flush microtasks', () => {
const microTaskSpy = jest.fn()
function Test() {
const counter = 1
const [, setDeferredCounter] = React.useState(null)
React.useEffect(() => {
let cancelled = false
setImmediate(() => {
Promise.resolve().then(() => {
microTaskSpy()
// eslint-disable-next-line jest/no-if -- false positive
if (!cancelled) {
Expand Down Expand Up @@ -93,12 +93,12 @@ describe('fake timers and missing act warnings', () => {
const [, setDeferredCounter] = React.useState(null)
React.useEffect(() => {
let cancelled = false
setImmediate(() => {
setTimeout(() => {
deferredStateUpdateSpy()
if (!cancelled) {
setDeferredCounter(counter)
}
})
}, 0)

return () => {
cancelled = true
Expand All @@ -109,7 +109,7 @@ describe('fake timers and missing act warnings', () => {
}
render(<Test />)

jest.runAllImmediates()
jest.runAllTimers()
cleanup()

expect(deferredStateUpdateSpy).toHaveBeenCalledTimes(1)
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/no-act.js
Expand Up @@ -2,7 +2,7 @@ let act, asyncAct

beforeEach(() => {
jest.resetModules()
act = require('..').act
act = require('../pure').act
asyncAct = require('../act-compat').asyncAct
jest.spyOn(console, 'error').mockImplementation(() => {})
})
Expand Down

0 comments on commit d1c9869

Please sign in to comment.