forked from vercel/next.js
/
ReactRefreshModule.test.ts
44 lines (38 loc) · 1.04 KB
/
ReactRefreshModule.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { createNext } from 'e2e-utils'
import { NextInstance } from 'test/lib/next-modes/base'
import { sandbox } from './helpers'
describe('ReactRefreshModule', () => {
let next: NextInstance
beforeAll(async () => {
next = await createNext({
files: {},
skipStart: true,
})
})
afterAll(() => next.destroy())
it('should allow any variable names', async () => {
const { session, cleanup } = await sandbox(next, new Map([]))
expect(await session.hasRedbox()).toBe(false)
const variables = [
'_a',
'_b',
'currentExports',
'prevExports',
'isNoLongerABoundary',
]
for await (const variable of variables) {
await session.patch(
'pages/index.js',
`import { default as ${variable} } from 'next/link'
export default function Page() {
return null
}`
)
expect(await session.hasRedbox()).toBe(false)
expect(next.cliOutput).not.toContain(
`'${variable}' has already been declared`
)
}
await cleanup()
})
})