@@ -9,20 +9,15 @@ import { createFixtureProject, css, js, json } from "./helpers/create-fixture";
99
1010test . setTimeout ( 120_000 ) ;
1111
12- let fixture = ( options : {
13- appServerPort : number ;
14- httpPort : number ;
15- webSocketPort : number ;
16- } ) => ( {
12+ let fixture = ( options : { appPort : number ; devPort : number } ) => ( {
1713 files : {
1814 "remix.config.js" : js `
1915 module.exports = {
2016 serverModuleFormat: "cjs",
2117 tailwind: true,
2218 future: {
2319 unstable_dev: {
24- httpPort: ${ options . httpPort } ,
25- webSocketPort: ${ options . webSocketPort } ,
20+ port: ${ options . devPort } ,
2621 },
2722 v2_routeConvention: true,
2823 v2_errorBoundary: true,
@@ -69,18 +64,17 @@ let fixture = (options: {
6964 const app = express();
7065 app.use(express.static("public", { immutable: true, maxAge: "1y" }));
7166
72- const MODE = process.env.NODE_ENV;
7367 const BUILD_DIR = path.join(process.cwd(), "build");
7468
7569 app.all(
7670 "*",
7771 createRequestHandler({
7872 build: require(BUILD_DIR),
79- mode: MODE ,
73+ mode: process.env.NODE_ENV ,
8074 })
8175 );
8276
83- let port = ${ options . appServerPort } ;
77+ let port = ${ options . appPort } ;
8478 app.listen(port, () => {
8579 let build = require(BUILD_DIR);
8680 console.log('✅ app ready: http://localhost:' + port);
@@ -249,12 +243,9 @@ test("HMR", async ({ page }) => {
249243 } ) ;
250244
251245 let portRange = makeRange ( 3080 , 3099 ) ;
252- let appServerPort = await getPort ( { port : portRange } ) ;
253- let httpPort = await getPort ( { port : portRange } ) ;
254- let webSocketPort = await getPort ( { port : portRange } ) ;
255- let projectDir = await createFixtureProject (
256- fixture ( { appServerPort, httpPort, webSocketPort } )
257- ) ;
246+ let appPort = await getPort ( { port : portRange } ) ;
247+ let devPort = await getPort ( { port : portRange } ) ;
248+ let projectDir = await createFixtureProject ( fixture ( { appPort, devPort } ) ) ;
258249
259250 // spin up dev server
260251 let dev = execa ( "npm" , [ "run" , "dev" ] , { cwd : projectDir } ) ;
@@ -269,7 +260,7 @@ test("HMR", async ({ page }) => {
269260 { timeoutMs : 10_000 }
270261 ) ;
271262
272- await page . goto ( `http://localhost:${ appServerPort } ` , {
263+ await page . goto ( `http://localhost:${ appPort } ` , {
273264 waitUntil : "networkidle" ,
274265 } ) ;
275266
@@ -469,7 +460,7 @@ whatsup
469460 await page . getByText ( "Hello, planet" ) . waitFor ( { timeout : HMR_TIMEOUT_MS } ) ;
470461 await page . waitForLoadState ( "networkidle" ) ;
471462
472- expect ( devStderr ( ) ) . toBe ( "" ) ;
463+ let stderr = devStderr ( ) ;
473464 let withSyntaxError = `
474465 import { useLoaderData } from "@remix-run/react";
475466 export function shouldRevalidate(args) {
@@ -485,9 +476,15 @@ whatsup
485476 }
486477 ` ;
487478 fs . writeFileSync ( indexPath , withSyntaxError ) ;
488- await wait ( ( ) => devStderr ( ) . includes ( 'Expected ";" but found "efault"' ) , {
489- timeoutMs : HMR_TIMEOUT_MS ,
490- } ) ;
479+ await wait (
480+ ( ) =>
481+ devStderr ( )
482+ . replace ( stderr , "" )
483+ . includes ( 'Expected ";" but found "efault"' ) ,
484+ {
485+ timeoutMs : HMR_TIMEOUT_MS ,
486+ }
487+ ) ;
491488
492489 let withFix = `
493490 import { useLoaderData } from "@remix-run/react";
0 commit comments