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
**Note:** For testing with local changes, use the Verdaccio workflow described in "Running Integration Tests Locally with Verdaccio" above.
338
+
332
339
```bash
333
340
# Prerequisites:
334
341
# 1. Bun must be installed (https://bun.sh)
335
342
# 2. Supabase must be running (see Prerequisites)
336
-
# 3. Update test dependencies:
337
-
npx nx update:test-deps:bun supabase-js
343
+
# 3. Packages published to Verdaccio (see Verdaccio section)
338
344
339
345
# Run Bun tests
340
346
npx nx test:bun supabase-js
341
347
```
342
348
349
+
#### Running Integration Tests Locally with Verdaccio
350
+
351
+
For the most accurate testing that mirrors CI exactly, use a local Verdaccio registry. This approach:
352
+
- Tests the actual published package (not just source code)
353
+
- Mirrors the exact CI workflow
354
+
- Works for all integration test types (Next.js, Expo, Bun, Deno)
355
+
356
+
**Setup:**
357
+
358
+
```bash
359
+
# Terminal 1: Start local Verdaccio registry (stays running)
360
+
npx nx local-registry
361
+
362
+
# Terminal 2: Build and publish packages to local registry
363
+
npx nx run-many --target=build --all
364
+
npx nx populate-local-registry
365
+
```
366
+
367
+
**Run Integration Tests:**
368
+
369
+
```bash
370
+
# Example: Test with Bun
371
+
cd packages/core/supabase-js/test/integration/bun
372
+
echo'registry=http://localhost:4873/'> .npmrc
373
+
bun install
374
+
bun test
375
+
rm .npmrc # Clean up
376
+
cd ../../../..
377
+
378
+
# Example: Test with Next.js
379
+
cd packages/core/supabase-js/test/integration/next
380
+
echo'registry=http://localhost:4873/'> .npmrc
381
+
npm install --legacy-peer-deps
382
+
npm test
383
+
rm .npmrc
384
+
cd ../../../..
385
+
386
+
# Example: Test with Expo
387
+
cd packages/core/supabase-js/test/integration/expo
388
+
echo'registry=http://localhost:4873/'> .npmrc
389
+
npm install
390
+
npm test
391
+
rm .npmrc
392
+
cd ../../../..
393
+
394
+
# Example: Test with Deno
395
+
cd packages/core/supabase-js/test/deno
396
+
echo'registry=http://localhost:4873/'> .npmrc
397
+
npm install
398
+
npm test
399
+
rm .npmrc
400
+
cd ../../../..
401
+
```
402
+
403
+
**Tips:**
404
+
- Keep Verdaccio running in Terminal 1 for multiple test runs
405
+
- Only rebuild/republish when you change source code
406
+
- Registry runs on `http://localhost:4873/`
407
+
- To stop Verdaccio: Ctrl+C in Terminal 1
408
+
343
409
#### WebSocket Browser Testing
344
410
345
411
```bash
@@ -358,46 +424,18 @@ cd ../../..
358
424
359
425
#### CI/CD Testing
360
426
361
-
When running on CI, the tests automatically use the latest dependencies from the root project. The CI pipeline:
427
+
When running on CI, the tests automatically publish packages to a local Verdaccio registry. The CI pipeline:
362
428
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
368
-
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
-
```
429
+
1. Builds all packages with current dependencies
430
+
2. Starts a local Verdaccio registry
431
+
3. Publishes all packages to Verdaccio
432
+
4. Integration tests install from Verdaccio, ensuring they test the actual built packages
393
433
394
-
**When to Update:**
434
+
### Local Testing with Your Changes
395
435
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
436
+
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
437
400
-
**Note:**CI automatically handles this, so manual updates are only needed for local development.
438
+
**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