Skip to content

Commit 5f67aea

Browse files
authored
[tsgen] Use node16 resolution for tsgen CommonJS test (#26896)
Update the CommonJS test case in `test_embind_tsgen_end_to_end` to use `node16` for `--module` and `--moduleResolution`. This fixes the TS5107 compiler error caused by the deprecation of the legacy `node10` resolution strategy in modern versions of TypeScript. Because there is no `type: "module"` specified in the package.json of the test environment, `node16` resolution continues to treat and generate files as CommonJS, preserving the intent of the test.
1 parent 48a0bbd commit 5f67aea

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

test/test_other.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3556,7 +3556,9 @@ def test_jspi_async_function(self):
35563556

35573557
@requires_dev_dependency('typescript')
35583558
@parameterized({
3559-
'commonjs': [['-sMODULARIZE'], ['--module', 'commonjs', '--moduleResolution', 'node']],
3559+
# Use `node16` to avoid the deprecated `node` moduleResolution in TS 6.0+. Since there is no
3560+
# `type: "module"` in package.json, this still tests CommonJS.
3561+
'commonjs': [['-sMODULARIZE'], ['--module', 'node16', '--moduleResolution', 'node16']],
35603562
'esm': [['-sEXPORT_ES6'], ['--module', 'NodeNext', '--moduleResolution', 'nodenext']],
35613563
'esm_with_jsgen': [['-sEXPORT_ES6', '-sEMBIND_AOT'], ['--module', 'NodeNext', '--moduleResolution', 'nodenext']],
35623564
})

0 commit comments

Comments
 (0)