From b4b04ce7c16e88ade7d58fcd9fe6aedef06c0b1f Mon Sep 17 00:00:00 2001 From: Christos Koutsiaris Date: Wed, 31 Jul 2024 11:44:16 +0100 Subject: [PATCH 1/2] test: remove duplicated test descriptions --- lib/internal/modules/cjs/loader.js | 5 +++++ test/es-module/test-typescript-eval.mjs | 2 +- test/es-module/test-typescript.mjs | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index 674aaca5b4a508..324ebb652200d4 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -1582,6 +1582,11 @@ function getMaybeCachedSource(mod, filename) { return content; } +/** + * Built-in handler for `.cts` files. + * @param {Module} module The module to compile + * @param {string} filename The file path of the module + */ function loadCTS(module, filename) { if (isUnderNodeModules(filename)) { throw new ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING(filename); diff --git a/test/es-module/test-typescript-eval.mjs b/test/es-module/test-typescript-eval.mjs index 120b66a1d26017..be467721577826 100644 --- a/test/es-module/test-typescript-eval.mjs +++ b/test/es-module/test-typescript-eval.mjs @@ -98,7 +98,7 @@ test('expect fail eval TypeScript CommonJS syntax with input-type module', async strictEqual(result.code, 1); }); -test('expect fail eval TypeScript CommonJS syntax with input-type module', async () => { +test('expect fail eval TypeScript ESM syntax with input-type commonjs', async () => { const result = await spawnPromisified(process.execPath, [ '--experimental-strip-types', '--input-type=commonjs', diff --git a/test/es-module/test-typescript.mjs b/test/es-module/test-typescript.mjs index 496e42178f4a3e..e1a1bd81b5ca18 100644 --- a/test/es-module/test-typescript.mjs +++ b/test/es-module/test-typescript.mjs @@ -288,7 +288,7 @@ test('execute a TypeScript file with CommonJS syntax requiring .mts', async () = strictEqual(result.code, 1); }); -test('execute a TypeScript file with CommonJS syntax requiring .mts with require-module', async () => { +test('execute a TypeScript file with CommonJS syntax requiring .mts using require-module', async () => { const result = await spawnPromisified(process.execPath, [ '--experimental-strip-types', '--experimental-require-module', @@ -300,7 +300,7 @@ test('execute a TypeScript file with CommonJS syntax requiring .mts with require strictEqual(result.code, 0); }); -test('execute a TypeScript file with CommonJS syntax requiring .mts with require-module', async () => { +test('execute a TypeScript file with CommonJS syntax requiring .cts using commonjs', async () => { const result = await spawnPromisified(process.execPath, [ '--experimental-strip-types', '--no-warnings', From 66300fe518d5a4eb5c85fc321cf434526cbfa4ad Mon Sep 17 00:00:00 2001 From: Christos Koutsiaris Date: Sun, 1 Sep 2024 19:02:25 +0100 Subject: [PATCH 2/2] fixup! test: remove duplicated test descriptions --- lib/internal/modules/cjs/loader.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index 324ebb652200d4..674aaca5b4a508 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -1582,11 +1582,6 @@ function getMaybeCachedSource(mod, filename) { return content; } -/** - * Built-in handler for `.cts` files. - * @param {Module} module The module to compile - * @param {string} filename The file path of the module - */ function loadCTS(module, filename) { if (isUnderNodeModules(filename)) { throw new ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING(filename);