@@ -124,28 +124,48 @@ nx build auth-js --watch # Development mode
124124### Testing
125125
126126``` bash
127- nx run-many --target=test --all # Test all packages
128- nx test auth-js # Test specific package
129- nx test postgrest-js # Test specific package
130- nx test functions-js # Test specific package
131- nx test realtime-js # Test specific package
132- nx test storage-js # Test specific package (may use special test:storage target)
133- nx test supabase-js # Test specific package
134- nx affected --target=test # Test only affected (recommended)
135- nx test auth-js --watch # Watch mode
136- nx test supabase-js --coverage # Test with coverage
127+ # Test specific packages (complete test suites with Docker setup/cleanup)
128+ nx test:auth auth-js # Complete auth-js test suite (handles Docker)
129+ nx test:storage storage-js # Complete storage-js test suite (handles Docker)
130+ nx test:ci:postgrest postgrest-js # Complete postgrest-js test suite (handles Docker)
131+ nx test functions-js # Standard test (uses testcontainers)
132+ nx test realtime-js # Standard test (no Docker needed)
133+ nx test supabase-js # Standard test (unit tests only)
134+
135+ # Coverage reports
136+ nx test supabase-js --coverage
137+ nx test:coverage realtime-js
138+ nx test:ci functions-js # Includes coverage
137139```
138140
139141** Docker Requirements:**
140142
141- | Package | Docker Required | Infrastructure | Special Commands |
142- | ------------ | --------------- | ------------------------------- | ------------------------------------ |
143- | auth-js | ✅ Yes | Auth Server + Postgres | May use ` nx test:auth auth-js ` |
144- | functions-js | ✅ Yes | Deno relay (testcontainers) | Standard ` nx test functions-js ` |
145- | postgrest-js | ✅ Yes | PostgREST + PostgreSQL | Standard ` nx test postgrest-js ` |
146- | storage-js | ✅ Yes | Storage API + PostgreSQL + Kong | May use ` nx test:storage storage-js ` |
147- | realtime-js | ❌ No | Mock WebSockets | Standard ` nx test realtime-js ` |
148- | supabase-js | ❌ No | Unit tests only | Standard ` nx test supabase-js ` |
143+ | Package | Docker Required | Infrastructure | Complete Test Command | Individual Commands |
144+ | ------------ | --------------- | ------------------------------- | ----------------------------------- | ----------------------------------------------------------------------------------------- |
145+ | auth-js | ✅ Yes | Auth Server + Postgres | ` nx test:auth auth-js ` | ` nx test:suite auth-js ` , ` nx test:infra auth-js ` , ` nx test:clean auth-js ` |
146+ | storage-js | ✅ Yes | Storage API + PostgreSQL + Kong | ` nx test:storage storage-js ` | ` nx test:suite storage-js ` , ` nx test:infra storage-js ` , ` nx test:clean storage-js ` |
147+ | postgrest-js | ✅ Yes | PostgREST + PostgreSQL | ` nx test:ci:postgrest postgrest-js ` | ` nx test:run postgrest-js ` , ` nx test:update postgrest-js ` , ` nx test:types postgrest-js ` |
148+ | functions-js | ✅ Yes | Deno relay (testcontainers) | ` nx test functions-js ` | ` nx test:ci functions-js ` (with coverage) |
149+ | realtime-js | ❌ No | Mock WebSockets | ` nx test realtime-js ` | ` nx test:coverage realtime-js ` , ` nx test:watch realtime-js ` |
150+ | supabase-js | ❌ No | Unit tests only | ` nx test supabase-js ` | ` nx test:all ` , ` nx test:unit ` , ` nx test:integration ` , ` nx test:coverage ` , ` nx test:watch ` |
151+
152+ ** supabase-js Additional Test Commands:**
153+
154+ ``` bash
155+ nx test:all supabase-js # Unit + integration + browser tests
156+ nx test:unit supabase-js # Jest unit tests only
157+ nx test:integration supabase-js # Node.js integration tests
158+ nx test:integration:browser supabase-js # Browser tests (requires Deno)
159+ nx test:edge-functions supabase-js # Edge Functions tests
160+ nx test:deno supabase-js # Deno runtime tests
161+ nx test:bun supabase-js # Bun runtime tests
162+ nx test:expo supabase-js # React Native/Expo tests
163+ nx test:next supabase-js # Next.js SSR tests
164+ nx test:node:playwright supabase-js # WebSocket browser tests
165+ nx test:types supabase-js # TypeScript type checking
166+ nx test:coverage supabase-js # Coverage report
167+ nx test:watch supabase-js # Watch mode
168+ ```
149169
150170> ** 📖 See [ TESTING.md] ( docs/TESTING.md ) for complete testing guide and troubleshooting**
151171
@@ -177,7 +197,7 @@ nx affected --graph # Visualize affected projects
1771971 . Fix root cause in ` packages/core/realtime-js/src/ `
1781982 . Add unit test in ` packages/core/realtime-js/test/ `
1791993 . Add integration test in ` packages/core/supabase-js/test/ `
180- 4 . Run ` nx affected --target= test` to verify both packages
200+ 4 . Run complete test suites for both packages to verify impacts
1812015 . Commit: ` fix(realtime-js): resolve reconnection logic affecting supabase-js `
1822026 . Single PR, single review, single release - all packages version together
183203
@@ -187,7 +207,7 @@ nx affected --graph # Visualize affected projects
1872072 . Write comprehensive unit tests in ` packages/core/[library]/test/ `
1882083 . If feature affects supabase-js, add integration tests there
1892094 . Update TypeScript types if needed
190- 5 . Run ` nx affected --target= test` before committing
210+ 5 . Run complete test suite for the package before committing
1912116 . Use conventional commit: ` feat(storage-js): add resumable uploads `
192212
193213### Quick Fix Workflow
@@ -197,7 +217,8 @@ nx affected --graph # Visualize affected projects
197217git add .
198218git commit -m " fix(auth-js): correct session expiry calculation"
199219# → Automatic canary: 2.80.1-canary.0 published to 'canary' dist-tag
200- nx affected --target=test
220+ # Run complete test suite for the package:
221+ nx test:auth auth-js
201222# After validation, manual promotion:
202223nx release --tag=latest --yes # Promotes to stable with same version for ALL packages
203224```
@@ -289,13 +310,36 @@ This repository uses TypeScript project references for incremental builds and be
289310
290311### Integration Tests (Docker-based)
291312
292- ** Auth-JS & Storage-JS ** :
313+ ** Complete Test Suites (Recommended) ** :
293314
294315``` bash
295- cd packages/core/auth-js
296- npm run test:infra # Start Docker containers
297- npm run test:suite # Run tests
298- npm run test:clean # Cleanup
316+ # Auth-js: Complete test suite (handles Docker setup/cleanup automatically)
317+ nx test:auth auth-js
318+
319+ # Storage-js: Complete test suite (handles Docker setup/cleanup automatically)
320+ nx test:storage storage-js
321+
322+ # Postgrest-js: Complete test suite (handles Docker setup/cleanup automatically)
323+ nx test:ci:postgrest postgrest-js
324+ ```
325+
326+ ** Manual Infrastructure Management** (for development):
327+
328+ ``` bash
329+ # Auth-js
330+ nx test:infra auth-js # Start Docker containers
331+ nx test:suite auth-js # Run tests (can run multiple times)
332+ nx test:clean auth-js # Cleanup
333+
334+ # Storage-js
335+ nx test:infra storage-js # Start Docker containers
336+ nx test:suite storage-js # Run tests (can run multiple times)
337+ nx test:clean storage-js # Cleanup
338+
339+ # Postgrest-js
340+ nx db:run postgrest-js # Start containers
341+ nx test:run postgrest-js # Run tests
342+ nx db:clean postgrest-js # Cleanup
299343```
300344
301345### Cross-Platform Tests (supabase-js)
@@ -443,21 +487,27 @@ cd packages/core/auth-js && npm test
443487✅ Correct:
444488
445489``` bash
446- nx test auth-js
490+ nx test:auth auth-js
447491```
448492
449493### Pitfall 3: Testing Everything
450494
451495❌ Wrong:
452496
453497``` bash
454- nx run-many --target=test --all # Slow, tests unchanged code
498+ nx run-many --target=test --all # Won't work - no standard test target for all packages
455499```
456500
457501✅ Correct:
458502
459503``` bash
460- nx affected --target=test # Fast, tests only changes
504+ # Run complete test suite for the specific package
505+ nx test:auth auth-js
506+ nx test:storage storage-js
507+ nx test:ci:postgrest postgrest-js
508+ nx test functions-js
509+ nx test realtime-js
510+ nx test supabase-js
461511```
462512
463513### Pitfall 4: Breaking Changes
@@ -505,7 +555,7 @@ npm run build
505555✅ Correct: Use Nx commands from repository root
506556
507557``` bash
508- nx test auth-js
558+ nx test:auth auth-js
509559nx build auth-js --watch
510560```
511561
@@ -528,7 +578,7 @@ npm run commit # Guides you through proper format
528578❌ Wrong: Assuming you know how to run tests without checking
529579
530580``` bash
531- nx test storage-js # Might fail if Docker isn't running
581+ nx test storage-js # Wrong - should use nx test:storage storage-js
532582```
533583
534584✅ Correct: Check library README and TESTING.md first
@@ -559,7 +609,10 @@ cat docs/TESTING.md
559609
560610 ``` bash
561611 nx format # Format code
562- nx affected --target=test # Test affected packages
612+ # Run complete test suite for affected packages individually
613+ nx test:auth auth-js # If auth-js changed
614+ nx test:storage storage-js # If storage-js changed
615+ # ... etc for other packages
563616 nx affected --target=lint # Lint affected packages
564617 nx affected --target=build # Build affected packages
565618 ```
@@ -601,7 +654,7 @@ Brief description of what this PR does
601654## Checklist
602655
603656- [ ] Code formatted (`nx format`)
604- - [ ] Tests passing (`nx affected --target= test` )
657+ - [ ] Tests passing (run complete test suites for affected packages )
605658- [ ] Builds passing (`nx affected --target=build`)
606659- [ ] Used conventional commits
607660- [ ] Documentation updated (if needed)
@@ -655,7 +708,10 @@ nx format
655708npm run commit
656709
657710# 6. Before pushing
658- nx affected --target=test
711+ # Run complete test suite for the package you changed
712+ nx test:auth auth-js # If auth-js changed
713+ nx test:storage storage-js # If storage-js changed
714+ # ... etc
659715nx affected --target=build
660716nx format:check
661717
@@ -677,8 +733,9 @@ npm install
677733# Check for errors
678734nx run-many --target=lint --all
679735
680- # Run specific test file
681- nx test auth-js --testFile=GoTrueClient.test.ts
736+ # Run specific test file (for packages with standard test target)
737+ nx test realtime-js --testFile=RealtimeClient.test.ts
738+ nx test supabase-js --testFile=client.test.ts
682739```
683740
684741## Additional Resources
@@ -715,7 +772,7 @@ git commit -m "fix(auth): resolve token issue"
715772
716773``` bash
717774# 1. Validate canary version
718- nx affected --target= test
775+ # Run complete test suites for packages individually
719776
720777# 2. Preview stable promotion
721778nx release --dry-run
@@ -805,7 +862,7 @@ _No user-facing changes in this release._
805862
8068631 . ** Consider Monorepo Impact** : Changes might affect multiple packages - always check dependencies
8078642 . ** Use Nx Commands** : Always prefer ` nx ` over direct ` npm ` for workspace operations
808- 3 . ** Suggest Affected Testing ** : Use ` nx affected --target=test ` over full test suite for efficiency
865+ 3 . ** Suggest Complete Test Suites ** : Use complete test suites ( ` nx test:auth auth-js ` , ` nx test:storage storage-js ` , etc.) for packages individually
8098664 . ** Respect Fixed Versioning** : All packages version together - no independent versioning
8108675 . ** Maintain Compatibility** : Never introduce breaking changes without proper process
8118686 . ** Check Testing Requirements** : Be aware of Docker requirements for integration tests
@@ -830,8 +887,14 @@ _No user-facing changes in this release._
830887
8318881 . Unit test in source library
8328892 . Integration test in supabase-js if affects it
833- 3 . Run ` nx affected --target=test `
834- 4 . Check if Docker needed (auth-js, storage-js)
890+ 3 . Run complete test suite for the package:
891+ - ` nx test:auth auth-js ` (handles Docker automatically)
892+ - ` nx test:storage storage-js ` (handles Docker automatically)
893+ - ` nx test:ci:postgrest postgrest-js ` (handles Docker automatically)
894+ - ` nx test functions-js ` (uses testcontainers)
895+ - ` nx test realtime-js ` (no Docker needed)
896+ - ` nx test supabase-js ` (unit tests only)
897+ 4 . Run complete test suites for all affected packages individually
835898
836899** Q: How will this release?**
837900
0 commit comments