(type)
| 9 | let getStdout |
| 10 | |
| 11 | const 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 | |
| 57 | describe('Nullish configs in next.config.js', () => { |
| 58 | afterAll(() => fs.remove(nextConfig)) |
no test coverage detected