Skip to content

Commit 45d2405

Browse files
committed
Fix tests
1 parent aa21833 commit 45d2405

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

test/injected-script-source.js renamed to test/next/injected-script-source.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
var expect = require('chai').expect;
2-
var debug = require('../')();
3-
var NODE_NEXT = require('../tools/NODE_NEXT.js');
4-
5-
if (!NODE_NEXT) return;
62

73
describe('InjectedScriptSource', function() {
4+
var debug = null;
5+
86
before(function() {
9-
debug.enableWebkitProtocol();
7+
debug = require('../../')();
8+
debug.enableWebkitProtocol();
109
});
1110

11+
after(function() { debug = null; });
12+
1213
it('isPrimitiveValue', function(done) {
1314
debug.registerAgentCommand('isPrimitiveValue', function(args, response, IScript, DScript) {
1415
expect(IScript.isPrimitiveValue(42)).to.be.equal(true);

test/injected-script.js renamed to test/next/injected-script.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
var expect = require('chai').expect;
22
var binary = require('node-pre-gyp');
33
var path = require('path');
4-
var binding_path = binary.find(path.resolve(path.join(__dirname,'../package.json')));
5-
var NODE_NEXT = require('../tools/NODE_NEXT.js');
6-
7-
if (!NODE_NEXT) return;
4+
var binding_path = binary.find(path.resolve(path.join(__dirname,'../../package.json')));
85

96
describe('binding', function() {
107
var binding = require(binding_path);

test/v8-debug.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
var expect = require('chai').expect,
2-
v8debug = require('../')();
1+
var expect = require('chai').expect;
32

43
var NODE_NEXT = require('../tools/NODE_NEXT');
54

@@ -10,13 +9,17 @@ _debugger.stderr.on('data', function(data) {
109
});
1110

1211
describe('v8-debug', function() {
12+
var v8debug = null;
13+
1314
before(function(done) {
14-
_debugger.stdout.on('data', function(data) {
15-
console.log(' ' + data);
15+
v8debug = require('../')()
16+
_debugger.stdout.once('data', function(data) {
1617
done();
1718
});
1819
});
1920

21+
after(function() { v8debug = null; });
22+
2023
describe('function `runInDebugContext`', function() {
2124
it('returns Debug object', function() {
2225
var Debug = v8debug.runInDebugContext('Debug');
@@ -55,8 +58,13 @@ describe('v8-debug', function() {
5558

5659
describe('events.', function() {
5760
it('Emits `close` on disconnect command', function(done) {
58-
v8debug.on('close', done);
61+
v8debug.once('close', done);
5962
v8debug.sendCommand('disconnect');
6063
});
6164
});
6265
});
66+
67+
if (NODE_NEXT) {
68+
require('./next/injected-script.js');
69+
require('./next/injected-script-source.js');
70+
}

0 commit comments

Comments
 (0)