CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/jest-testing

Jest testing patterns — test structure, mocking, async testing, snapshot

99

1.26x
Quality

99%

Does it follow best practices?

Impact

99%

1.26x

Average score across 6 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-3/

Set Up Jest Testing for a New TypeScript Service

Problem/Feature Description

The platform team has scaffolded a new Node.js microservice written in TypeScript. The project compiles with tsc and all source code lives under the src/ directory. Until now the team has been doing ad-hoc manual testing, but with the service heading toward its first production release they need a proper automated test setup.

Your job is to wire up Jest so the team can run, watch, and measure coverage of their tests with three simple commands. The project uses TypeScript throughout — there should be no need to compile files manually before running tests.

Output Specification

Produce the following files:

  • jest.config.ts — the Jest configuration file
  • jest.setup.ts — a minimal global setup file (can be empty or include a comment)
  • package.json — updated (or created) package.json that includes the necessary devDependencies and test scripts

The configuration should assume all source and test files live under src/.

Input Files

Existing tsconfig.json

{
  "compilerOptions": {
    "target": "ES2020",
    "module": "commonjs",
    "rootDir": "src",
    "outDir": "dist",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true
  },
  "include": ["src"]
}

evals

tile.json