Skip to content

Commit 6b84134

Browse files
committed
add 16 test
1 parent 9808377 commit 6b84134

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* Next.js 16+ uses Turbopack, which lacks callbacks for build errors or warnings.
3+
* This script runs the build and fails if Turbopack reports any warnings.
4+
*/
5+
import { execSync } from 'node:child_process';
6+
import path from 'node:path';
7+
8+
const testDir = path.dirname(new URL(import.meta.url).pathname);
9+
10+
// Install dependencies and run build, capturing both stdout and stderr
11+
const output = execSync('npm run build 2>&1', {
12+
cwd: testDir,
13+
encoding: 'utf-8',
14+
});
15+
16+
const hasWarning = /Turbopack build encountered/.test(output);
17+
if (hasWarning) {
18+
console.error('Build produced warnings:\n', output);
19+
process.exit(1);
20+
}
21+
22+
console.log('Build completed without warnings');

0 commit comments

Comments
 (0)