Skip to content

Commit f80ced9

Browse files
committed
test: skip failing tests when compiled without amaro
When compiled without amaro, this conflicts with --experimental-strip-types defaulting to true. To avoid that, we need to skip relevant failing tests. Fixes: #60640
1 parent ae62b36 commit f80ced9

20 files changed

+100
-19
lines changed

test/es-module/test-esm-detect-ambiguous.mjs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
import { spawnPromisified } from '../common/index.mjs';
1+
import * as common from '../common/index.mjs';
22
import * as fixtures from '../common/fixtures.mjs';
33
import { spawn } from 'node:child_process';
44
import { describe, it } from 'node:test';
55
import assert from 'node:assert';
66

7+
if (!process.config.variables.node_use_amaro) {
8+
common.skip('Requires Amaro');
9+
}
10+
const { spawnPromisified } = common;
11+
712
describe('Module syntax detection', { concurrency: !process.env.TEST_PARALLEL }, () => {
813
describe('string input', { concurrency: !process.env.TEST_PARALLEL }, () => {
914
it('permits ESM syntax in --eval input without requiring --input-type=module', async () => {

test/es-module/test-esm-import-meta-main-eval.mjs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
import { spawnPromisified } from '../common/index.mjs';
1+
import * as common from '../common/index.mjs';
22
import * as fixtures from '../common/fixtures.js';
33
import assert from 'node:assert/strict';
44
import { describe, it } from 'node:test';
55

6+
if (!process.config.variables.node_use_amaro) {
7+
common.skip('Requires Amaro');
8+
}
9+
const { spawnPromisified } = common;
10+
611
function wrapScriptInEvalWorker(script) {
712
return `
813
import { Worker } from 'node:worker_threads';

test/es-module/test-esm-tla-syntax-errors-not-recognized-as-tla-error.mjs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
import { spawnPromisified } from '../common/index.mjs';
1+
import * as common from '../common/index.mjs';
22
import { describe, it } from 'node:test';
33
import assert from 'node:assert';
44

5+
if (!process.config.variables.node_use_amaro) {
6+
common.skip('Requires Amaro');
7+
}
8+
const { spawnPromisified } = common;
9+
510
describe('unusual top-level await syntax errors', () => {
611
const expressions = [
712
// string

test/parallel/test-compile-cache-typescript-commonjs.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22

33
// This tests NODE_COMPILE_CACHE works for CommonJS with types.
44

5-
require('../common');
5+
const common = require('../common');
66
const { spawnSyncAndAssert } = require('../common/child_process');
77
const assert = require('assert');
88
const tmpdir = require('../common/tmpdir');
99
const fixtures = require('../common/fixtures');
1010

11+
if (!process.config.variables.node_use_amaro) {
12+
common.skip('Requires Amaro');
13+
}
14+
1115
// Check cache for .ts files that would be run as CommonJS.
1216
{
1317
tmpdir.refresh();

test/parallel/test-compile-cache-typescript-esm.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22

33
// This tests NODE_COMPILE_CACHE works for ESM with types.
44

5-
require('../common');
5+
const common = require('../common');
66
const { spawnSyncAndAssert } = require('../common/child_process');
77
const assert = require('assert');
88
const tmpdir = require('../common/tmpdir');
99
const fixtures = require('../common/fixtures');
1010

11+
if (!process.config.variables.node_use_amaro) {
12+
common.skip('Requires Amaro');
13+
}
14+
1115
// Check cache for .ts files that would be run as ESM.
1216
{
1317
tmpdir.refresh();

test/parallel/test-compile-cache-typescript-strip-miss.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@
33
// This tests NODE_COMPILE_CACHE can handle cache invalidation
44
// between strip-only TypeScript and transformed TypeScript.
55

6-
require('../common');
6+
const common = require('../common');
77
const { spawnSyncAndAssert } = require('../common/child_process');
88
const assert = require('assert');
99
const tmpdir = require('../common/tmpdir');
1010
const fixtures = require('../common/fixtures');
1111

12+
if (!process.config.variables.node_use_amaro) {
13+
common.skip('Requires Amaro');
14+
}
15+
1216
tmpdir.refresh();
1317
const dir = tmpdir.resolve('.compile_cache_dir');
1418
const script = fixtures.path('typescript', 'ts', 'test-typescript.ts');

test/parallel/test-compile-cache-typescript-strip-sourcemaps.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@
33
// This tests NODE_COMPILE_CACHE can be used for type stripping and ignores
44
// --enable-source-maps as there's no difference in the code generated.
55

6-
require('../common');
6+
const common = require('../common');
77
const { spawnSyncAndAssert } = require('../common/child_process');
88
const assert = require('assert');
99
const tmpdir = require('../common/tmpdir');
1010
const fixtures = require('../common/fixtures');
1111

12+
if (!process.config.variables.node_use_amaro) {
13+
common.skip('Requires Amaro');
14+
}
15+
1216
tmpdir.refresh();
1317
const dir = tmpdir.resolve('.compile_cache_dir');
1418
const script = fixtures.path('typescript', 'ts', 'test-typescript.ts');

test/parallel/test-compile-cache-typescript-transform.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22

33
// This tests NODE_COMPILE_CACHE works with --experimental-transform-types.
44

5-
require('../common');
5+
const common = require('../common');
66
const { spawnSyncAndAssert } = require('../common/child_process');
77
const assert = require('assert');
88
const tmpdir = require('../common/tmpdir');
99
const fixtures = require('../common/fixtures');
1010

11+
if (!process.config.variables.node_use_amaro) {
12+
common.skip('Requires Amaro');
13+
}
14+
1115

1216
tmpdir.refresh();
1317
const dir = tmpdir.resolve('.compile_cache_dir');

test/parallel/test-config-file.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
'use strict';
22

3+
const common = require('../common');
34
const {
45
isWindows,
56
spawnPromisified,
67
skipIfSQLiteMissing,
7-
} = require('../common');
8-
skipIfSQLiteMissing();
8+
} = common;
99
const fixtures = require('../common/fixtures');
1010
const tmpdir = require('../common/tmpdir');
1111
const assert = require('node:assert');
1212
const { test, it, describe } = require('node:test');
1313
const { chmodSync, writeFileSync, constants } = require('node:fs');
1414
const { join } = require('node:path');
1515

16+
if (!process.config.variables.node_use_amaro) {
17+
common.skip('Requires Amaro');
18+
}
19+
skipIfSQLiteMissing();
20+
1621
test('should handle non existing json', async () => {
1722
const result = await spawnPromisified(process.execPath, [
1823
'--experimental-config-file',

test/parallel/test-node-output-eval.mjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
import '../common/index.mjs';
1+
import * as common from '../common/index.mjs';
22
import * as fixtures from '../common/fixtures.mjs';
33
import * as snapshot from '../common/assertSnapshot.js';
44
import { basename } from 'node:path';
55
import { describe, it } from 'node:test';
66

7+
if (!process.config.variables.node_use_amaro) {
8+
common.skip('Requires Amaro');
9+
}
10+
711
describe('eval output', { concurrency: true }, () => {
812
function normalize(str) {
913
return str.replaceAll(snapshot.replaceWindowsPaths(process.cwd()), '')

0 commit comments

Comments
 (0)