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 <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>
This commit is contained in:
Richard Lau 2024-10-11 06:27:54 +01:00 committed by GitHub
parent 9f9069d313
commit 82dab76d63
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 11 deletions

View File

@ -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',

View File

@ -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();
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);
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);
}
}
{