cdimascio / generator-express-no-stress

🚂 A Yeoman generator for Express.js based 12-factor apps and apis
MIT License
595 stars 82 forks source link

OpenAPI v3 tests broken (on Node v15?) #58

Closed nbadal closed 3 years ago

nbadal commented 3 years ago

Generating a project with OpenAPI v3 creates tests that fail.

Steps:

  1. yo express-no-stress example
  2. Pick all defaults (including OpenAPI v3)
  3. cd example && npm test

Every request fails with:

{
  "errors": [
    {
      "path": ".headers",
      "message": "should have required property 'headers'",
      "errorCode": "required.openapi.validation"
    }
  ]
}
cdimascio commented 3 years ago

i just tried this with all defaults for both node 10 and 12. i'm not seeing this issue e.g.

➜ yo express-no-stress example
? App name [myapp] 
? App description [My cool app] 
? API Root [/api/v1] 
? Version [1.0.0] 
? OpenAPI spec version OpenApi 3
? Linter Prettier
➜ cd example && npm t   

> example@1.0.0 test /private/tmp/example
> mocha --require @babel/register --exit

{"level":30,"time":1604692481351,"pid":8385,"hostname":"3c22fba4b42e.ant.amazon.com","name":"example","msg":"up and running in development @: 3c22fba4b42e.ant.amazon.com on port: 3000}"}

  Examples
{"level":30,"time":1604692481395,"pid":8385,"hostname":"3c22fba4b42e.ant.amazon.com","name":"example","msg":"ExamplesService.all()"}
    ✓ should get all examples (52ms)
    ✓ should add a new example
{"level":30,"time":1604692481432,"pid":8385,"hostname":"3c22fba4b42e.ant.amazon.com","name":"example","msg":"ExamplesService.byId(2)"}
    ✓ should get an example by id

  3 passing (81ms)

which versions of node and yo are you using?

➜ yo --version
3.1.1 ➜ node -v v10.21.0

you might also uninstall/reinstall generator-express-no-stress or use yo to ensure you're at the latest

nbadal commented 3 years ago

I'm on node latest: 15.1.0 so that might be a good lead. Do you only support 10/12?

Reinstalling the templates made no difference. I'm also seeing this issue with the typescript version of the repo as well, fwiw.

cdimascio commented 3 years ago

yes. just verified that node 15 introduces the issue. will have a fix shortly

cdimascio commented 3 years ago

fixed in 10.2.2