Skip to content

Commit

Permalink
test: speed up sync test in FAST_TESTS mode (#729)
Browse files Browse the repository at this point in the history
*This is a test-only change.*

I've been working on sync lately, and this test takes a long time. This
change speeds it up if the `FAST_TESTS` environment variable is set.

Stole this [idea from Andrew][0].

[0]: #689 (comment)
  • Loading branch information
EvanHahn authored Jul 30, 2024
1 parent 47ec3a1 commit b9feab5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion test-e2e/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import FakeTimers from '@sinonjs/fake-timers'
import Fastify from 'fastify'
import { map } from 'iterpal'
import {
FAST_TESTS,
connectPeers,
createManager,
createManagers,
Expand All @@ -34,7 +35,7 @@ import { kSyncState } from '../src/sync/sync-api.js'
const SCHEMAS_INITIAL_SYNC = ['preset', 'field']

test('Create and sync data', { timeout: 100_000 }, async (t) => {
const COUNT = 10
const COUNT = FAST_TESTS ? 5 : 10
const managers = await createManagers(COUNT, t)
const [invitor, ...invitees] = managers
const disconnect = connectPeers(managers, { discovery: false })
Expand Down
2 changes: 1 addition & 1 deletion test-e2e/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import fsPromises from 'node:fs/promises'
import { kSyncState } from '../src/sync/sync-api.js'
import { readConfig } from '../src/config-import.js'

const FAST_TESTS = !!process.env.FAST_TESTS
export const FAST_TESTS = !!process.env.FAST_TESTS
const projectMigrationsFolder = new URL('../drizzle/project', import.meta.url)
.pathname
const clientMigrationsFolder = new URL('../drizzle/client', import.meta.url)
Expand Down

0 comments on commit b9feab5

Please sign in to comment.