From 3273707a3af284b7457cec3b967a515d67e697ff Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Fri, 11 Oct 2024 06:27:54 +0100 Subject: [PATCH] test: fix tests when Amaro is unavailable Fix two tests that fail when `node` is configured `--without-amaro`. PR-URL: https://github.com/nodejs/node/pull/55320 Reviewed-By: Antoine du Hamel Reviewed-By: Chemi Atlow Reviewed-By: Marco Ippolito Reviewed-By: Luigi Pinca --- test/es-module/test-esm-loader-entry-url.mjs | 2 +- test/parallel/test-runner-cli.js | 27 ++++++++++++-------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/test/es-module/test-esm-loader-entry-url.mjs b/test/es-module/test-esm-loader-entry-url.mjs index 370871113239f1..e0b931693654a0 100644 --- a/test/es-module/test-esm-loader-entry-url.mjs +++ b/test/es-module/test-esm-loader-entry-url.mjs @@ -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', diff --git a/test/parallel/test-runner-cli.js b/test/parallel/test-runner-cli.js index 231499728e3e95..3e8e14b747a22f 100644 --- a/test/parallel/test-runner-cli.js +++ b/test/parallel/test-runner-cli.js @@ -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); + } } {