Cursor rule
.cursor/rules/safe-api-tests.mdcNEVER run apps/api mocha tests without NODE_ENV=test — drops dev MongoDB
Cursor rules
Quality
88/100
Scores the file, not the repository.Length
231 words
9 headings · 2 code blocksRepository
39k
— · pushed 0 days agoLast changed
3 days ago
First indexed 3 days ago.123456# Safe API test execution (CRITICAL)78Running mocha from `apps/api` without `NODE_ENV=test` **drops the developer MongoDB database** (`novu-db`).910## Why1112`apps/api/.mocharc.json` loads `e2e/setup.ts` for **every** mocha run. That file calls `dropDatabase()` in `before()` and `after()`:1314- `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**)1617This is not hypothetical — it has happened in this repo.1819## Agent MUST20211. **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`.2425## Safe commands2627```bash28# Official test script (already sets NODE_ENV=test)29cd apps/api && pnpm test3031# Single unit spec — NO e2e harness, NO dropDatabase32cd 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```3637## Forbidden3839```bash40# ❌ NEVER — loads e2e/setup.ts and drops novu-db41npx mocha 'src/**/*.spec.ts'4243# ❌ NEVER — same problem without NODE_ENV=test44npx mocha --require ts-node/register 'src/foo.spec.ts'45```4647If 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
Also in novuhq/novu
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| novuhq/novu.cursor/rules/api-property-optionality-hygiene.mdc · 39k | Cursor rules | gitagent-behaviour | 68/100 | 3 days ago | |
| novuhq/novu.cursor/rules/api.mdc · 39k | Cursor rules | styleapi | 72/100 | 3 days ago | |
| novuhq/novu.cursor/rules/clickhouse.mdc · 39k | Cursor rules | style | 42/100 | 3 days ago | |
| novuhq/novu.cursor/rules/context-engineering.mdc · 39k | Cursor rules | no sections | 16/100 | 3 days ago | |
| novuhq/novu.cursor/rules/dal-repository.mdc · 39k | Cursor rules | do-not | 46/100 | 3 days ago | |
| novuhq/novu.cursor/rules/dashboard.mdc · 39k | Cursor rules | style | 57/100 | 3 days ago | |
| novuhq/novu.cursor/rules/dependency-graph.mdc · 39k | Cursor rules | no sections | 22/100 | 3 days ago | |
| novuhq/novu.cursor/rules/docs-mintlify-steps.mdc · 39k | Cursor rules | do-notagent-behaviour | 43/100 | 3 days ago | |
| novuhq/novu.cursor/rules/infrastructure.mdc · 39k | Cursor rules | no sections | 50/100 | 3 days ago | |
| novuhq/novu.cursor/rules/novu.mdc · 39k | Cursor rules | style | 20/100 | 3 days ago | |
| novuhq/novu.cursor/rules/packages.mdc · 39k | Cursor rules | stylearchdependenciesdocs | 46/100 | 3 days ago | |
| novuhq/novu.cursor/rules/pnpm-release-age.mdc · 39k | Cursor rules | no sections | 24/100 | 3 days ago | |
| novuhq/novu.cursor/rules/pullrequest.mdc · 39k | Cursor rules | gitdo-not | 37/100 | 3 days ago | |
| novuhq/novu.cursor/rules/testing.mdc · 39k | Cursor rules | teststyletesting-strategy | 54/100 | 3 days ago | |
| novuhq/novu.cursor/rules/worker.mdc · 39k | Cursor rules | style | 65/100 | 3 days ago | |
| novuhq/novu.cursor/rules/ws.mdc · 39k | Cursor rules | style | 51/100 | 3 days ago | |
| novuhq/novu.deepsec/AGENTS.md · 39k | AGENTS.md | setupagent-behaviour | 33/100 | 3 days ago | |
| novuhq/novuAGENTS.md · 39k | AGENTS.md | builddo-notagent-behaviour | 63/100 | 3 days ago |
Diff against .cursor/rules/api-property-optionality-hygiene.mdc Diff against .cursor/rules/api.mdc Diff against .cursor/rules/clickhouse.mdc Diff against .cursor/rules/context-engineering.mdc Diff against .cursor/rules/dal-repository.mdc Diff against .cursor/rules/dashboard.mdc Diff against .cursor/rules/dependency-graph.mdc Diff against .cursor/rules/docs-mintlify-steps.mdc Diff against .cursor/rules/infrastructure.mdc Diff against .cursor/rules/novu.mdc Diff against .cursor/rules/packages.mdc Diff against .cursor/rules/pnpm-release-age.mdc Diff against .cursor/rules/pullrequest.mdc Diff against .cursor/rules/testing.mdc Diff against .cursor/rules/worker.mdc Diff against .cursor/rules/ws.mdc Diff against .deepsec/AGENTS.md Diff against AGENTS.md
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45 | Cursor rules | testlint-formatstylearch+5 | 100/100 | 3 days ago | |
| hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126 | Cursor rules | setupbuildtestlint-format+6 | 100/100 | 3 days ago | |
| deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| markstev/mark-starter.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+6 | 99/100 | 3 days ago | |
| Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45 | Cursor rules | teststyletesting-strategysecurity+3 | 97/100 | 3 days ago |
