Commit 931addb
src: fix ^ in stack trace with vm's columnOffset
While VM module's columnOffset option does succeed in applying an offset
to the column number in the stack trace, the wavy diagram printed does
not account for potential offsets, resulting in erroneous location of
`^` in the first line of the script.
Before:
```
> vm.runInThisContext('throw new Error()', { columnOffset: 5 })
evalmachine.<anonymous>:1
throw new Error()
^
Error
at evalmachine.<anonymous>:1:12
at ContextifyScript.Script.runInThisContext (vm.js:44:33)
at Object.runInThisContext (vm.js:116:38)
```
After:
```
> vm.runInThisContext('throw new Error()', { columnOffset: 5 })
evalmachine.<anonymous>:1
throw new Error()
^
Error
at evalmachine.<anonymous>:1:12
at ContextifyScript.Script.runInThisContext (vm.js:50:33)
at Object.runInThisContext (vm.js:139:38)
at repl:1:4
```
PR-URL: #15771
Refs: jsdom/jsdom#2003
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>1 parent eaec35d commit 931addbCopy full SHA for 931addb
File tree
Expand file treeCollapse file tree
2 files changed
+12
-2
lines changedOpen diff view settings
Filter options
- src
- test/parallel
Expand file treeCollapse file tree
2 files changed
+12
-2
lines changedOpen diff view settings
Collapse file
+9Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1585 | 1585 | |
1586 | 1586 | |
1587 | 1587 | |
| 1588 | + |
1588 | 1589 | |
1589 | 1590 | |
1590 | 1591 | |
| ||
1613 | 1614 | |
1614 | 1615 | |
1615 | 1616 | |
| 1617 | + |
| 1618 | + |
| 1619 | + |
1616 | 1620 | |
1617 | 1621 | |
| 1622 | + |
| 1623 | + |
| 1624 | + |
| 1625 | + |
| 1626 | + |
1618 | 1627 | |
1619 | 1628 | |
1620 | 1629 | |
|
Collapse file
test/parallel/test-vm-context.js
Copy file name to clipboardExpand all lines: test/parallel/test-vm-context.js+3-2Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
72 | 72 | |
73 | 73 | |
74 | 74 | |
75 | | - |
| 75 | + |
76 | 76 | |
77 | 77 | |
78 | 78 | |
79 | 79 | |
80 | 80 | |
81 | | - |
| 81 | + |
| 82 | + |
82 | 83 | |
83 | 84 | |
84 | 85 | |
|
0 commit comments