Skip to content

Commit 8275261

Browse files
committed
Remove console-testing-library as it is no longer needed
1 parent 8aec268 commit 8275261

File tree

6 files changed

+56
-1156
lines changed

6 files changed

+56
-1156
lines changed

.yarn/patches/console-testing-library-npm-0.6.1-4d9957d402.patch

Lines changed: 0 additions & 68 deletions
This file was deleted.

.yarn/patches/console-testing-library__npm_0.3.1.patch

Lines changed: 0 additions & 26 deletions
This file was deleted.

packages/toolkit/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@
7171
"@typescript-eslint/eslint-plugin": "^6",
7272
"@typescript-eslint/parser": "^6",
7373
"axios": "^0.19.2",
74-
"console-testing-library": "patch:console-testing-library@npm%3A0.6.1#~/.yarn/patches/console-testing-library-npm-0.6.1-4d9957d402.patch",
7574
"esbuild": "^0.23.0",
7675
"esbuild-extra": "^0.4.0",
7776
"eslint": "^7.25.0",

packages/toolkit/src/tests/utils/CustomMatchers.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { Assertion, AsymmetricMatchersContaining } from 'vitest'
22

33
interface CustomMatchers<R = unknown> {
4-
toHaveConsoleOutput(expectedOutput: string): Promise<R>
54
toMatchSequence(...matchers: Array<(arg: any) => boolean>): R
65
}
76

packages/toolkit/src/tests/utils/helpers.tsx

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ import { useCallback, useEffect, useRef } from 'react'
1212
import { Provider } from 'react-redux'
1313

1414
import { act, cleanup } from '@testing-library/react'
15-
import {
16-
createConsole,
17-
getLog,
18-
mockConsole,
19-
} from 'console-testing-library/pure'
2015

2116
export const ANY = 0 as any
2217

@@ -124,54 +119,6 @@ ${actions.map((a) => a.type).join('\n')}`,
124119
},
125120
})
126121

127-
declare global {
128-
namespace jest {
129-
interface Matchers<R> {
130-
toHaveConsoleOutput(expectedOutput: string): Promise<R>
131-
}
132-
}
133-
}
134-
135-
function normalize(str: string) {
136-
return str
137-
.normalize()
138-
.replace(/\s*\r?\n\r?\s*/g, '')
139-
.trim()
140-
}
141-
142-
expect.extend({
143-
async toHaveConsoleOutput(
144-
fn: () => void | Promise<void>,
145-
expectedOutput: string,
146-
) {
147-
const restore = mockConsole(createConsole())
148-
await fn()
149-
const { log } = getLog()
150-
restore()
151-
152-
if (normalize(log) === normalize(expectedOutput))
153-
return {
154-
message: () => `Console output matches
155-
===
156-
${expectedOutput}
157-
===`,
158-
pass: true,
159-
}
160-
else
161-
return {
162-
message: () => `Console output
163-
===
164-
${log}
165-
===
166-
does not match
167-
===
168-
${expectedOutput}
169-
===`,
170-
pass: false,
171-
}
172-
},
173-
})
174-
175122
export const actionsReducer = {
176123
actions: (state: UnknownAction[] = [], action: UnknownAction) => {
177124
// As of 2.0-beta.4, we are going to ignore all `subscriptionsUpdated` actions in tests

0 commit comments

Comments
 (0)