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 21, 2022
1 parent 52f1a21 commit 55059f3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
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 55059f3

Please sign in to comment.