fix: log listening port, remove error (#21)

* fix: log listening port

* fix: remove empty line

* chore: remove unused error

* spacing, ey...

Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>
This commit is contained in:
Tom 2021-08-24 12:15:38 -05:00 committed by GitHub
parent 32bb55e7c4
commit be86d60221
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 9 deletions

View File

@ -49,11 +49,10 @@ module.exports = function (app) {
res.type('txt').send(data.toString()); res.type('txt').send(data.toString());
}); });
}); });
let error;
app.get('/_api/get-tests', cors(), function(req, res, next){ app.get('/_api/get-tests', cors(), function(req, res, next){
console.log(error); console.log('requested');
if(!error && process.env.NODE_ENV === 'test') return next(); if(process.env.NODE_ENV === 'test') return next();
res.json({status: 'unavailable'}); res.json({status: 'unavailable'});
}, },
function(req, res, next){ function(req, res, next){

View File

@ -47,17 +47,16 @@ app.use(function(req, res, next) {
}); });
//Start our server and tests! //Start our server and tests!
app.listen(process.env.PORT || 3000, function () { const listener = app.listen(process.env.PORT || 3000, function () {
console.log("Listening on port " + process.env.PORT); console.log('Your app is listening on port ' + listener.address().port);
if(process.env.NODE_ENV==='test') { if(process.env.NODE_ENV==='test') {
console.log('Running Tests...'); console.log('Running Tests...');
setTimeout(function () { setTimeout(function () {
try { try {
runner.run(); runner.run();
} catch(e) { } catch(e) {
let error = e; console.log('Tests are not valid:');
console.log('Tests are not valid:'); console.error(e);
console.log(error);
} }
}, 3500); }, 3500);
} }