Fixed timing-dependent unit-tests failures
DebuggerAgent.resume unit-test should pass `done` as the callback function, otherwise other tests may run before this one is finished. Fixed launcher so that it runs the test callback only once, instead of everytime a `break` event is emitted.
This commit is contained in:
Родитель
fe2cc2f895
Коммит
1acbd00471
|
@ -227,10 +227,8 @@ describe('DebuggerAgent', function() {
|
|||
before(setupDebugScenario);
|
||||
|
||||
it('does not throw an error', function(done) {
|
||||
expect(function () { agent.resume(); })
|
||||
expect(function () { agent.resume({}, done); })
|
||||
.to.not.throw();
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
var debuggerClient, agent;
|
||||
|
@ -238,7 +236,15 @@ describe('DebuggerAgent', function() {
|
|||
function setupDebugScenario(done) {
|
||||
launcher.runOnBreakInFunction(function(client) {
|
||||
debuggerClient = client;
|
||||
agent = new DebuggerAgent({}, null, debuggerClient, null, null);
|
||||
var frontEndClientStub = {
|
||||
sendEvent: function() {}
|
||||
};
|
||||
agent = new DebuggerAgent(
|
||||
{},
|
||||
frontEndClientStub,
|
||||
debuggerClient,
|
||||
null, // BreakEventHandler
|
||||
null); // ScripManager
|
||||
done();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ function startDebugger(scriptPath, done) {
|
|||
function runOnBreakInFunction(test) {
|
||||
stopAllDebuggers();
|
||||
startDebugger('BreakInFunction.js', function(childProcess, debuggerClient) {
|
||||
debuggerClient.on('break', function() {
|
||||
debuggerClient.once('break', function() {
|
||||
test(debuggerClient);
|
||||
});
|
||||
childProcess.stdin.write('go!\n');
|
||||
|
@ -55,7 +55,7 @@ function runOnBreakInFunction(test) {
|
|||
function runInspectObject(test) {
|
||||
stopAllDebuggers();
|
||||
startDebugger('InspectObject.js', function(childProcess, debuggerClient) {
|
||||
debuggerClient.on('break', function() {
|
||||
debuggerClient.once('break', function() {
|
||||
debuggerClient.fetchObjectId(
|
||||
debuggerClient,
|
||||
'inspectedObject',
|
||||
|
|
Загрузка…
Ссылка в новой задаче