Fix leak warnings in tests, use mongodb-runner from node_modules
This commit is contained in:
@@ -59,7 +59,7 @@
|
|||||||
"build": "./node_modules/.bin/babel src/ -d lib/",
|
"build": "./node_modules/.bin/babel src/ -d lib/",
|
||||||
"pretest": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=3.0.8} ./node_modules/.bin/mongodb-runner start",
|
"pretest": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=3.0.8} ./node_modules/.bin/mongodb-runner start",
|
||||||
"test": "cross-env NODE_ENV=test TESTING=1 ./node_modules/.bin/babel-node $COVERAGE_OPTION ./node_modules/jasmine/bin/jasmine.js",
|
"test": "cross-env NODE_ENV=test TESTING=1 ./node_modules/.bin/babel-node $COVERAGE_OPTION ./node_modules/jasmine/bin/jasmine.js",
|
||||||
"posttest": "mongodb-runner stop",
|
"posttest": "./node_modules/.bin/mongodb-runner stop",
|
||||||
"coverage": "cross-env COVERAGE_OPTION='./node_modules/babel-istanbul/lib/cli.js cover -x **/spec/**' npm test",
|
"coverage": "cross-env COVERAGE_OPTION='./node_modules/babel-istanbul/lib/cli.js cover -x **/spec/**' npm test",
|
||||||
"start": "node ./bin/parse-server",
|
"start": "node ./bin/parse-server",
|
||||||
"prepublish": "npm run build"
|
"prepublish": "npm run build"
|
||||||
|
|||||||
21
src/index.js
21
src/index.js
@@ -232,15 +232,18 @@ function ParseServer({
|
|||||||
|
|
||||||
api.use(middlewares.handleParseErrors);
|
api.use(middlewares.handleParseErrors);
|
||||||
|
|
||||||
process.on('uncaughtException', (err) => {
|
//This causes tests to spew some useless warnings, so disable in test
|
||||||
if( err.code === "EADDRINUSE" ) { // user-friendly message for this common error
|
if (!process.env.TESTING) {
|
||||||
console.log(`Unable to listen on port ${err.port}. The port is already in use.`);
|
process.on('uncaughtException', (err) => {
|
||||||
process.exit(0);
|
if( err.code === "EADDRINUSE" ) { // user-friendly message for this common error
|
||||||
}
|
console.log(`Unable to listen on port ${err.port}. The port is already in use.`);
|
||||||
else {
|
process.exit(0);
|
||||||
throw err;
|
}
|
||||||
}
|
else {
|
||||||
});
|
throw err;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
hooksController.load();
|
hooksController.load();
|
||||||
|
|
||||||
return api;
|
return api;
|
||||||
|
|||||||
Reference in New Issue
Block a user