Skip to content

Commit

Permalink
try to fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
echo-bravo-yahoo committed Nov 21, 2024
1 parent 777189c commit 9f63979
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
5 changes: 5 additions & 0 deletions scripts/update-prod-hashbang.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env node
import * as fs from "node:fs";
import * as fsp from "node:fs/promises";
import * as path from "node:path";

const __dirname = import.meta.dirname;
Expand All @@ -12,4 +13,8 @@ fileContents = `#!/usr/bin/env NODE_NO_WARNINGS=1 node\n${fileContents}`;
fs.rmSync(filePath);
fs.writeFileSync(filePath, fileContents, {
mode: 0o755,
flush: true,
});

// eslint-disable-next-line no-console
fsp.stat(filePath).then(console.log);
22 changes: 14 additions & 8 deletions test/general-cli.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,14 @@ describe("cli operations", function () {
});

it("enables nodeJS warnings from the dev entrypoint", async function () {
let stderr = spawnSync("./src/user-entrypoint.mjs", ["warn"], {
let cli = spawnSync("./src/user-entrypoint.mjs", ["warn"], {
encoding: "utf8",
shell: true,
stdio: "pipe",
}).stderr;
input: "",
timeout: 5000,
stdio: ["inherit", "pipe", "pipe"],
});
if (cli.error) throw cli.error;
let stderr = cli.stderr;

// the dev script should emit warnings
expect(stderr).to.include(
Expand All @@ -139,11 +142,14 @@ describe("cli operations", function () {
});

it("suppresses nodeJS warnings from the prod entrypoint", async function () {
let stderr = spawnSync("./dist/cli.cjs", ["warn"], {
let cli = spawnSync("./dist/cli.cjs", ["warn"], {

Check failure on line 145 in test/general-cli.mjs

View workflow job for this annotation

GitHub Actions / JUnit Test Report

/home/runner/work/fauna-shell/fauna-shell/test/general-cli.mjs.cli operations suppresses nodeJS warnings from the prod entrypoint

spawnSync ./dist/cli.cjs ETIMEDOUT
Raw output
Error: spawnSync ./dist/cli.cjs ETIMEDOUT
    at Object.spawnSync (node:internal/child_process:1123:20)
    at spawnSync (node:child_process:874:24)
    at Context.<anonymous> (file:///home/runner/work/fauna-shell/fauna-shell/test/general-cli.mjs:145:15)
    at process.processImmediate (node:internal/timers:491:21)
encoding: "utf8",
shell: true,
stdio: "pipe",
}).stderr;
input: "",
timeout: 5000,
stdio: ["inherit", "pipe", "pipe"],
});
if (cli.error) throw cli.error;
let stderr = cli.stderr;

// the prod one should not
expect(stderr).to.equal("");
Expand Down

0 comments on commit 9f63979

Please sign in to comment.