-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
test: skip failing tests and set the default value of strip-types to false when compiled without amaro #60815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: skip failing tests and set the default value of strip-types to false when compiled without amaro #60815
Conversation
|
Review requested:
|
|
Good job 👍🏼 We can skip just the failing subtest, you can pass an argument |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #60815 +/- ##
==========================================
- Coverage 88.54% 88.54% -0.01%
==========================================
Files 703 703
Lines 208291 208291
Branches 40170 40169 -1
==========================================
- Hits 184430 184426 -4
- Misses 15865 15868 +3
- Partials 7996 7997 +1
🚀 New features to boost your workflow:
|
|
That's great, I'll be glad to test when it's ready and before it's merged. |
test/es-module/test-esm-tla-syntax-errors-not-recognized-as-tla-error.mjs
Outdated
Show resolved
Hide resolved
a450ee5 to
3dc852d
Compare
Move the amaro availability check immediately after importing common module in test files, as requested in PR feedback. Changes: - Place amaro check after common import but before other imports - Update test-node-output-sourcemaps.mjs to dynamically skip .ts tests based on file extension - Add individual skip conditions for TypeScript-specific tests - Fix linting errors (missing semicolon, line length issues) Refs: nodejs#60815
|
Thank you very much for your reviews. I addressed the points. Could you please take a look again? Thank you in advance! |
|
Once we fix #60815 (comment) |
3dc852d to
332027b
Compare
Move the amaro availability check immediately after importing common module in test files, as requested in PR feedback. Changes: - Place amaro check after common import but before other imports - Update test-node-output-sourcemaps.mjs to dynamically skip .ts tests based on file extension - Add individual skip conditions for TypeScript-specific tests - Fix linting errors (missing semicolon, line length issues) Refs: nodejs#60815
the default value of strip_types is controlled by node_options.h and we need to change the default value there Fixes: nodejs#60815
some tests are skipped although they aren't relevant to amaro. Fixes: nodejs#60815
|
@marco-ippolito @aduh95 Thank you for your reviews! Could you please review again? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested with nix-shell --arg benchmarkTools '[]' --arg devTools '[]' --arg extraConfigFlags '["--without-amaro"]' --arg loadJSBuiltinsDynamically false --run 'make run-ci -j12', got the following:
Failed tests:
out/Release/node test/parallel/test-compile-cache-typescript-commonjs.js
out/Release/node test/parallel/test-compile-cache-typescript-esm.js
$ out/Release/node test/parallel/test-compile-cache-typescript-commonjs.js
[process 81863]: --- stderr ---
[compile cache] resolved path …/test/.tmp.0/.compile_cache_dir + v26.0.0-pre-arm64-2cc2566e-501 -> …/test/.tmp.0/.compile_cache_dir/v26.0.0-pre-arm64-2cc2566e-501
[compile cache] creating cache directory …/test/.tmp.0/.compile_cache_dir/v26.0.0-pre-arm64-2cc2566e-501...success
[compile cache] reading cache from …/test/.tmp.0/.compile_cache_dir/v26.0.0-pre-arm64-2cc2566e-501/493f28c6 for CommonJS …/test/fixtures/typescript/cts/test-require-commonjs.cts... no such file or directory
[compile cache] reading cache from …/test/.tmp.0/.compile_cache_dir/v26.0.0-pre-arm64-2cc2566e-501/5118beb5 for ESM file://…/test/fixtures/typescript/cts/test-require-commonjs.cts... no such file or directory
…/test/fixtures/typescript/cts/test-require-commonjs.cts:3
interface Foo {};
^^^
SyntaxError: Unexpected identifier 'Foo'
at wrapSafe (node:internal/modules/cjs/loader:1691:18)
at Module._compile (node:internal/modules/cjs/loader:1734:20)
at Object..js (node:internal/modules/cjs/loader:1891:10)
at Module.load (node:internal/modules/cjs/loader:1480:32)
at Module._load (node:internal/modules/cjs/loader:1299:12)
at TracingChannel.traceSync (node:diagnostics_channel:328:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:245:24)
at Module.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:154:5)
at node:internal/main/run_main_module:33:47
Node.js v26.0.0-pre
[compile cache] skip persisting ESM file://…/test/fixtures/typescript/cts/test-require-commonjs.cts because the cache was not initialized
[compile cache] skip persisting CommonJS …/test/fixtures/typescript/cts/test-require-commonjs.cts because the cache was not initialized
[compile cache] Clear deserialized cache.
[process 81863]: --- stdout ---
[process 81863]: status = 1, signal = null
…/test/common/child_process.js:112
throw error;
^
Error: - process terminated with status 1, expected 0
at Object.<anonymous> (…/test/parallel/test-compile-cache-typescript-commonjs.js:66:3)
at Module._compile (node:internal/modules/cjs/loader:1760:14)
at Object..js (node:internal/modules/cjs/loader:1891:10)
at Module.load (node:internal/modules/cjs/loader:1480:32)
at Module._load (node:internal/modules/cjs/loader:1299:12)
at TracingChannel.traceSync (node:diagnostics_channel:328:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:245:24)
at Module.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:154:5)
at node:internal/main/run_main_module:33:47 {
options: {
env: {
NODE_DEBUG_NATIVE: 'COMPILE_CACHE',
NODE_COMPILE_CACHE: '…/test/.tmp.0/.compile_cache_dir'
},
cwd: '…/test/.tmp.0'
},
command: '…/out/Release/node …/test/fixtures/typescript/cts/test-require-commonjs.cts'
}
Node.js v26.0.0-pre
$ out/Release/node test/parallel/test-compile-cache-typescript-esm.js
[process 82022]: --- stderr ---
[compile cache] resolved path …/test/.tmp.0/.compile_cache_dir + v26.0.0-pre-arm64-2cc2566e-501 -> …/test/.tmp.0/.compile_cache_dir/v26.0.0-pre-arm64-2cc2566e-501
[compile cache] creating cache directory …/test/.tmp.0/.compile_cache_dir/v26.0.0-pre-arm64-2cc2566e-501...success
[compile cache] reading cache from …/test/.tmp.0/.compile_cache_dir/v26.0.0-pre-arm64-2cc2566e-501/97aac843 for CommonJS …/test/fixtures/typescript/mts/test-import-module.mts... no such file or directory
node:internal/modules/esm/get_format:185
throw new ERR_UNKNOWN_FILE_EXTENSION(ext, filepath);
^
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".mts" for …/test/fixtures/typescript/mts/test-import-module.mts
at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:185:9)
at defaultGetFormat (node:internal/modules/esm/get_format:211:36)
at defaultLoadSync (node:internal/modules/esm/load:158:16)
at #loadAndMaybeBlockOnLoaderThread (node:internal/modules/esm/loader:789:12)
at #loadSync (node:internal/modules/esm/loader:809:49)
at ModuleLoader.load (node:internal/modules/esm/loader:774:26)
at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:520:31)
at #getOrCreateModuleJobAfterResolve (node:internal/modules/esm/loader:565:36)
at afterResolve (node:internal/modules/esm/loader:618:52)
at ModuleLoader.getOrCreateModuleJob (node:internal/modules/esm/loader:624:12) {
code: 'ERR_UNKNOWN_FILE_EXTENSION'
}
Node.js v26.0.0-pre
[compile cache] skip persisting CommonJS …/test/fixtures/typescript/mts/test-import-module.mts because the cache was not initialized
[compile cache] Clear deserialized cache.
[process 82022]: --- stdout ---
[process 82022]: status = 1, signal = null
…/test/common/child_process.js:112
throw error;
^
Error: - process terminated with status 1, expected 0
at Object.<anonymous> (…/test/parallel/test-compile-cache-typescript-esm.js:66:3)
at Module._compile (node:internal/modules/cjs/loader:1760:14)
at Object..js (node:internal/modules/cjs/loader:1891:10)
at Module.load (node:internal/modules/cjs/loader:1480:32)
at Module._load (node:internal/modules/cjs/loader:1299:12)
at TracingChannel.traceSync (node:diagnostics_channel:328:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:245:24)
at Module.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:154:5)
at node:internal/main/run_main_module:33:47 {
options: {
env: {
NODE_DEBUG_NATIVE: 'COMPILE_CACHE',
NODE_COMPILE_CACHE: '…/test/.tmp.0/.compile_cache_dir'
},
cwd: '…/test/.tmp.0'
},
command: '…/out/Release/node …/test/fixtures/typescript/mts/test-import-module.mts'
}
Node.js v26.0.0-pre|
@aduh95 Hi, I tested with Details=== release test-compile-cache-typescript-commonjs === Path: parallel/test-compile-cache-typescript-commonjs [process 7062]: --- stderr --- [compile cache] resolved path /Users/y-okt/ghq/github.com/y-okt/node/test/.tmp.390/.compile_cache_dir + v26.0.0-pre-arm64-2cc2566e-501 -> /Users/y-okt/ghq/github.com/y-okt/node/test/.tmp.390/.compile_cache_dir/v26.0.0-pre-arm64-2cc2566e-501 [compile cache] creating cache directory /Users/y-okt/ghq/github.com/y-okt/node/test/.tmp.390/.compile_cache_dir/v26.0.0-pre-arm64-2cc2566e-501...success [compile cache] reading cache from /Users/y-okt/ghq/github.com/y-okt/node/test/.tmp.390/.compile_cache_dir/v26.0.0-pre-arm64-2cc2566e-501/75e66346 for CommonJS /Users/y-okt/ghq/github.com/y-okt/node/test/fixtures/typescript/cts/test-require-commonjs.cts... no such file or directory [compile cache] reading cache from /Users/y-okt/ghq/github.com/y-okt/node/test/.tmp.390/.compile_cache_dir/v26.0.0-pre-arm64-2cc2566e-501/91185ffe for ESM file:///Users/y-okt/ghq/github.com/y-okt/node/test/fixtures/typescript/cts/test-require-commonjs.cts... no such file or directory /Users/y-okt/ghq/github.com/y-okt/node/test/fixtures/typescript/cts/test-require-commonjs.cts:3 interface Foo {}; ^^^ SyntaxError: Unexpected identifier 'Foo' Node.js v26.0.0-pre [process 7062]: --- stdout --- [process 7062]: status = 1, signal = null Error: - process terminated with status 1, expected 0 Node.js v26.0.0-pre === release test-compile-cache-typescript-esm === TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".mts" for /Users/y-okt/ghq/github.com/y-okt/node/test/fixtures/typescript/mts/test-import-module.mts Node.js v26.0.0-pre [process 7065]: --- stdout --- [process 7065]: status = 1, signal = null Error: - process terminated with status 1, expected 0 Node.js v26.0.0-pre |
|
They are failing because of the lack of Amaro. My guess is that because you used |
When compiled without amaro, this conflicts with --experimental-strip-types defaulting to true. To avoid that, we need to skip relevant failing tests. Fixes: nodejs#60640
stripe-types option's default value is true, but we need to ensure that when compiled without amaro, the default vaue is false. Fixes: nodejs#60640
Move the amaro availability check immediately after importing common module in test files, as requested in PR feedback. Changes: - Place amaro check after common import but before other imports - Update test-node-output-sourcemaps.mjs to dynamically skip .ts tests based on file extension - Add individual skip conditions for TypeScript-specific tests - Fix linting errors (missing semicolon, line length issues) Refs: nodejs#60815
…ne pass fixed the test failure due to its changeable default value. Fixes: nodejs#60640
the default value of strip_types is controlled by node_options.h and we need to change the default value there Fixes: nodejs#60815
some tests are skipped although they aren't relevant to amaro. Fixes: nodejs#60815
to make the changes clear, remove unnecessary space changes Fixes: nodejs#60815
there are still some spacing diffs, and this addresses that Fixes: nodejs#60815
skip these as they are failing without amaro Fixes: nodejs#60815
a004bf5 to
c334402
Compare
|
@aduh95 Thank you, fixed the tests to skip when compiled without amaro. Could you please review again? |
aduh95
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All tests passed
|
Landed in d09c3ff |
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 PR-URL: #60815 Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
Summary
This PR is to address #60640 . When compiled without amaro, some tests fail. This is because
--strip-typesoption should default to false when compiled without amaro, but it is set to true now. As suggested by @marco-ippolito , this PR addresses this issue by--strip-typesto false ifHAVE_AMAROis not trueBackground
Amaro is a wrapper around
@swc/wasm-typescript, and is used internally in Node.js for Type Stripping. When compiled without amaro, Type Stripping functionalities are not available internally. However, because--strip-typesdefault value is true, some tests fail under that situation.The suggested fix is as aforementioned, 1) skip the failing tests when the option is false, and set its default value to false when compiled without amaro.
Regarding the failing tests, the list below is the full list of the failing tests due to Amaro. When running with amaro, all the tests passed, and when running without amaro, the tests below failed, meaning that test failures are attributed to the existence of amaro.
Also, I confirmed that these tests are failing not due to flakiness, but amaro. Most of the failures were with the
Error [ERR_NO_TYPESCRIPT]: Node.js is not compiled with TypeScript supporterror message. For the files which don't have this error message, the reason it's relevant to amaro is written below respectively.List of failing tests when compiled without amaro:
file.test.tsNote that the environment in which this was confirmed is M4 Mac and OS is Sequoia 15.3.2.