@nestjs-yalc/jest
v1.3.3
Published
Jest helpers for YALC and NestJS test suites.
Readme
@nestjs-yalc/jest
Jest helpers for YALC and NestJS test suites.
Use this package for common mocks, ESM-aware GraphQL mocking, environment test helpers, query builder mocks, and shared assertions.
Installation
npm install --save-dev @nestjs-yalc/jestMain Exports
envTestHelperfor temporary environment variable overrides.createNestJsGraphqlMockandmockNestJSGraphqlfor Nest GraphQL tests.mockedExecutionContext,mockChainingObject, andmockQueryBuilder.- Common class/factory definition tests and ESM import helpers through subpaths.
Example
import { envTestHelper } from '@nestjs-yalc/jest';
const env = envTestHelper({ NODE_ENV: 'test' });
try {
// test code
} finally {
env.reset();
}Related Package
Use @nestjs-yalc/jest-config when you need the generated Jest configuration
helpers used by the monorepo.
