| Dimension | Shared | Only in A | Only in B | Overlap |
|---|---|---|---|---|
| Sections | 0 | 3 | 9 | 0% |
| Commands | 0 | 1 | 4 | 0% |
| Section tags | 2 | 0 | 6 | 25% |
What each file covers
Sections
0 shared · 3 only in A · 9 only in B- − Agent setup
- − Common tasks
- − Reference
- + Safe API test execution (CRITICAL)
- + Why
- + Agent MUST
- + Safe commands
- + Official test script (already sets NODE_ENV=test)
- + Single unit spec — NO e2e harness, NO dropDatabase
- + Forbidden
- + ❌ NEVER — loads e2e/setup.ts and drops novu-db
- + ❌ NEVER — same problem without NODE_ENV=test
Commands
0 shared · 1 only in A · 4 only in B- − pnpm install
- + npx mocha --no-config --timeout 30000 --require ts-node/register --exit \
- + npx mocha 'src/**/*.spec.ts'
- + npx mocha --require ts-node/register 'src/foo.spec.ts'
- + pnpm test
Section tags
2 shared · 0 only in A · 6 only in B- + test
- + code-style
- + testing-strategy
- + database
- + api
- + do-not
- setup
- agent-behaviour
Line diff
novuhq/novu · .deepsec/AGENTS.md
@@ −1 @@
1# Agent setup
2
3This is a deepsec scanning workspace. Each registered project has its
4own setup prompt at `data/<id>/SETUP.md` — open the relevant one when
5asked to set a project up.
6
7## Common tasks
8
9- **Set up a project for scanning**: read `data/<id>/SETUP.md` and
10 follow it (read `node_modules/deepsec/SKILL.md`, then fill
11 `data/<id>/INFO.md` from the target codebase).
12- **Add a new project**: run `deepsec init-project <root>` — it
13 scaffolds `data/<id>/` and prints/writes the setup prompt for the
14 new project.
15- **Write a custom matcher** (only after a real true-positive shows you
16 a pattern worth keeping): read
17 `node_modules/deepsec/dist/docs/writing-matchers.md`.
18
19## Reference
20
21The deepsec skill is at `node_modules/deepsec/SKILL.md` (after
22`pnpm install`). The full docs ship at
23`node_modules/deepsec/dist/docs/`.
24
novuhq/novu · .cursor/rules/safe-api-tests.mdc
@@ +1 @@
1---
2description: NEVER run apps/api mocha tests without NODE_ENV=test — drops dev MongoDB
3alwaysApply: true
4---
5
6# Safe API test execution (CRITICAL)
7
8Running mocha from `apps/api` without `NODE_ENV=test` **drops the developer MongoDB database** (`novu-db`).
9
10## Why
11
12`apps/api/.mocharc.json` loads `e2e/setup.ts` for **every** mocha run. That file calls `dropDatabase()` in `before()` and `after()`:
13
14- `NODE_ENV=test` → loads `.env.test` → `MONGO_URL=.../novu-test` (safe)
15- `NODE_ENV` unset / `local` → loads `.env` → `MONGO_URL=.../novu-db` (**wipes all dev data**)
16
17This is not hypothetical — it has happened in this repo.
18
19## Agent MUST
20
211. **Never** run `mocha`, `pnpm test`, or any test command under `apps/api` without `NODE_ENV=test`.
222. For **isolated unit specs** (e.g. `*.spec.ts` renderers), prefer `--no-config` so `.mocharc.json` does not load `e2e/setup.ts` at all.
233. **Never** run worker/ws e2e setups against dev DB either — they use `dalService.destroy()` under `NODE_ENV=test` only; still require `NODE_ENV=test`.
24
25## Safe commands
26
27```bash
28# Official test script (already sets NODE_ENV=test)
29cd apps/api && pnpm test
30
31# Single unit spec — NO e2e harness, NO dropDatabase
32cd apps/api && cross-env NODE_ENV=test NOVU_ENTERPRISE=true CLERK_ENABLED=true \
33 npx mocha --no-config --timeout 30000 --require ts-node/register --exit \
34 'src/path/to/file.spec.ts'
35```
36
37## Forbidden
38
39```bash
40# ❌ NEVER — loads e2e/setup.ts and drops novu-db
41npx mocha 'src/**/*.spec.ts'
42
43# ❌ NEVER — same problem without NODE_ENV=test
44npx mocha --require ts-node/register 'src/foo.spec.ts'
45```
46
47If you need to verify test logic without mocha, use a targeted script with `--no-config` or run via `pnpm test` with the official env vars — never raw mocha from `apps/api` without both safeguards.
48
@@ −1 +1 @@
1−# Agent setup
1+---
2+description: NEVER run apps/api mocha tests without NODE_ENV=test — drops dev MongoDB
3+alwaysApply: true
4+---
25
3−This is a deepsec scanning workspace. Each registered project has its
4−own setup prompt at `data/<id>/SETUP.md` — open the relevant one when
5−asked to set a project up.
6+# Safe API test execution (CRITICAL)
67
7−## Common tasks
8+Running mocha from `apps/api` without `NODE_ENV=test` **drops the developer MongoDB database** (`novu-db`).
89
9−- **Set up a project for scanning**: read `data/<id>/SETUP.md` and
10− follow it (read `node_modules/deepsec/SKILL.md`, then fill
11− `data/<id>/INFO.md` from the target codebase).
12−- **Add a new project**: run `deepsec init-project <root>` — it
13− scaffolds `data/<id>/` and prints/writes the setup prompt for the
14− new project.
15−- **Write a custom matcher** (only after a real true-positive shows you
16− a pattern worth keeping): read
17− `node_modules/deepsec/dist/docs/writing-matchers.md`.
10+## Why
1811
19−## Reference
12+`apps/api/.mocharc.json` loads `e2e/setup.ts` for **every** mocha run. That file calls `dropDatabase()` in `before()` and `after()`:
2013
21−The deepsec skill is at `node_modules/deepsec/SKILL.md` (after
22−`pnpm install`). The full docs ship at
23−`node_modules/deepsec/dist/docs/`.
14+- `NODE_ENV=test` → loads `.env.test` → `MONGO_URL=.../novu-test` (safe)
15+- `NODE_ENV` unset / `local` → loads `.env` → `MONGO_URL=.../novu-db` (**wipes all dev data**)
16+
17+This is not hypothetical — it has happened in this repo.
18+
19+## Agent MUST
20+
21+1. **Never** run `mocha`, `pnpm test`, or any test command under `apps/api` without `NODE_ENV=test`.
22+2. For **isolated unit specs** (e.g. `*.spec.ts` renderers), prefer `--no-config` so `.mocharc.json` does not load `e2e/setup.ts` at all.
23+3. **Never** run worker/ws e2e setups against dev DB either — they use `dalService.destroy()` under `NODE_ENV=test` only; still require `NODE_ENV=test`.
24+
25+## Safe commands
26+
27+```bash
28+# Official test script (already sets NODE_ENV=test)
29+cd apps/api && pnpm test
30+
31+# Single unit spec — NO e2e harness, NO dropDatabase
32+cd apps/api && cross-env NODE_ENV=test NOVU_ENTERPRISE=true CLERK_ENABLED=true \
33+ npx mocha --no-config --timeout 30000 --require ts-node/register --exit \
34+ 'src/path/to/file.spec.ts'
35+```
36+
37+## Forbidden
38+
39+```bash
40+# ❌ NEVER — loads e2e/setup.ts and drops novu-db
41+npx mocha 'src/**/*.spec.ts'
42+
43+# ❌ NEVER — same problem without NODE_ENV=test
44+npx mocha --require ts-node/register 'src/foo.spec.ts'
45+```
46+
47+If you need to verify test logic without mocha, use a targeted script with `--no-config` or run via `pnpm test` with the official env vars — never raw mocha from `apps/api` without both safeguards.
2448
