-
Notifications
You must be signed in to change notification settings - Fork 26k
/
index.test.ts
45 lines (39 loc) · 1.19 KB
/
index.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
45
import path from 'path'
import { createNext, FileRef } from 'e2e-utils'
import { renderViaHTTP } from 'next-test-utils'
import { NextInstance } from 'test/lib/next-modes/base'
describe('TypeScript basic', () => {
let next: NextInstance
beforeAll(async () => {
next = await createNext({
files: new FileRef(path.join(__dirname, 'app')),
dependencies: {
'@next/bundle-analyzer': 'canary',
typescript: 'latest',
'@types/node': 'latest',
'@types/react': 'latest',
'@types/react-dom': 'latest',
},
})
})
afterAll(() => next.destroy())
it('should not have eslint setup started', async () => {
expect(next.cliOutput).not.toContain(
'How would you like to configure ESLint'
)
})
it('have built and started correctly', async () => {
const html = await renderViaHTTP(next.url, '/')
expect(html).toContain('hello world')
})
it('should work with babel', async () => {
await next.stop()
await next.patchFile(
'.babelrc',
JSON.stringify({ presets: ['next/babel'] })
)
await next.start()
const html = await renderViaHTTP(next.url, '/')
expect(html).toContain('hello world')
})
})