@@ -71,9 +71,6 @@ def _graal_nodejs_post_gate_runner(args, tasks):
7171 npm (['--scripts-prepend-node-path=auto' , 'test' ] + commonArgs + testArgs , cwd = unitTestDir )
7272 if mx .suite ('wasm' , fatalIfMissing = False ):
7373 npm (['--scripts-prepend-node-path=auto' , 'run' , 'testwasm' ] + commonArgs + testArgs , cwd = unitTestDir )
74- # test that WebAssembly can be enabled using env. variables
75- _setEnvVar ('NODE_OPTIONS' , '--polyglot' )
76- _setEnvVar ('NODE_POLYGLOT_OPTIONS' , '--js.webassembly --experimental-options' )
7774 node (commonArgs + ['-e' , 'console.log(WebAssembly)' ])
7875 # check that fetch API is available when WebAssembly is available
7976 node (commonArgs + ['-e' , 'FormData' ])
@@ -88,8 +85,17 @@ def _graal_nodejs_post_gate_runner(args, tasks):
8885 ]
8986 for test in wasm_tests :
9087 node (commonArgs + [join (_suite .dir , 'test' , 'parallel' , test )])
91- _setEnvVar ('NODE_OPTIONS' , '' )
88+
89+ # test that WebAssembly can be disabled using env. variables
90+ _setEnvVar ('NODE_POLYGLOT_OPTIONS' , '--js.webassembly=false --experimental-options' )
91+ out = mx .OutputCapture ()
92+ node (commonArgs + ['-p' , 'try { WebAssembly; } catch (e) { e.toString(); }' ], out = out )
93+ assert out .data .strip () == "ReferenceError: WebAssembly is not defined" , out .data
9294 _setEnvVar ('NODE_POLYGLOT_OPTIONS' , '' )
95+ else :
96+ out = mx .OutputCapture ()
97+ node (commonArgs + ['-p' , 'try { WebAssembly; } catch (e) { e.toString(); }' ], out = out )
98+ assert out .data .strip () == "ReferenceError: WebAssembly is not defined" , out .data
9399
94100 mx_gate .make_test_report (jsonResultsFile , task = t .title )
95101 finally :
0 commit comments