diff --git a/test/nodes/core/core/20-inject_spec.js b/test/nodes/core/core/20-inject_spec.js index 111feae3a..7a9d424bd 100644 --- a/test/nodes/core/core/20-inject_spec.js +++ b/test/nodes/core/core/20-inject_spec.js @@ -21,7 +21,7 @@ var helper = require("node-red-node-test-helper"); describe('inject node', function() { - before(function(done) { + beforeEach(function(done) { Context.init({ contextStorage: { memory: { @@ -29,18 +29,19 @@ describe('inject node', function() { } } }); - Context.load(); - helper.startServer(done); + Context.load().then(function () { + helper.startServer(done); + }); }); - after(function(done) { - helper.stopServer(done); - }); - - afterEach(function() { - helper.unload(); - Context.clean({allNodes: {}}); - Context.close(); + afterEach(function(done) { + helper.unload().then(function () { + return Context.clean({allNodes: {}}); + }).then(function () { + return Context.close(); + }).then(function () { + helper.stopServer(done); + }); }); it('sets the value of flow context property', function (done) { diff --git a/test/nodes/core/core/89-trigger_spec.js b/test/nodes/core/core/89-trigger_spec.js index 1a6fa4ba8..4d83d1b68 100644 --- a/test/nodes/core/core/89-trigger_spec.js +++ b/test/nodes/core/core/89-trigger_spec.js @@ -31,14 +31,17 @@ describe('trigger node', function() { } } }); - Context.load(); - helper.startServer(done); + Context.load().then(function () { + helper.startServer(done); + }); }); afterEach(function(done) { - helper.unload().then(function() { - Context.clean({allNodes: {}}); - Context.close(); + helper.unload().then(function () { + return Context.clean({allNodes: {}}); + }).then(function () { + return Context.close(); + }).then(function () { helper.stopServer(done); }); }); diff --git a/test/nodes/core/logic/15-change_spec.js b/test/nodes/core/logic/15-change_spec.js index 6b98c697f..d002a266d 100644 --- a/test/nodes/core/logic/15-change_spec.js +++ b/test/nodes/core/logic/15-change_spec.js @@ -31,15 +31,19 @@ describe('change Node', function() { } } }); - Context.load(); - helper.startServer(done); + Context.load().then(function () { + helper.startServer(done); + }); }); afterEach(function(done) { - helper.unload(); - helper.stopServer(done); - Context.clean({allNodes:{}}); - Context.close(); + helper.unload().then(function () { + return Context.clean({allNodes: {}}); + }).then(function () { + return Context.close(); + }).then(function () { + helper.stopServer(done); + }); }); it('should load node with defaults', function(done) {