Skip to content

Commit

Permalink
test: fix tests when Amaro is unavailable
Browse files Browse the repository at this point in the history
Fix two tests that fail when `node` is configured `--without-amaro`.

PR-URL: #55320
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
richardlau authored and aduh95 committed Oct 11, 2024
1 parent 34ca36a commit 3273707
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion test/es-module/test-esm-loader-entry-url.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ describe('--entry-url', { concurrency: true }, () => {
);
});

it('should support loading TypeScript URLs', async () => {
it('should support loading TypeScript URLs', { skip: !process.config.variables.node_use_amaro }, async () => {
const typescriptUrls = [
'typescript/cts/test-require-ts-file.cts',
'typescript/mts/test-import-ts-file.mts',
Expand Down
27 changes: 16 additions & 11 deletions test/parallel/test-runner-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,22 @@ for (const isolation of ['none', 'process']) {
`--experimental-${type}-types`, `--experimental-test-isolation=${isolation}`];
const child = spawnSync(process.execPath, args, { cwd: join(testFixtures, 'matching-patterns') });

assert.strictEqual(child.stderr.toString(), '');
const stdout = child.stdout.toString();

assert.match(stdout, /ok 1 - this should pass/);
assert.match(stdout, /ok 2 - this should pass/);
assert.match(stdout, /ok 3 - this should pass/);
assert.match(stdout, /ok 4 - this should pass/);
assert.match(stdout, /ok 5 - this should pass/);
assert.match(stdout, /ok 6 - this should pass/);
assert.strictEqual(child.status, 0);
assert.strictEqual(child.signal, null);
if (!process.config.variables.node_use_amaro) {
// e.g. Compiled with `--without-amaro`.
assert.strictEqual(child.status, 1);
} else {
assert.strictEqual(child.stderr.toString(), '');
const stdout = child.stdout.toString();

assert.match(stdout, /ok 1 - this should pass/);
assert.match(stdout, /ok 2 - this should pass/);
assert.match(stdout, /ok 3 - this should pass/);
assert.match(stdout, /ok 4 - this should pass/);
assert.match(stdout, /ok 5 - this should pass/);
assert.match(stdout, /ok 6 - this should pass/);
assert.strictEqual(child.status, 0);
assert.strictEqual(child.signal, null);
}
}

{
Expand Down

0 comments on commit 3273707

Please sign in to comment.