FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix build tests failing silently by cknitt · Pull Request #8295 · rescript-lang/rescript · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .js  (15) .md  (1) .res  (2) All 3 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
1 change: 1 addition & 0 deletions CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#### :house: Internal

- Reanalyze server: redesign incremental fixpoint with delete-then-rederive strategy and predecessor tracking, improving speed on deletions. https://github.com/rescript-lang/rescript/pull/8276
- Fix build tests failing silently. https://github.com/rescript-lang/rescript/pull/8295

# 13.0.0-alpha.2

Expand Down
20 changes: 20 additions & 0 deletions lib_dev/process.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const {
execBin,
rescript,
execBuild,
execBuildOrThrow,
execClean,
} = setup();

Expand Down Expand Up @@ -196,6 +197,25 @@ export function setup(cwd = process.cwd()) {
return exec(rescript_exe, ["build", ...args], options);
},

/**
* Execute ReScript `build` command directly and throw on non-zero exit
* while preserving captured stdout/stderr for quiet successful tests.
*
* @param {string[]} [args]
* @param {ExecOptions} [options]
* @return {Promise<ExecResult>}
*/
async execBuildOrThrow(args = [], options = {}) {
const out = await exec(rescript_exe, ["build", ...args], options);
if (out.status !== 0) {
const err = new Error("ReScript build failed");
err.stack = out.stdout + out.stderr;
Object.assign(err, { execResult: out });
throw err;
}
return out;
},

/**
* Execute ReScript `clean` command directly
*
Expand Down
4 changes: 2 additions & 2 deletions tests/build_tests/case3/input.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import fs from "node:fs/promises";
import path from "node:path";
import { setup } from "#dev/process";

const { execBuild, execClean } = setup(import.meta.dirname);
const { execBuildOrThrow, execClean } = setup(import.meta.dirname);

await execClean();
await execBuild();
await execBuildOrThrow();

const o = await fs.readFile(path.join("src", "hello.res.js"), "ascii");
assert.ok(/HelloGen\.f/.test(o));
4 changes: 2 additions & 2 deletions tests/build_tests/custom_namespace/input.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as assert from "node:assert";
import { setup } from "#dev/process";

const { execClean, execBuild } = setup(import.meta.dirname);
const { execClean, execBuildOrThrow } = setup(import.meta.dirname);

await execClean();
await execBuild();
await execBuildOrThrow();

const x = await import("./src/demo.res.js");
assert.equal(x.v, 42);
4 changes: 2 additions & 2 deletions tests/build_tests/devonly/input.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

import { setup } from "#dev/process";

const { execBuild } = setup(import.meta.dirname);
const { execBuildOrThrow } = setup(import.meta.dirname);

await execBuild();
await execBuildOrThrow();
5 changes: 3 additions & 2 deletions tests/build_tests/exports/input.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import { setup } from "#dev/process";

const { execBuild, execClean } = setup(import.meta.dirname);
const { execBuildOrThrow, execClean } = setup(import.meta.dirname);

await execBuild();
await execClean();
await execBuildOrThrow();
await execClean();
4 changes: 2 additions & 2 deletions tests/build_tests/hyphen2/input.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { setup } from "#dev/process";

const { execBuild, execClean } = setup(import.meta.dirname);
const { execBuildOrThrow, execClean } = setup(import.meta.dirname);

await execBuild();
await execBuildOrThrow();
await execClean();
4 changes: 2 additions & 2 deletions tests/build_tests/jsx_settings_inheritance/input.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { setup } from "#dev/process";

const { execBuild, execClean } = setup(import.meta.dirname);
const { execBuildOrThrow, execClean } = setup(import.meta.dirname);

await execClean();
await execBuild();
await execBuildOrThrow();
4 changes: 2 additions & 2 deletions tests/build_tests/nested/input.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import * as fs from "node:fs/promises";
import * as path from "node:path";
import { setup } from "#dev/process";

const { execBuild, execClean } = setup(import.meta.dirname);
const { execBuildOrThrow, execClean } = setup(import.meta.dirname);

await execBuild();
await execBuildOrThrow();

const content = await fs.readFile(
path.join(import.meta.dirname, "src", "demo.js"),
Expand Down
4 changes: 2 additions & 2 deletions tests/build_tests/nnest/input.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import * as fs from "node:fs/promises";
import * as path from "node:path";
import { setup } from "#dev/process";

const { execBuild, execClean } = setup(import.meta.dirname);
const { execBuildOrThrow, execClean } = setup(import.meta.dirname);

await execBuild();
await execBuildOrThrow();

const content = await fs.readFile(
path.join(import.meta.dirname, "src", "demo.js"),
Expand Down
4 changes: 2 additions & 2 deletions tests/build_tests/ns/input.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

import { setup } from "#dev/process";

const { execBuild } = setup(import.meta.dirname);
const { execBuildOrThrow } = setup(import.meta.dirname);

await execBuild();
await execBuildOrThrow();
4 changes: 2 additions & 2 deletions tests/build_tests/react_ppx/input.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

import { setup } from "#dev/process";

const { execBuild } = setup(import.meta.dirname);
const { execBuildOrThrow } = setup(import.meta.dirname);

await execBuild();
await execBuildOrThrow();
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module React = {
type element
type componentLike<'props, 'return> = 'props => 'return
type component<'props> = 'props => element
}

module Test = {
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Js.Console.log("test")
Console.log("test")
6 changes: 4 additions & 2 deletions tests/build_tests/transitive_dependency/input.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import { existsSync } from "node:fs";
import * as path from "node:path";
import { setup } from "#dev/process";

const { execBuild, execClean } = setup(path.join(import.meta.dirname, "a"));
const { execBuildOrThrow, execClean } = setup(
path.join(import.meta.dirname, "a"),
);
await execClean();
await execBuild();
await execBuildOrThrow();

assert.ok(
!existsSync(
Expand Down
4 changes: 2 additions & 2 deletions tests/build_tests/uncurried-always/input.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { setup } from "#dev/process";

const { execBuild, execClean } = setup(import.meta.dirname);
const { execBuildOrThrow, execClean } = setup(import.meta.dirname);

await execBuild();
await execBuildOrThrow();
await execClean();
4 changes: 2 additions & 2 deletions tests/build_tests/unicode/input.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import * as fs from "node:fs/promises";
import * as path from "node:path";
import { setup } from "#dev/process";

const { execBuild, execClean } = setup(import.meta.dirname);
const { execBuildOrThrow, execClean } = setup(import.meta.dirname);

if (process.platform === "win32") {
console.log("Skipping test on Windows");
process.exit(0);
}

await execBuild();
await execBuildOrThrow();

await fs.access(
path.join(import.meta.dirname, "lib", "bs", "src", "📕annotation", "a.js"),
Expand Down
4 changes: 2 additions & 2 deletions tests/build_tests/x-y/input.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { setup } from "#dev/process";

const { execBuild, execClean } = setup(import.meta.dirname);
const { execBuildOrThrow, execClean } = setup(import.meta.dirname);

await execBuild();
await execBuildOrThrow();
await execClean();
Loading

Back | FazBrowse Home | New Git URL