Unverified Commit 2a75a933 authored by Hendrik Liebau's avatar Hendrik Liebau Committed by GitHub

Don't start next server unnecessarily to assert build output (#80994)

In some of these tests we only need to check the CLI output after a
build, so we can skip starting the server to save some cycles.
parent b91297d9
...@@ -88,7 +88,7 @@ describe.each([ ...@@ -88,7 +88,7 @@ describe.each([
} else { } else {
it('should error the build if Math.random() happens before some component outside a Suspense boundary is complete', async () => { it('should error the build if Math.random() happens before some component outside a Suspense boundary is complete', async () => {
try { try {
await next.start() await next.build()
} catch { } catch {
// we expect the build to fail // we expect the build to fail
} }
......
...@@ -38,7 +38,7 @@ describe.each([ ...@@ -38,7 +38,7 @@ describe.each([
} else { } else {
it('should not error the build sync IO is used inside a Suspense Boundary in a client Component and nothing else is dynamic', async () => { it('should not error the build sync IO is used inside a Suspense Boundary in a client Component and nothing else is dynamic', async () => {
try { try {
await next.start() await next.build()
} catch { } catch {
throw new Error('expected build not to fail') throw new Error('expected build not to fail')
} }
...@@ -90,7 +90,7 @@ describe.each([ ...@@ -90,7 +90,7 @@ describe.each([
} else { } else {
it('should error the build with a reason related to sync IO access', async () => { it('should error the build with a reason related to sync IO access', async () => {
try { try {
await next.start() await next.build()
} catch { } catch {
// we expect the build to fail // we expect the build to fail
} }
...@@ -228,7 +228,7 @@ describe.each([ ...@@ -228,7 +228,7 @@ describe.each([
} else { } else {
it('should error the build with a reason related dynamic data', async () => { it('should error the build with a reason related dynamic data', async () => {
try { try {
await next.start() await next.build()
} catch { } catch {
// we expect the build to fail // we expect the build to fail
} }
...@@ -378,7 +378,7 @@ describe.each([ ...@@ -378,7 +378,7 @@ describe.each([
} else { } else {
it('should error the build with a reason related to sync IO access', async () => { it('should error the build with a reason related to sync IO access', async () => {
try { try {
await next.start() await next.build()
} catch { } catch {
// we expect the build to fail // we expect the build to fail
} }
......
...@@ -124,7 +124,7 @@ describe.each([ ...@@ -124,7 +124,7 @@ describe.each([
} else { } else {
it('should error the build if dynamic IO happens in the root (outside a Suspense)', async () => { it('should error the build if dynamic IO happens in the root (outside a Suspense)', async () => {
try { try {
await next.start() await next.build()
} catch { } catch {
// we expect the build to fail // we expect the build to fail
} }
...@@ -358,7 +358,7 @@ describe.each([ ...@@ -358,7 +358,7 @@ describe.each([
} else { } else {
it('should error the build if dynamic IO happens in the root (outside a Suspense)', async () => { it('should error the build if dynamic IO happens in the root (outside a Suspense)', async () => {
try { try {
await next.start() await next.build()
} catch { } catch {
// we expect the build to fail // we expect the build to fail
} }
...@@ -539,7 +539,7 @@ describe.each([ ...@@ -539,7 +539,7 @@ describe.each([
} else { } else {
it('should error the build if dynamic IO happens in the root (outside a Suspense)', async () => { it('should error the build if dynamic IO happens in the root (outside a Suspense)', async () => {
try { try {
await next.start() await next.build()
} catch { } catch {
// we expect the build to fail // we expect the build to fail
} }
......
...@@ -47,7 +47,7 @@ describe.each([ ...@@ -47,7 +47,7 @@ describe.each([
} else { } else {
it('should error the build if generateMetadata is dynamic when the rest of the route is prerenderable', async () => { it('should error the build if generateMetadata is dynamic when the rest of the route is prerenderable', async () => {
try { try {
await next.start() await next.build()
} catch { } catch {
// we expect the build to fail // we expect the build to fail
} }
...@@ -166,7 +166,7 @@ describe.each([ ...@@ -166,7 +166,7 @@ describe.each([
// This test is just here because there was a bug when dynamic metadata was used alongside another dynamic IO violation which caused the validation to be skipped. // This test is just here because there was a bug when dynamic metadata was used alongside another dynamic IO violation which caused the validation to be skipped.
it('should error the build for the correct reason when there is a dynamic IO violation alongside dynamic metadata', async () => { it('should error the build for the correct reason when there is a dynamic IO violation alongside dynamic metadata', async () => {
try { try {
await next.start() await next.build()
} catch { } catch {
// we expect the build to fail // we expect the build to fail
} }
...@@ -300,7 +300,7 @@ describe.each([ ...@@ -300,7 +300,7 @@ describe.each([
} else { } else {
it('should error the build if generateMetadata is dynamic when the rest of the route is prerenderable', async () => { it('should error the build if generateMetadata is dynamic when the rest of the route is prerenderable', async () => {
try { try {
await next.start() await next.build()
} catch { } catch {
// we expect the build to fail // we expect the build to fail
} }
...@@ -420,7 +420,7 @@ describe.each([ ...@@ -420,7 +420,7 @@ describe.each([
} else { } else {
it('should error the build if generateViewport is dynamic', async () => { it('should error the build if generateViewport is dynamic', async () => {
try { try {
await next.start() await next.build()
} catch { } catch {
// we expect the build to fail // we expect the build to fail
} }
...@@ -502,7 +502,7 @@ describe.each([ ...@@ -502,7 +502,7 @@ describe.each([
} else { } else {
it('should error the build if generateViewport is dynamic even if there are other uses of dynamic on the page', async () => { it('should error the build if generateViewport is dynamic even if there are other uses of dynamic on the page', async () => {
try { try {
await next.start() await next.build()
} catch { } catch {
// we expect the build to fail // we expect the build to fail
} }
...@@ -573,9 +573,8 @@ describe.each([ ...@@ -573,9 +573,8 @@ describe.each([
} else { } else {
it('should not error the build when all routes are static', async () => { it('should not error the build when all routes are static', async () => {
try { try {
await next.start() await next.build()
} catch { } catch {
// we expect the build to fail
throw new Error('expected build not to fail for fully static project') throw new Error('expected build not to fail for fully static project')
} }
}) })
...@@ -694,7 +693,7 @@ describe.each([ ...@@ -694,7 +693,7 @@ describe.each([
} else { } else {
it('should error the build if dynamic IO happens in the root (outside a Suspense)', async () => { it('should error the build if dynamic IO happens in the root (outside a Suspense)', async () => {
try { try {
await next.start() await next.build()
} catch { } catch {
// we expect the build to fail // we expect the build to fail
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment