Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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>
  • Loading branch information
cjihrig authored and Myles Borins committed Jan 21, 2016
commit 1f8e1472cc2165f0db7d74152e8884ac401cd628
1 change: 1 addition & 0 deletions test/fixtures/exports-function-with-param.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = function foo(arg) { return arg; }
18 changes: 18 additions & 0 deletions test/parallel/test-vm-debug-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,24 @@ assert.strictEqual(vm.runInDebugContext(undefined), undefined);
assert.equal(breaks, 1);
})();

// Can set listeners and breakpoints on a single line file
(function() {
const Debug = vm.runInDebugContext('Debug');
const fn = require(common.fixturesDir + '/exports-function-with-param');
let called = false;

Debug.setListener(function(event, state, data) {
if (data.constructor.name === 'BreakEvent') {
called = true;
}
});

Debug.setBreakPoint(fn);
fn('foo');
assert.strictEqual(Debug.showBreakPoints(fn), '(arg) { [B0]return arg; }');
assert.strictEqual(called, true);
})();

// See https://github.com/nodejs/node/issues/1190, fatal errors should not
// crash the process.
var script = common.fixturesDir + '/vm-run-in-debug-context.js';
Expand Down