Skip to content
Critiq Docs

Search docs

Search documentation pages and rules

quality.testing

Avoid real network calls in unit tests

Unit tests should not open real sockets; prefer doubles, recordings, or local fakes.

#Metadata

Rule ID
ts.testing.no-network-call-in-unit-test
Severity
medium
Confidence
0.74
Languages
javascript, typescript
Presets
recommended, strict
Stability
experimental
Applies to
block
Tags
network, quality, rules-catalog, testing

#Why it matters

Real network calls make tests flaky, slow, and unsafe against live systems.

#Remediation

Mock HTTP clients, use an in-memory server, or relocate the scenario to an explicit integration suite.

#Repository path

The generated metadata points to critiq-rules/libs/rules/catalog/rules/typescript/ts.testing.no-network-call-in-unit-test.rule.yaml.