Skip to content

Commit 5cea9cd

Browse files
committed
Don't add Redbox matchers in Edge Runtime unit tests
1 parent 46af7aa commit 5cea9cd

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

test/jest-setup-after-env.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// @ts-ignore
22
import * as matchers from 'jest-extended'
33
import '@testing-library/jest-dom'
4-
import './lib/add-redbox-matchers'
54
expect.extend(matchers)
65

76
// A default max-timeout of 90 seconds is allowed

test/lib/add-redbox-matchers.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ interface RedboxSnapshot {
5656
count: number
5757
}
5858

59-
async function createRedboxSnaspshot(
59+
async function createRedboxSnapshot(
6060
browser: BrowserInterface
6161
): Promise<RedboxSnapshot> {
6262
const [label, environmentLabel, description, source, stack, count] =
@@ -152,7 +152,7 @@ expect.extend({
152152
}
153153
}
154154

155-
const redbox = await createRedboxSnaspshot(browser)
155+
const redbox = await createRedboxSnapshot(browser)
156156

157157
// argument length is relevant.
158158
// Jest will update absent snapshots but fail if you specify a snapshot even if undefined.
@@ -198,7 +198,7 @@ expect.extend({
198198
}
199199
}
200200

201-
const redbox = await createRedboxSnaspshot(browser)
201+
const redbox = await createRedboxSnapshot(browser)
202202

203203
// argument length is relevant.
204204
// Jest will update absent snapshots but fail if you specify a snapshot even if undefined.

test/lib/next-test-utils.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ import { Playwright } from './browsers/playwright'
3131

3232
import { getTurbopackFlag, shouldRunTurboDevTest } from './turbo'
3333
import stripAnsi from 'strip-ansi'
34+
// TODO: Create dedicated Jest environment that sets up these matchers
35+
// Edge Runtime unit tests fail with "EvalError: Code generation from strings disallowed for this context" if these matchers are imported in those tests.
36+
import './add-redbox-matchers'
3437

3538
export { shouldRunTurboDevTest }
3639

0 commit comments

Comments
 (0)