| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 4ed152e commit 5163757
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -56,10 +56,10 @@ try { | |||
| 56 | 56 | } catch (e) { | |
| 57 | 57 | gh1140Exception = e; | |
| 58 | 58 | assert.ok(/expected-filename/.test(e.stack), | |
| 59 | - 'expected appearance of filename in Error stack'); | ||
| 59 | + `expected appearance of filename in Error stack: ${e.stack}`); | ||
| 60 | 60 | } | |
| 61 | - assert.ok(gh1140Exception, | ||
| 62 | - 'expected exception from runInContext signature test'); | ||
| 61 | + // This is outside of catch block to confirm catch block ran. | ||
| 62 | + assert.strictEqual(gh1140Exception.toString(), 'Error'); | ||
| 63 | 63 | ||
| 64 | 64 | // GH-558, non-context argument segfaults / raises assertion | |
| 65 | 65 | const nonContextualSandboxErrorMsg = | |
@@ -90,18 +90,22 @@ Object.defineProperty(ctx, 'b', { configurable: false }); | |||
| 90 | 90 | ctx = vm.createContext(ctx); | |
| 91 | 91 | assert.strictEqual(script.runInContext(ctx), false); | |
| 92 | 92 | ||
| 93 | - // Error on the first line of a module should | ||
| 94 | - // have the correct line and column number | ||
| 95 | - assert.throws(() => { | ||
| 96 | - vm.runInContext(' throw new Error()', context, { | ||
| 97 | - filename: 'expected-filename.js', | ||
| 98 | - lineOffset: 32, | ||
| 99 | - columnOffset: 123 | ||
| 100 | - }); | ||
| 101 | - }, (err) => { | ||
| 102 | - return /^ \^/m.test(err.stack) && | ||
| 103 | - /expected-filename\.js:33:131/.test(err.stack); | ||
| 104 | - }, 'Expected appearance of proper offset in Error stack'); | ||
| 93 | + // Error on the first line of a module should have the correct line and column | ||
| 94 | + // number. | ||
| 95 | + { | ||
| 96 | + let stack = null; | ||
| 97 | + assert.throws(() => { | ||
| 98 | + vm.runInContext(' throw new Error()', context, { | ||
| 99 | + filename: 'expected-filename.js', | ||
| 100 | + lineOffset: 32, | ||
| 101 | + columnOffset: 123 | ||
| 102 | + }); | ||
| 103 | + }, (err) => { | ||
| 104 | + stack = err.stack; | ||
| 105 | + return /^ \^/m.test(stack) && | ||
| 106 | + /expected-filename\.js:33:131/.test(stack); | ||
| 107 | + }, `stack not formatted as expected: ${stack}`); | ||
| 108 | + } | ||
| 105 | 109 | ||
| 106 | 110 | // https://github.com/nodejs/node/issues/6158 | |
| 107 | 111 | ctx = new Proxy({}, {}); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments