forked from rescript-lang/rescript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinput.js
More file actions
45 lines (33 loc) · 1.15 KB
/
input.js
File metadata and controls
45 lines (33 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import * as assert from "node:assert";
import { setup } from "#dev/process";
const { execBuild, execClean } = setup(import.meta.dirname);
const o1 = await execBuild();
// biome-ignore lint/suspicious/noControlCharactersInRegex: strip ANSI color codes from output
const stripAnsi = s => s.replace(/\x1b\[[0-9;]*m/g, "");
const first_message = stripAnsi(o1.stdout)
.split("\n")
.map(s => s.trim())
.find(s => s === "Warning number 110");
if (!first_message) {
assert.fail(o1.stdout + o1.stderr);
}
// Second build using --warn-error +110
const o2 = await execBuild(["--warn-error", "+110"]);
const second_message = stripAnsi(o2.stderr)
.split("\n")
.map(s => s.trim())
.find(s => s === "Warning number 110 (configured as error)");
if (!second_message) {
assert.fail(o2.stdout + o2.stderr);
}
// Third build, without --warn-error +110
// The result should not be a warning as error
const o3 = await execBuild();
const third_message = stripAnsi(o3.stderr)
.split("\n")
.map(s => s.trim())
.find(s => s === "Warning number 110 (configured as error)");
if (o3.status !== 0 || third_message) {
assert.fail(o3.stdout + o3.stderr);
}
await execClean();