From b85ca3caa3c68e18f7ce6954cc85e90a9d33efef Mon Sep 17 00:00:00 2001 From: Unitech Date: Fri, 11 May 2018 18:36:55 +0200 Subject: [PATCH] test: refactor before/after --- test/programmatic/custom_action.mocha.js | 12 ++++-------- test/programmatic/id.mocha.js | 14 +++----------- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/test/programmatic/custom_action.mocha.js b/test/programmatic/custom_action.mocha.js index 9de735f8e..6df8aaf3c 100644 --- a/test/programmatic/custom_action.mocha.js +++ b/test/programmatic/custom_action.mocha.js @@ -5,16 +5,12 @@ var pm2 = require('../..'); var should = require('should'); describe('Custom actions via CLI/API', function() { - after(function(done) { - pm2.kill(done); + before(function(done) { + pm2.delete('all', function() { done() }); }); - before(function(done) { - pm2.connect(function() { - pm2.kill(function() { - pm2.connect(done); - }) - }); + after(function(done) { + pm2.delete('all', function() { done() }); }); it('should start custom action script', function(done) { diff --git a/test/programmatic/id.mocha.js b/test/programmatic/id.mocha.js index f792e7ef0..1d879859d 100644 --- a/test/programmatic/id.mocha.js +++ b/test/programmatic/id.mocha.js @@ -10,11 +10,11 @@ describe('Unique ID verification', function() { var _id = null before(function(done) { - PM2.kill(done); + PM2.delete('all', function() { done() }); }); - it('should connect to PM2', function(done) { - PM2.connect(done); + after(function(done) { + PM2.delete('all', function() { done() }); }); it('should start a script', function(done) { @@ -78,13 +78,5 @@ describe('Unique ID verification', function() { }); }); }); - - after(function(done) { - PM2.delete('all', done); - }); - - after(function(done) { - PM2.kill(done); - }); }); });