Nestjs Testing
ASecurityOverride the guard in the E2E testing module with a typed pass-through implementation: ```ts const moduleRef = await Test.createTestingModule({ imports: [AppModule], }) .overrideGuard(AuthGuard) .useValue({ canActivate: () => true }) .compile(); ``` If the application uses a global `APP_GUARD`, override that concrete guard/provider (or configure the test module with the same token) rather than assuming a route-level override is enough. Keep the real database for E2E tests, initialize/close th...
- 584 stars
- 0 votes
- 0 copies
- 2 views
- Added September 5, 2026
Security analysis
100/100Pro scans all 11 files and shows the line behind each finding
npx -y skills add HoangNguyen0403/agent-skills-standard --skill nestjs-testing --agent claude-codeAre you the author of Nestjs Testing?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/hoangnguyen0403-nestjs-testing-ee4660e6)Override the guard in the E2E testing module with a typed pass-through implementation:
```ts
const moduleRef = await Test.createTestingModule({
imports: [AppModule],
})
.overrideGuard(AuthGuard)
.useValue({ canActivate: () => true })
.compile();
```
If the application uses a global `APP_GUARD`, override that concrete guard/provider (or configure the test module with the same token) rather than assuming a route-level override is enough. Keep the real database for E2E tests, initialize/close the app in lifecycle hooks, and restore the guard behavior in tests that specifically exercise authorization.
Files in this skill
- eval-1.baseline.md
- eval-1.with-skill.md
- eval-2.baseline.md
- eval-2.with-skill.md
- eval-3.baseline.md
- eval-3.with-skill.md
- trigger-1.md
- trigger-2.md
- trigger-3.md
- trigger-4.md
Attribution
Related skills
View all in development →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.