diff --git a/lib/index.coffee b/lib/index.coffee index d9bc1f8..532001e 100644 --- a/lib/index.coffee +++ b/lib/index.coffee @@ -21,7 +21,7 @@ turnoutMiddleware= (options={})-> res.end html .catch (error)-> res.status 403 - res.end error.toString() + res.end error.message ? error router diff --git a/lib/turnout.coffee b/lib/turnout.coffee index 621ec24..c5d3f34 100644 --- a/lib/turnout.coffee +++ b/lib/turnout.coffee @@ -13,7 +13,7 @@ class Turnout @options.blacklist?= [] @options.whitelist?= [] - @options.timeout?= 2000 + @options.timeout?= 3000 @options.eventName?= 'expressTurnoutRendered' debug 'new Turnout',@options @@ -60,8 +60,8 @@ class Turnout debug 'Execute '+script exec script,(error,stdout)-> - resolve stdout unless error? - reject error if error? + resolve stdout.trim() unless error? + reject stdout.trim() if error? getUri: (req)-> uri= req.protocol+'://'+req.get('host')+req.originalUrl diff --git a/package.json b/package.json index 53ae125..74d68c5 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "scripts": { "postinstall": "coffee -o src -c lib", - "test": "jasminetea test --verbose --cover --report --lint --timeout 2500" + "test": "jasminetea test --verbose --cover --report --lint --timeout 3500" }, "dependencies": { diff --git a/test/options.spec.coffee b/test/options.spec.coffee index 5c6e4eb..123a387 100644 --- a/test/options.spec.coffee +++ b/test/options.spec.coffee @@ -149,7 +149,7 @@ describe 'Options',-> .spread (response)-> expect(response.statusCode).toBe 403 expect(response.headers['x-powered-by']).toBe 'Express-turnout' - expect(response.body).toBe 'Timeout' + expect(response.body).toBe 'Timeout by 1ms' done()