|
1 | 1 | import * as fs from 'fs';
|
2 | 2 | import * as assert from 'assert/strict';
|
3 | 3 |
|
4 |
| -const buildOutput = fs.readFileSync('.tmp_build_output', 'utf-8'); |
| 4 | +const packageJson = require('./package.json'); |
| 5 | +const nextjsVersion = packageJson.dependencies.next; |
5 | 6 |
|
6 |
| -// Assert that all static components stay static and all dynamic components stay dynamic |
| 7 | +const buildStdout = fs.readFileSync('.tmp_build_stdout', 'utf-8'); |
| 8 | +const buildStderr = fs.readFileSync('.tmp_build_stderr', 'utf-8'); |
7 | 9 |
|
8 |
| -assert.match(buildOutput, /○ \/client-compon
10000
ent/); |
9 |
| -assert.match(buildOutput, /● \/client-component\/parameter\/\[\.\.\.parameters\]/); |
10 |
| -assert.match(buildOutput, /● \/client-component\/parameter\/\[parameter\]/); |
| 10 | +// Assert that there was no funky build time warning when we are on a stable (pinned) version |
| 11 | +if (nextjsVersion !== 'latest' && nextjsVersion !== 'canary') { |
| 12 | + assert.doesNotMatch(buildStderr, /Import trace for requested module/); // This is Next.js/Webpack speech for "something is off" |
| 13 | +} |
11 | 14 |
|
12 |
| -assert.match(buildOutput, /λ \/server-component/); |
13 |
| -assert.match(buildOutput, /λ \/server-component\/parameter\/\[\.\.\.parameters\]/); |
14 |
| -assert.match(buildOutput, /λ \/server-component\/parameter\/\[parameter\]/); |
| 15 | +// Assert that all static components stay static and all dynamic components stay dynamic |
| 16 | +assert.match(buildStdout, /○ \/client-component/); |
| 17 | +assert.match(buildStdout, /● \/client-component\/parameter\/\[\.\.\.parameters\]/); |
| 18 | +assert.match(buildStdout, /● \/client-component\/parameter\/\[parameter\]/); |
| 19 | +assert.match(buildStdout, /λ \/server-component/); |
| 20 | +assert.match(buildStdout, /λ \/server-component\/parameter\/\[\.\.\.parameters\]/); |
| 21 | +assert.match(buildStdout, /λ \/server-component\/parameter\/\[parameter\]/); |
15 | 22 |
|
16 | 23 | export {};
|
0 commit comments