| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 59805f6 commit 362135a
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1469,6 +1469,7 @@ void ContextifyContext::ContainsModuleSyntax( | |||
| 1469 | 1469 | String::NewFromUtf8(isolate, "__dirname").ToLocalChecked()}; | |
| 1470 | 1470 | ||
| 1471 | 1471 | TryCatchScope try_catch(env); | |
| 1472 | + ShouldNotAbortOnUncaughtScope no_abort_scope(env); | ||
| 1472 | 1473 | ||
| 1473 | 1474 | ContextifyContext::CompileFunctionAndCacheResult(env, | |
| 1474 | 1475 | context, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -235,3 +235,23 @@ describe('--experimental-detect-module', { concurrency: true }, () => { | |||
| 235 | 235 | } | |
| 236 | 236 | }); | |
| 237 | 237 | }); | |
| 238 | + | ||
| 239 | + // Validate temporarily disabling `--abort-on-uncaught-exception` | ||
| 240 | + // while running `containsModuleSyntax`. | ||
| 241 | + // Ref: https://github.com/nodejs/node/issues/50878 | ||
| 242 | + describe('Wrapping a `require` of an ES module while using `--abort-on-uncaught-exception`', () => { | ||
| 243 | + it('should work', async () => { | ||
| 244 | + const { code, signal, stdout, stderr } = await spawnPromisified(process.execPath, [ | ||
| 245 | + '--abort-on-uncaught-exception', | ||
| 246 | + '--eval', | ||
| 247 | + 'assert.throws(() => require("./package-type-module/esm.js"), { code: "ERR_REQUIRE_ESM" })', | ||
| 248 | + ], { | ||
| 249 | + cwd: fixtures.path('es-modules'), | ||
| 250 | + }); | ||
| 251 | + | ||
| 252 | + strictEqual(stderr, ''); | ||
| 253 | + strictEqual(stdout, ''); | ||
| 254 | + strictEqual(code, 0); | ||
| 255 | + strictEqual(signal, null); | ||
| 256 | + }); | ||
| 257 | + }); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments