Skip to content

Commit

Permalink
Fix vitest esm error with @Security guard
Browse files Browse the repository at this point in the history
Without this change, using vitest with "esm": true for routes config and an @Security guarded endpoint led to an error "... is not a constructor" or infinite running tests.

Bug related to es-shims/Promise.allSettled#5 (comment)
  • Loading branch information
lokmeinmatz committed Oct 24, 2022
1 parent 52f1a21 commit bc7c037
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ In situations where the code is very hard to extend, we may want to refactor mod
## Contributing bug fixes

Your pull request should include a link to the bug that you are fixing. If you've submitted a PR for a bug, please post a comment in the bug to avoid duplication of effort.

## Contributing features

Features (things that add new or improved functionality to tsoa) may be accepted, but will need to **first** be approved by having the (["help wanted" label](https://github.com/lukeautry/tsoa/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) by a tsoa project maintainer) in the suggestion issue.
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/routeGeneration/templates/express.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export function RegisterRoutes(app: express.Router) {
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

try {
request['user'] = await promiseAny(secMethodOrPromises);
request['user'] = await promiseAny.call(Promise, secMethodOrPromises);
next();
}
catch(err) {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/routeGeneration/templates/hapi.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export function RegisterRoutes(server: any) {
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

try {
request['user'] = await promiseAny(secMethodOrPromises);
request['user'] = await promiseAny.call(Promise, secMethodOrPromises);
return request['user'];
}
catch(err) {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/routeGeneration/templates/koa.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export function RegisterRoutes(router: KoaRouter) {

let success;
try {
const user = await promiseAny(secMethodOrPromises);
const user = await promiseAny.call(Promise, secMethodOrPromises);
success = true;
context.request['user'] = user;
}
Expand Down

0 comments on commit bc7c037

Please sign in to comment.