[build-utils] Add experimental flag to allow Node.js v20 (#10802)

Similar to #8836, but now for Node.js v20.
This commit is contained in:
Nathan Rajlich
2023-11-07 05:43:29 -08:00
committed by GitHub
parent 7b553c7032
commit 0861dc8fbc
3 changed files with 28 additions and 0 deletions

View File

@@ -313,6 +313,23 @@ it('should warn for deprecated versions, soon to be discontinued', async () => {
global.Date.now = realDateNow;
});
it('should only allow nodejs20.x when env var is set', async () => {
try {
expect(getLatestNodeVersion()).toHaveProperty('major', 18);
await expect(getSupportedNodeVersion('20.x')).rejects.toThrow();
process.env.VERCEL_ALLOW_NODEJS20 = '1';
expect(getLatestNodeVersion()).toHaveProperty('major', 20);
expect(await getSupportedNodeVersion('20.x')).toHaveProperty('major', 20);
expect(await getSupportedNodeVersion('20')).toHaveProperty('major', 20);
expect(await getSupportedNodeVersion('20.1.0')).toHaveProperty('major', 20);
expect(await getSupportedNodeVersion('>=16')).toHaveProperty('major', 20);
} finally {
delete process.env.VERCEL_ALLOW_NODEJS20;
}
});
it('should support initialHeaders and initialStatus correctly', async () => {
new Prerender({
expiration: 1,