gr2m / hapi-cors-headers

hapi extension to enable CORS
MIT License
28 stars 11 forks source link

Fixed a trouble with incorrect reply #22

Open TngSam opened 5 years ago

TngSam commented 5 years ago

The reply calls a function when continue is a Symbol. This leads to errors.

ci-reporter[bot] commented 5 years ago

The build is failing

✨ Good work on this PR so far! ✨ Unfortunately, the Travis CI build is failing as of 2dd57b71642d59424e4dc416ad6ff8cf6e2adef7. Here's the output:

npm test
> hapi-cors-headers@ pretest /home/travis/build/gr2m/hapi-cors-headers
> standard

> hapi-cors-headers@ test /home/travis/build/gr2m/hapi-cors-headers
> tap --100 --coverage tests

tests/index.js ...................................... 14/18
  request.headers.origin is undefined
  not ok reply.continue called
    +++ found                                                           
    --- wanted                                                          
    -true                                                               
    +false                                                              
    compare: ===
    at:
      line: 1
      column: 5409
      file: tests/index.js
      type: Test
    stack: >
      Test.<anonymous> (tests/index.js:1:5409)

      Object.<anonymous> (tests/index.js:1:4954)

      Module.replacementCompile
      (node_modules/nyc/node_modules/append-transform/index.js:58:13)

      module.exports
      (node_modules/nyc/node_modules/default-require-extensions/js.js:8:9)

      Object.<anonymous>
      (node_modules/nyc/node_modules/append-transform/index.js:62:4)

      Object.<anonymous> (node_modules/nyc/bin/wrap.js:23:4)
    source: >
      (function (exports, require, module, __filename, __dirname) { var test =
      require('tap').test

  request is boom error
  not ok reply.continue called
    +++ found                                                           
    --- wanted                                                          
    -true                                                               
    +false                                                              
    compare: ===
    at:
      line: 1
      column: 6339
      file: tests/index.js
      type: Test
    stack: >
      Test.<anonymous> (tests/index.js:1:6339)

      Object.<anonymous> (tests/index.js:1:5517)

      Module.replacementCompile
      (node_modules/nyc/node_modules/append-transform/index.js:58:13)

      module.exports
      (node_modules/nyc/node_modules/default-require-extensions/js.js:8:9)

      Object.<anonymous>
      (node_modules/nyc/node_modules/append-transform/index.js:62:4)

      Object.<anonymous> (node_modules/nyc/bin/wrap.js:23:4)
    source: >
      (function (exports, require, module, __filename, __dirname) { var test =
      require('tap').test

  options request without acces-control-request headers
  not ok reply.continue called
    +++ found                                                           
    --- wanted                                                          
    -true                                                               
    +false                                                              
    compare: ===
    at:
      line: 1
      column: 7561
      file: tests/index.js
      type: Test
    stack: >
      Test.<anonymous> (tests/index.js:1:7561)

      Object.<anonymous> (tests/indeunction (exports, require, module, __filename, __dirname) { var test =
      require('tap').test

total ............................................... 14/18

  14 passing (893.036ms)
  4 failing

ERROR: Coverage for lines (93.75%) does not meet global threshold (100%)
ERROR: Coverage for functions (55.56%) does not meet global threshold (100%)
ERROR: Coverage for statements (93.75%) does not meet global threshold (100%)
-------------------------|----------|----------|----------|----------|-------------------|
File                     |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
-------------------------|----------|----------|----------|----------|-------------------|
All files                |    93.75 |      100 |    55.56 |    93.75 |                   |
 hapi-cors-headers       |      100 |      100 |      100 |      100 |                   |
  index.js               |      100 |      100 |      100 |      100 |                   |
 hapi-cors-headers/tests |    91.67 |      100 |       50 |    91.67 |                   |
  index.js               |    91.67 |      100 |       50 |    91.67 |       11,36,61,89 |
-------------------------|----------|----------|----------|----------|-------------------|

I'm sure you can fix it! If you need help, don't hesitate to ask a maintainer of the project!


Failed build for a63ed3d ##### `npm test` ``` > hapi-cors-headers@ pretest /home/travis/build/gr2m/hapi-cors-headers > standard standard: Use JavaScript Standard Style (https://standardjs.com) /home/travis/build/gr2m/hapi-cors-headers/index.js:29:3: Expected an assignment or function call and instead saw an expression. ```

This comment was automagically generated by ci-reporter. If you see a problem, open an issue here.
gr2m commented 5 years ago

What hapi version are you using? Might this be a recent change?

TngSam commented 5 years ago

What hapi version are you using? Might this be a recent change?

I'm using version 17.8.1 and I think you're absolutely right, it might be new changes. Also I want to amend my recent pull request, because it contains a typo. Sorry. I ran into this problem 6 days ago. Console told me something like 'reply.continue is not a function'. Thank you for your reply! :)

gr2m commented 5 years ago

Can you research what the reply.continue() alternative is then in the latest version? I’d like it to be compatible with both

TngSam commented 5 years ago

Can you research what the reply.continue() alternative is then in the latest version? I’d like it to be compatible with both

OK!

gr2m commented 5 years ago

See also https://github.com/gr2m/hapi-cors-headers/pull/23