Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cspotcode committed Jun 17, 2022
1 parent 78385f0 commit c98b685
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/test/esm-loader.spec.ts
Expand Up @@ -20,6 +20,8 @@ import {
nodeUsesNewHooksApi,
resetNodeEnvironment,
TEST_DIR,
tsSupportsImportAssertions,
tsSupportsResolveJsonModule,
} from './helpers';
import { createExec, createSpawn, ExecReturn } from './exec-helpers';
import { join, resolve } from 'path';
Expand Down Expand Up @@ -269,7 +271,11 @@ test.suite('esm', (test) => {
});

test.suite('supports import assertions', (test) => {
test.runIf(nodeSupportsImportAssertions);
test.runIf(
nodeSupportsImportAssertions &&
tsSupportsImportAssertions &&
tsSupportsResolveJsonModule
);

const macro = test.macro((flags: string) => async (t) => {
const { err, stdout } = await exec(
Expand Down
2 changes: 2 additions & 0 deletions src/test/helpers.ts
Expand Up @@ -85,6 +85,7 @@ export const nodeSupportsImportingTransformedCjsFromEsm = semver.gte(
process.version,
'14.13.1'
);
export const tsSupportsResolveJsonModule = semver.gte(ts.version, '2.9.0');
/** Supports tsconfig "extends" >= v3.2.0 */
export const tsSupportsTsconfigInheritanceViaNodePackages = semver.gte(
ts.version,
Expand All @@ -97,6 +98,7 @@ export const tsSupportsStableNodeNextNode16 =
ts.version.startsWith('4.7.') || semver.gte(ts.version, '4.7.0');
// TS 4.5 is first version to understand .cts, .mts, .cjs, and .mjs extensions
export const tsSupportsMtsCtsExtensions = semver.gte(ts.version, '4.5.0');
export const tsSupportsImportAssertions = semver.gte(ts.version, '4.5.0');
//#endregion

export const xfs = new NodeFS(fs);
Expand Down

0 comments on commit c98b685

Please sign in to comment.