I want to just make sure that my server is running before I create PR's locally to test that nothing is broken.
server.js
My server exports a promise
module.exports = Promise.all([
hbsPartialsLoaded,
])
.then(() => {
let server;
if (!isTestEnvironment) {
server = app.listen(config.port);
}
return { server, app };
});
tests
let { expect, request } = require('chai')
.use(require('chai-http'))
.use(require('chai-cheerio'));
const config = require('../../app/config');
const sever = require('../../app/sever');
describe('server response', function () {
return new Promise((resolve, reject) => {
sever.then(() => {
console.info(arguments);
resolve();
})
})
});
Running Tests
NODE_ENV=test mocha --timeout 20000 --recursive test/ --compilers js:babel-core/register
0 passing (1ms)
My tests are never run. How can I get it so I wait for sever.js
to finish its promises before the tests are run?
via Jamie Hutber
No comments:
Post a Comment