RuleStack

Configs

Stacks

Compare

Diff

RuleStack

Configs

Stacks

Compare

Diff

Read API

RuleStack

Configs

Stacks

Compare

Diff

Read API

Configs/Cursor rules/novuhq/novu

Cursor rule

.cursor/rules/safe-api-tests.mdc

NEVER 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 blocks

Repository

39k

— · pushed 0 days ago

Last changed

3 days ago

First indexed 3 days ago.
novuhq/novu/.cursor/rules/safe-api-tests.mdcRawGitHub
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 

Commands it names

  • 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

Sections

  • 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

What it covers

setuptestcode-styletesting-strategydatabaseapido-notagent-behaviour

Stack — with the evidence

typescript

(1.00)

javascript

(1.00)

node

(1.00)

react

(1.00)

langchain

(1.00)

jest

(1.00)

biome

(1.00)

pnpm

(0.85)

express

(0.70)

nestjs

(0.70)

mongodb

(0.70)

redis

(0.70)

tailwind

(0.70)

vite

(0.70)

playwright

(0.70)

aws

(0.70)

nx

(0.60)

monorepo

(0.60)

github-actions

(0.60)

Format

Cursor rules

The most expressive format here. Many small .mdc files, each with frontmatter declaring when it should load, so a rule about migrations only enters context when a migration is open. Costs the most to maintain and only one editor reads it.

What the corpus says about it

Repository

Owner
novuhq
Language
—
License
—
Archived
no

All configs in this repo

Also in novuhq/novu

Diff this repo’s formats

One 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?

The other instruction files in this repository
RepositoryFormatStackCoversScoreChanged
novuhq/novu.cursor/rules/api-property-optionality-hygiene.mdc · 39kCursor rulestypescriptjavascript+17gitagent-behaviour68/1003 days ago
novuhq/novu.cursor/rules/api.mdc · 39kCursor rulestypescriptjavascript+17styleapi72/1003 days ago
novuhq/novu.cursor/rules/clickhouse.mdc · 39kCursor rulestypescriptjavascript+17style42/1003 days ago
novuhq/novu.cursor/rules/context-engineering.mdc · 39kCursor rulestypescriptjavascript+17no sections16/1003 days ago
novuhq/novu.cursor/rules/dal-repository.mdc · 39kCursor rulestypescriptjavascript+17do-not46/1003 days ago
novuhq/novu.cursor/rules/dashboard.mdc · 39kCursor rulestypescriptjavascript+17style57/1003 days ago
novuhq/novu.cursor/rules/dependency-graph.mdc · 39kCursor rulestypescriptjavascript+17no sections22/1003 days ago
novuhq/novu.cursor/rules/docs-mintlify-steps.mdc · 39kCursor rulestypescriptjavascript+17do-notagent-behaviour43/1003 days ago
novuhq/novu.cursor/rules/infrastructure.mdc · 39kCursor rulestypescriptjavascript+17no sections50/1003 days ago
novuhq/novu.cursor/rules/novu.mdc · 39kCursor rulestypescriptjavascript+17style20/1003 days ago
novuhq/novu.cursor/rules/packages.mdc · 39kCursor rulestypescriptjavascript+17stylearchdependenciesdocs46/1003 days ago
novuhq/novu.cursor/rules/pnpm-release-age.mdc · 39kCursor rulestypescriptjavascript+17no sections24/1003 days ago
novuhq/novu.cursor/rules/pullrequest.mdc · 39kCursor rulestypescriptjavascript+17gitdo-not37/1003 days ago
novuhq/novu.cursor/rules/testing.mdc · 39kCursor rulestypescriptjavascript+17teststyletesting-strategy54/1003 days ago
novuhq/novu.cursor/rules/worker.mdc · 39kCursor rulestypescriptjavascript+17style65/1003 days ago
novuhq/novu.cursor/rules/ws.mdc · 39kCursor rulestypescriptjavascript+17style51/1003 days ago
novuhq/novu.deepsec/AGENTS.md · 39kAGENTS.mdtypescriptjavascript+17setupagent-behaviour33/1003 days ago
novuhq/novuAGENTS.md · 39kAGENTS.mdtypescriptjavascript+17builddo-notagent-behaviour63/1003 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.

Same format, overlapping stack, ranked by quality
RepositoryFormatStackCoversScoreChanged
TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45Cursor rulestypescriptpytest+15testlint-formatstylearch+5100/1003 days ago
hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126Cursor rulesgobun+5setupbuildtestlint-format+6100/1003 days ago
deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1Cursor rulestypescriptnextjs+5setuptestlint-formatstyle+799/1003 days ago
markstev/mark-starter.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+14setuptestlint-formatstyle+699/1003 days ago
Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+13setuptestlint-formatstyle+799/1003 days ago
dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+15setuptestlint-formatstyle+799/1003 days ago
langflow-ai/langflow.cursor/rules/docs_development.mdc · 153kCursor rulespythonnode+16setupbuildtestlint-format+797/1003 days ago
TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45Cursor rulestypescriptpytest+15teststyletesting-strategysecurity+397/1003 days ago
RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack