Skip to content

Commit 87607f7

Browse files
committed
test(scripts): check unusable launcher cache once
1 parent c4c0d4d commit 87607f7

1 file changed

Lines changed: 13 additions & 17 deletions

File tree

‎scripts/build-npm-launcher.test.ts‎

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,18 @@ it.layer(NodeServices.layer)("build-npm-launcher", (it) => {
175175
["--version|", `serve a b|${launcher}`, `--version|${launcher}`],
176176
);
177177

178+
yield* fs.writeFileString(path.join(versionDir, "t3"), "#!/t3-test-missing-loader\n");
179+
for (const _attempt of [1, 2]) {
180+
const cached = yield* run(process.execPath, [launcher, "serve"], { cwd: root, env });
181+
assert.equal(cached.exitCode, 1, cached.stderr);
182+
assert.include(cached.stderr, "could not run");
183+
assert.equal(release.requests.length, requestsAfterFirst);
184+
assert.equal(
185+
yield* fs.readFileString(path.join(versionDir, ".install-complete")),
186+
`${VERSION}\n`,
187+
);
188+
}
189+
178190
const ipcServer = path.join(home, "runtime/versions", VERSION, "t3");
179191
yield* fs.writeFileString(
180192
ipcServer,
@@ -331,7 +343,7 @@ fs.readFileSync = (file, ...rest) => {
331343
}),
332344
);
333345
it.effect.skipIf(HostProcess.Platform.defaultValue() === "win32")(
334-
"does not publish an unusable release or redownload a complete unusable cache",
346+
"does not publish an unusable release",
335347
() =>
336348
Effect.gen(function* () {
337349
const fs = yield* FileSystem.FileSystem;
@@ -366,22 +378,6 @@ fs.readFileSync = (file, ...rest) => {
366378
assert.include(failed.stderr, "glibc");
367379
assert.include(failed.stderr, "musl");
368380
}
369-
370-
yield* fs.makeDirectory(dir);
371-
yield* fs.writeFileString(path.join(dir, "t3"), "#!/t3-test-missing-loader\n");
372-
yield* fs.chmod(path.join(dir, "t3"), 0o755);
373-
yield* fs.writeFileString(path.join(dir, ".install-complete"), `${VERSION}\n`);
374-
const requests = release.requests.length;
375-
for (const _attempt of [1, 2]) {
376-
const cached = yield* run(process.execPath, [launcher, "serve"], { cwd: root, env });
377-
assert.equal(cached.exitCode, 1, cached.stderr);
378-
assert.include(cached.stderr, "could not run");
379-
assert.equal(release.requests.length, requests);
380-
assert.equal(
381-
yield* fs.readFileString(path.join(dir, ".install-complete")),
382-
`${VERSION}\n`,
383-
);
384-
}
385381
}
386382
}),
387383
);

0 commit comments

Comments
 (0)