Browse Source

chore(cursor): Add .cursor/rules for frontend (#84718)

Alberto Leal 1 month ago
parent
commit
cfdd2e8d49
1 changed files with 25 additions and 0 deletions
  1. 25 0
      .cursor/rules/tsx_tests.mdc

+ 25 - 0
.cursor/rules/tsx_tests.mdc

@@ -0,0 +1,25 @@
+---
+description: Rules and guidelines for running *.spec.tsx tests and writing React tests
+globs: *.spec.tsx
+---
+
+# Running *.spec.tsx tests
+
+Please run tests with command: CI=true yarn test
+For example: CI=true yarn test path/to/file.spec.tsx
+
+NOTE: `CI=true` runs jest in non-interactive mode.
+
+# React tests
+
+When writing React tests and using react-test-library, please use exports from 'sentry-test/reactTestingLibrary'. It re-exports from '@testing-library/react'. For example:
+
+```
+import {
+  render,
+  screen,
+  userEvent,
+  waitFor,
+  within,
+} from 'sentry-test/reactTestingLibrary';
+```