You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#### Running Integration Tests Locally with Verdaccio
344
+
345
+
For the most accurate testing that mirrors CI exactly, use a local Verdaccio registry. This approach:
346
+
- Tests the actual published package (not just source code)
347
+
- Mirrors the exact CI workflow
348
+
- Works for all integration test types (Next.js, Expo, Bun, Deno)
349
+
350
+
**Setup:**
351
+
352
+
```bash
353
+
# Terminal 1: Start local Verdaccio registry (stays running)
354
+
npx nx local-registry
355
+
356
+
# Terminal 2: Build and publish packages to local registry
357
+
npx nx run-many --target=build --all
358
+
npx nx populate-local-registry
359
+
```
360
+
361
+
**Run Integration Tests:**
362
+
363
+
```bash
364
+
# Example: Test with Bun
365
+
cd packages/core/supabase-js/test/integration/bun
366
+
echo'registry=http://localhost:4873/'> .npmrc
367
+
bun install
368
+
bun test
369
+
rm .npmrc # Clean up
370
+
cd ../../../..
371
+
372
+
# Example: Test with Next.js
373
+
cd packages/core/supabase-js/test/integration/next
374
+
echo'registry=http://localhost:4873/'> .npmrc
375
+
npm install --legacy-peer-deps
376
+
npm test
377
+
rm .npmrc
378
+
cd ../../../..
379
+
380
+
# Example: Test with Expo
381
+
cd packages/core/supabase-js/test/integration/expo
382
+
echo'registry=http://localhost:4873/'> .npmrc
383
+
npm install
384
+
npm test
385
+
rm .npmrc
386
+
cd ../../../..
387
+
388
+
# Example: Test with Deno
389
+
cd packages/core/supabase-js/test/deno
390
+
echo'registry=http://localhost:4873/'> .npmrc
391
+
npm install
392
+
npm test
393
+
rm .npmrc
394
+
cd ../../../..
395
+
```
396
+
397
+
**Tips:**
398
+
- Keep Verdaccio running in Terminal 1 for multiple test runs
399
+
- Only rebuild/republish when you change source code
400
+
- Registry runs on `http://localhost:4873/`
401
+
- To stop Verdaccio: Ctrl+C in Terminal 1
402
+
343
403
#### WebSocket Browser Testing
344
404
345
405
```bash
@@ -358,46 +418,18 @@ cd ../../..
358
418
359
419
#### CI/CD Testing
360
420
361
-
When running on CI, the tests automatically use the latest dependencies from the root project. The CI pipeline:
362
-
363
-
1. Builds the main project with current dependencies
364
-
2. Creates a package archive (`.tgz`) with the latest versions
365
-
3. Uses this archive in Expo, Next.js, Deno, and Bun tests to ensure consistency
366
-
367
-
### Updating Test Dependencies
421
+
When running on CI, the tests automatically publish packages to a local Verdaccio registry. The CI pipeline:
368
422
369
-
The platform-specific tests (Expo, Next.js, Deno, Bun) use a packaged version of supabase-js rather than directly importing from source. This ensures they test the actual built package as it would be consumed by users.
370
-
371
-
#### How It Works
372
-
373
-
1.**Build** the current supabase-js package
374
-
2.**Pack** it into a `.tgz` file (like `npm pack` does)
375
-
3.**Copy** the `.tgz` to the test directory
376
-
4.**Install** it in the test project
377
-
378
-
This mimics how real users would install and use the package.
379
-
380
-
#### Update Scripts
381
-
382
-
```bash
383
-
# Update ALL test environment dependencies at once
384
-
# This builds, packs, and installs in all test directories
385
-
npx nx update:test-deps supabase-js
386
-
387
-
# Or update specific test environments:
388
-
npx nx update:test-deps:expo supabase-js # Expo/React Native only
389
-
npx nx update:test-deps:next supabase-js # Next.js only
390
-
npx nx update:test-deps:deno supabase-js # Deno only
391
-
npx nx update:test-deps:bun supabase-js # Bun only
392
-
```
423
+
1. Builds all packages with current dependencies
424
+
2. Starts a local Verdaccio registry
425
+
3. Publishes all packages to Verdaccio
426
+
4. Integration tests install from Verdaccio, ensuring they test the actual built packages
393
427
394
-
**When to Update:**
428
+
### Local Testing with Your Changes
395
429
396
-
- After making changes to the source code
397
-
- Before running platform-specific tests locally
398
-
- When debugging test failures that might be due to stale dependencies
430
+
The platform-specific tests (Expo, Next.js, Deno, Bun) install from registries rather than directly importing from source. This ensures they test the actual built packages as they would be consumed by users.
399
431
400
-
**Note:**CI automatically handles this, so manual updates are only needed for local development.
432
+
**For local development:**Use the Verdaccio workflow described in "Running Integration Tests Locally with Verdaccio" above. This mirrors CI exactly and allows you to test your local changes before pushing.
0 commit comments