From 1aabf7ef40dfdc4639bb281d3413eb942f495c85 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Sat, 18 Aug 2018 21:12:55 +0530 Subject: [PATCH] tests: increase mocha timeout to let server start --- frappe.conf.js | 18 ++++++++++++++++++ package.json | 2 +- tests/test_restAPI.js | 6 ++---- 3 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 frappe.conf.js diff --git a/frappe.conf.js b/frappe.conf.js new file mode 100644 index 00000000..6e8c002f --- /dev/null +++ b/frappe.conf.js @@ -0,0 +1,18 @@ + +module.exports = { + staticPath: './static', + distPath: './dist', + dev: { + outputDir: './dist', + assetsPublicPath: '/', + devServerPort: 8000, + env: { + PORT: process.env.PORT || 8000 + } + }, + node: { + paths: { + main: 'server/index.js' + } + } +} \ No newline at end of file diff --git a/package.json b/package.json index 6c0054b3..84c855c6 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "frappe": "cli.js" }, "scripts": { - "test": "mocha tests", + "test": "NODE_ENV=test mocha --timeout 3000 tests", "start": "nodemon app.js" }, "dependencies": { diff --git a/tests/test_restAPI.js b/tests/test_restAPI.js index 2416d1c2..6ada5e75 100644 --- a/tests/test_restAPI.js +++ b/tests/test_restAPI.js @@ -11,9 +11,7 @@ var test_server; describe('REST', () => { before(async function() { - test_server = spawn('node', ['tests/test_server.js'], { - stdio: [process.stdin, process.stdout, process.stderr, 'pipe', 'pipe'] - }); + test_server = spawn('node', ['tests/test_server.js'], { stdio: 'inherit' }); await frappe.init(); await frappe.login('Administrator'); @@ -22,7 +20,7 @@ describe('REST', () => { frappe.fetch = fetch; // wait for server to start - await frappe.sleep(1); + return await frappe.sleep(2); }); after(() => {