1

I wrote RestAPI TEST with frisby.js.

If Test result is True, There is no probrem. But If Test result is False, Frisby doesn't report correctly on Linux.(report correctly on windows)

following are sample codes:

const frisby = require('frisby');
const Joi = frisby.Joi;

describe('TEST', () => {
  it ('should return a status of 200', (done) =>{
    frisby
      .get('https://jsonfeed.org/feed.json')
      .expect('status', 400) //deliberately error
      .done(done);
  });
});

If this spec.js run on Windows, result is below

> jasmine-node .
F

Failures:
1) TEST should return a status of 200
 Message:
   Expected 'AssertionError: HTTP status 400 !== 200
  at FrisbySpec.status ([mydirpath]\expects.js:25:12)
  (snip)

But, If spec.js run on Linux(Ubuntu), result is below

(node:28704) UnhandledPromiseRejectionWarning: AssertionError [ERR_ASSERTION]: HTTP status 400 !== 200
    at FrisbySpec.status (/home/nsco/jen_work/frisby/node_modules/frisby/src/frisby/expects.js:25:12)
    at FrisbySpec._addExpect.response (/home/nsco/jen_work/frisby/node_modules/frisby/src/frisby/spec.js:368:23)
    at FrisbySpec._runExpects (/home/nsco/jen_work/frisby/node_modules/frisby/src/frisby/spec.js:260:24)
    at _fetch.fetch.then.then.responseBody (/home/nsco/jen_work/frisby/node_modules/frisby/src/frisby/spec.js:139:14)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:160:7)
(node:28704) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:28704) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
F

Failures:

  1) TEST should return a status of 200
   Message:
     timeout: timed out after 5000 msec waiting for spec to complete
   Stacktrace:
     undefined

"Failures:" section is displayed as "Timeout". (On windows, displayed as "Expected 'AssertionError: HTTP status 400 !== 200".It is correct.)

Environments:

  • frisby@2.0.11
  • jasmine-node@1.14.5
  • node/9.4.0
  • Ubuntu16.04
H.H
  • 364
  • 3
  • 11

0 Answers0