MCPcopy
hub / github.com/vercel/next.js / runTests

Function runTests

test/integration/nullish-config/test/index.test.ts:11–55  ·  view source on GitHub ↗
(type)

Source from the content-addressed store, hash-verified

9let getStdout
10
11const runTests = (type) => {
12 it('should ignore configs set to `undefined` in next.config.js', async () => {
13 await fs.writeFile(
14 nextConfig,
15 `
16 module.exports = {
17 target: undefined,
18 env: undefined,
19 webpack: undefined,
20 pageExtensions: undefined,
21 }
22 `
23 )
24
25 const stdout = await getStdout()
26
27 if (type === 'dev') {
28 expect(stdout).toMatch(/ready/i)
29 } else {
30 expect(stdout).toMatch(/Compiled successfully/i)
31 }
32 })
33
34 it('should ignore configs set to `null` in next.config.js', async () => {
35 await fs.writeFile(
36 nextConfig,
37 `
38 module.exports = {
39 target: null,
40 env: null,
41 webpack: null,
42 pageExtensions: null,
43 }
44 `
45 )
46
47 const stdout = await getStdout()
48
49 if (type === 'dev') {
50 expect(stdout).toMatch(/ready/i)
51 } else {
52 expect(stdout).toMatch(/Compiled successfully/i)
53 }
54 })
55}
56
57describe('Nullish configs in next.config.js', () => {
58 afterAll(() => fs.remove(nextConfig))

Callers 1

index.test.tsFile · 0.70

Calls 3

writeFileMethod · 0.65
itFunction · 0.50
expectFunction · 0.50

Tested by

no test coverage detected