Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cb0b4a6

Browse filesBrowse files
committed
test: add test for debugging one line files
This commit adds a regression test for debugging of single line files. Refs: #4297 PR-URL: #4298 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
1 parent 2a60e2a commit cb0b4a6
Copy full SHA for cb0b4a6

File tree

Expand file treeCollapse file tree

2 files changed

+19
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+19
-0
lines changed
Open diff view settings
Collapse file
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = function foo(arg) { return arg; }
Collapse file

‎test/parallel/test-vm-debug-context.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-vm-debug-context.js
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,24 @@ assert.strictEqual(vm.runInDebugContext(undefined), undefined);
5353
assert.equal(breaks, 1);
5454
})();
5555

56+
// Can set listeners and breakpoints on a single line file
57+
(function() {
58+
const Debug = vm.runInDebugContext('Debug');
59+
const fn = require(common.fixturesDir + '/exports-function-with-param');
60+
let called = false;
61+
62+
Debug.setListener(function(event, state, data) {
63+
if (data.constructor.name === 'BreakEvent') {
64+
called = true;
65+
}
66+
});
67+
68+
Debug.setBreakPoint(fn);
69+
fn('foo');
70+
assert.strictEqual(Debug.showBreakPoints(fn), '(arg) { [B0]return arg; }');
71+
assert.strictEqual(called, true);
72+
})();
73+
5674
// See https://github.com/nodejs/node/issues/1190, fatal errors should not
5775
// crash the process.
5876
var script = common.fixturesDir + '/vm-run-in-debug-context.js';

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.