-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtesting.mdc
More file actions
37 lines (24 loc) · 1.1 KB
/
testing.mdc
File metadata and controls
37 lines (24 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
---
description: "Jest unit/api/browser tests and Playwright e2e for delivery-sdk"
globs:
- "test/**/*.ts"
- "playwright.config.ts"
alwaysApply: false
---
# Testing — `@contentstack/delivery-sdk`
## Jest
| Suite | Path | Notes |
|-------|------|--------|
| **Unit** | `test/unit/**/*.spec.ts` | Mocked / fast; `npm run test:unit` |
| **API** | `test/api/**/*.spec.ts` | Real stack — **`.env`** via **`test/utils/stack-instance.ts`** |
| **Browser** | `test/browser/**/*.spec.ts` | `jest.config.browser.ts` |
- **`jest.setup.ts`** — console capture, suppression of **expected** validation error noise; do not weaken checks for real failures.
## Env (`test/api` and helpers)
Required for **`stackInstance()`**:
- **`HOST`**, **`API_KEY`**, **`DELIVERY_TOKEN`**, **`ENVIRONMENT`**
Optional:
- **`PREVIEW_TOKEN`**, **`LIVE_PREVIEW_HOST`**
## E2E
- **`npm run test:e2e`** — builds browser bundle then **Playwright** (`test/e2e`, `playwright.config.ts`).
## Hygiene
- No permanent **`test.only`** in CI paths; long-running API suites may use **`testTimeout`** in Jest config (`maxWorkers: 1` is intentional).