mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-01-27 22:59:51 -05:00
(test): Fix mocha debug mode for > Node 7
This commit is contained in:
parent
0651c20990
commit
15c6cb09fd
1 changed files with 21 additions and 16 deletions
|
@ -2,39 +2,44 @@
|
||||||
|
|
||||||
const fork = require('child_process').fork;
|
const fork = require('child_process').fork;
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const rimraf = require('rimraf');
|
const rimRaf = require('rimraf');
|
||||||
const Server = require('./server');
|
const Server = require('./server');
|
||||||
|
|
||||||
const forks = process.forks = [];
|
const forks = process.forks = [];
|
||||||
process.server = Server('http://localhost:55551/');
|
process.server = new Server('http://localhost:55551/');
|
||||||
process.server2 = Server('http://localhost:55552/');
|
process.server2 = new Server('http://localhost:55552/');
|
||||||
process.server3 = Server('http://localhost:55553/');
|
process.server3 = new Server('http://localhost:55553/');
|
||||||
process.express = express();
|
process.express = express();
|
||||||
process.express.listen(55550);
|
process.express.listen(55550);
|
||||||
|
|
||||||
module.exports.start = function(dir, conf) {
|
module.exports.start = function(dir, conf) {
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
rimraf(__dirname + '/../' + dir, function() {
|
rimRaf(__dirname + '/../' + dir, function() {
|
||||||
// filter out --debug-brk
|
const filteredArguments = process.execArgv = process.execArgv.filter(function(x) {
|
||||||
let oldArgv = process.execArgv;
|
// filter out --debug-brk and --inspect-brk since Node7
|
||||||
process.execArgv = process.execArgv.filter(function(x) {
|
return (x.indexOf('--debug-brk') === -1 && x.indexOf('--inspect-brk') === -1);
|
||||||
return x !== '--debug-brk';
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const f = fork(__dirname + '/../../../bin/verdaccio'
|
const childFork = fork(__dirname + '/../../../bin/verdaccio',
|
||||||
, ['-c', __dirname + '/../' + conf]
|
['-c', __dirname + '/../' + conf],
|
||||||
, {silent: !process.env.TRAVIS}
|
{
|
||||||
|
silent: !process.env.TRAVIS
|
||||||
|
}
|
||||||
);
|
);
|
||||||
forks.push(f);
|
|
||||||
f.on('message', function(msg) {
|
forks.push(childFork);
|
||||||
|
|
||||||
|
childFork.on('message', function(msg) {
|
||||||
if ('verdaccio_started' in msg) {
|
if ('verdaccio_started' in msg) {
|
||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
f.on('error', function(err) {
|
|
||||||
|
childFork.on('error', function(err) {
|
||||||
reject(err);
|
reject(err);
|
||||||
});
|
});
|
||||||
process.execArgv = oldArgv;
|
|
||||||
|
process.execArgv = filteredArguments;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue