mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
module: use amaro default transform values
PR-URL: https://github.com/nodejs/node/pull/54517 Fixes: https://github.com/nodejs/node/issues/54514 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it>
This commit is contained in:
parent
6bf7b6e342
commit
5e6aab0eca
@ -360,10 +360,6 @@ function stripTypeScriptTypes(source, filename) {
|
||||
mode: typeScriptParsingMode,
|
||||
sourceMap: sourceMapEnabled,
|
||||
filename,
|
||||
// Transform option is only applied in transform mode.
|
||||
transform: {
|
||||
verbatimModuleSyntax: true,
|
||||
},
|
||||
};
|
||||
const { code, map } = parse(source, options);
|
||||
if (map) {
|
||||
|
@ -114,3 +114,15 @@ test('execute a transpiled JavaScript file', async () => {
|
||||
strictEqual(result.stdout, '');
|
||||
strictEqual(result.code, 1);
|
||||
});
|
||||
|
||||
test('execute TypeScript file with import = require', async () => {
|
||||
const result = await spawnPromisified(process.execPath, [
|
||||
'--experimental-transform-types',
|
||||
'--no-warnings',
|
||||
fixtures.path('typescript/cts/test-import-require.cts'),
|
||||
]);
|
||||
|
||||
strictEqual(result.stderr, '');
|
||||
match(result.stdout, /Hello, TypeScript!/);
|
||||
strictEqual(result.code, 0);
|
||||
});
|
||||
|
5
test/fixtures/typescript/cts/test-import-require.cts
vendored
Normal file
5
test/fixtures/typescript/cts/test-import-require.cts
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
import util = require("node:util");
|
||||
|
||||
const foo: string = "Hello, TypeScript!";
|
||||
|
||||
console.log(util.styleText(["red"], foo));
|
Loading…
Reference in New Issue
Block a user