forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReactRefreshModule.test.ts
More file actions
40 lines (35 loc) · 1.03 KB
/
ReactRefreshModule.test.ts
File metadata and controls
40 lines (35 loc) · 1.03 KB
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
import { FileRef, nextTestSetup } from 'e2e-utils'
import { sandbox } from 'development-sandbox'
import path from 'path'
describe('ReactRefreshModule', () => {
const { next } = nextTestSetup({
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
skipStart: true,
})
it('should allow any variable names', async () => {
const { session, cleanup } = await sandbox(next)
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'
console.log({ ${variable} })
export default function Page() {
return null
}`
)
expect(await session.hasRedbox()).toBe(false)
expect(next.cliOutput).not.toContain(
`'${variable}' has already been declared`
)
}
await cleanup()
})
})