Prisma Shift Test Report

Started: 2026-04-18 01:01:36
Suites (16)
16 passed
0 failed
0 pending
Tests (138)
138 passed
0 failed
0 pending
tests/integration.test.ts
0.32s
Integration Tests > MigrationRunner end-to-end flow
should create migration table and run migrations
passed
0.003s
Integration Tests > MigrationRunner end-to-end flow
should run multiple migrations in sequence
passed
Integration Tests > MigrationRunner end-to-end flow
should skip already executed migrations
passed
Integration Tests > MigrationRunner end-to-end flow
should stop on first failure and not execute subsequent migrations
passed
Integration Tests > MigrationRunner end-to-end flow
should support rollback with down function
passed
Integration Tests > MigrationRunner end-to-end flow
should return false when rolling back migration without down function
passed
Integration Tests > MigrationRunner end-to-end flow
should reset all migration records
passed
0.001s
Integration Tests > MigrationContext
should provide prisma client and log function to migrations
passed
Integration Tests > Transaction handling
should run migrations inside transactions
passed
tests/batch.test.ts
0.131s
Batch Processing > batchProcess
should process all items in batches
passed
Batch Processing > batchProcess
should collect errors without stopping
passed
Batch Processing > batchProcess
should handle empty result
passed
0.001s
Batch Processing > batchProcess
should use cursor for pagination
passed
Batch Processing > batchProcess
should apply delay between batches
passed
0.103s
Batch Processing > batchProcessWithRetry
should succeed on first attempt
passed
Batch Processing > batchProcessWithRetry
should retry on failure
passed
0.011s
Batch Processing > estimateBatchSize
should calculate batch size based on row size
passed
Batch Processing > estimateBatchSize
should clamp to minimum of 100
passed
Batch Processing > estimateBatchSize
should clamp to maximum of 10000
passed
Batch Processing > createProgressTracker
should track progress increments
passed
0.001s
Batch Processing > createProgressTracker
should set absolute value
passed
Batch Processing > createProgressTracker
should call done
passed
Batch Processing > streamProcess
should process all items from stream
passed
0.001s
Batch Processing > streamProcess
should respect limit
passed
Batch Processing > streamProcess
should call onProgress
passed
tests/lock.test.ts
0.051s
Lock > DatabaseLock
should acquire lock using advisory lock
passed
0.001s
Lock > DatabaseLock
should release lock using advisory unlock
passed
Lock > DatabaseLock
should fall back to table-based lock when advisory locks not supported
passed
Lock > DatabaseLock
should retry lock acquisition on failure
passed
0.022s
Lock > DatabaseLock
should return false if lock cannot be acquired after retries
passed
0.011s
Lock > DatabaseLock
should track if lock is held
passed
0.001s
Lock > DatabaseLock
should extend lock timeout
passed
Lock > DatabaseLock
should return true if already held when acquiring
passed
Lock > NoopLock
should always acquire successfully
passed
Lock > NoopLock
should always report as held
passed
Lock > NoopLock
should release without error
passed
Lock > NoopLock
should extend without error
passed
Lock > createLock
should create DatabaseLock when enabled
passed
0.001s
Lock > createLock
should create NoopLock when disabled
passed
tests/squash.test.ts
0.032s
Squash > findMigrationsInRange
should find migrations within ID range
passed
Squash > findMigrationsInRange
should return empty array when no migrations match
passed
Squash > extractImports
should extract import statements
passed
Squash > extractImports
should deduplicate identical imports
passed
Squash > extractUpBody
should extract body from standard async up function
passed
0.001s
Squash > extractUpBody
should handle nested braces and strings
passed
Squash > extractUpBody
should handle comments inside body
passed
Squash > extractUpBody
should return null when no up function exists
passed
Squash > extractUpBody
should handle escaped characters in strings
passed
Squash > generateSquashedMigration
should generate a valid squashed migration file
passed
Squash > generateSquashedMigration
should deduplicate imports
passed
0.001s
Squash > generateSquashedMigration
should add prisma-shift import if missing
passed
Squash > squashMigrations
should throw when no migrations match range
passed
0.003s
Squash > squashMigrations
should create squashed file and remove old files
passed
0.001s
Squash > squashMigrations
should keep old files when keep option is set
passed
Squash > squashMigrations
should not write files in dry-run mode
passed
tests/export.test.ts
0.018s
Export > exportMigrations
should export to JSON format
passed
Export > exportMigrations
should export to CSV format
passed
Export > exportMigrations
should export to HTML format
passed
Export > exportMigrations
should throw error for unsupported format
passed
0.004s
Export > exportMigrations
should include formatted duration
passed
Export > formatDuration
should format milliseconds
passed
Export > formatDuration
should format seconds
passed
Export > formatDuration
should format minutes and seconds
passed
Export > formatDuration
should format hours and minutes
passed
Export > writeExport
should return content when no output path specified
passed
Export > writeExport
should write to file when output path specified
passed
tests/cli.test.ts
0.014s
CLI > init command
should create migrations directory
passed
CLI > create command
should generate migration file with correct naming
passed
CLI > status command
should display migration status correctly
passed
CLI > run command
should execute pending migrations
passed
0.001s
CLI > run command
should handle migration failures
passed
CLI > rollback command
should rollback last migration
passed
CLI > rollback command
should return false if no migrations to rollback
passed
CLI > environment variables
should use DATA_MIGRATIONS_DIR from environment
passed
CLI > environment variables
should use DATA_MIGRATIONS_TABLE from environment
passed
CLI > error handling
should exit with error code on migration failure
passed
0.001s
tests/generator.test.ts
0.013s
Generator
should have generator entry point
passed
0.005s
Generator
should export generator handler
passed
0.001s
tests/hooks.test.ts
0.014s
HookManager > constructor
should initialize with empty hooks
passed
HookManager > constructor
should initialize with all hooks
passed
0.001s
HookManager > runBeforeAll
should do nothing if no hook configured
passed
HookManager > runBeforeAll
should skip hook if script not found
passed
0.004s
HookManager > runBeforeEach
should do nothing if no hook configured
passed
HookManager > runAfterEach
should do nothing if no hook configured
passed
HookManager > runAfterAll
should do nothing if no hook configured
passed
tests/config.test.ts
0.014s
Config > loadConfig
should return default config when no config file exists
passed
Config > loadConfig
should load JSON config file
passed
Config > loadConfig
should merge user config with defaults
passed
0.001s
Config > loadConfig
should throw error for invalid JSON
passed
0.001s
Config > createSampleConfig
should create a sample config file
passed
Config > createSampleConfig
should throw error if config already exists
passed
Config > mergeConfig
should override defaults with user values
passed
Config > mergeConfig
should deeply merge nested objects
passed
tests/validation.test.ts
0.012s
Validation > formatValidationResult
should format valid result
passed
0.001s
Validation > formatValidationResult
should format invalid result with errors
passed
0.001s
tests/migration-runner.test.ts
0.014s
MigrationRunner > ensureMigrationsTable
should create table if it does not exist
passed
MigrationRunner > ensureMigrationsTable
should not create table if it already exists
passed
MigrationRunner > getExecutedMigrations
should return executed migrations
passed
MigrationRunner > getExecutedMigrations
should return empty array if no migrations
passed
MigrationRunner > getStatus
should return correct status with pending and executed migrations
passed
MigrationRunner > runMigrations
should execute pending migrations
passed
MigrationRunner > runMigrations
should stop on first failure
passed
MigrationRunner > runMigrations
should return success if no pending migrations
passed
MigrationRunner > rollbackLast
should rollback the last executed migration
passed
MigrationRunner > rollbackLast
should return false if no migrations to rollback
passed
MigrationRunner > rollbackLast
should return false if migration has no down function
passed
0.001s
MigrationRunner > reset
should clear all migration records
passed
tests/migration-runner-squash.test.ts
0.014s
MigrationRunner squash
should return error if pending migrations exist in range
passed
0.001s
MigrationRunner squash
should squash executed migrations and update records
passed
0.001s
MigrationRunner squash
should update existing record if squashed migration already exists
passed
MigrationRunner squash
should return success with no changes when range has no executed migrations
passed
tests/logger.test.ts
0.013s
Logger > ConsoleLogger
should log messages at or above configured level
passed
Logger > ConsoleLogger
should not log when level is silent
passed
Logger > ConsoleLogger
should log errors with stack trace
passed
Logger > ConsoleLogger
should track migration start
passed
Logger > ConsoleLogger
should track migration end with success
passed
Logger > ConsoleLogger
should track migration end with failure
passed
Logger > ConsoleLogger
should track migration errors
passed
Logger > ConsoleLogger
should display batch progress
passed
Logger > ConsoleLogger
should not display progress when progress is disabled
passed
Logger > ConsoleLogger
should track lock events
passed
Logger > ConsoleLogger
should track hook events
passed
Logger > createLogger
should create ConsoleLogger for non-silent levels
passed
Logger > createLogger
should create SilentLogger for silent level
passed
Logger > createSilentLogger
should not output anything
passed
tests/extension.test.ts
0.012s
Extension > createMigrationExtension
should create extension with options
passed
Extension > withDataMigrations
should extend Prisma client
passed
Extension > withDataMigrations
should use provided migrations dir
passed
Extension > createPrismaClientWithMigrations
should throw if PrismaClient not found
passed
tests/utils.test.ts
0.009s
Utils > generateMigrationId
should generate ID with timestamp and name
passed
Utils > generateMigrationId
should handle name with spaces
passed
Utils > generateMigrationId
should handle name with special characters
passed
Utils > generateMigrationTemplate
should generate valid TypeScript template
passed
Utils > ensureMigrationsDir
should be defined
passed
tests/types.test.ts
0.01s
Types > DataMigration interface
should accept valid migration object
passed
Types > DataMigration interface
should accept migration without optional down function
passed
Types > MigrationRecord interface
should accept valid migration record
passed
Types > MigrationContext interface
should have required properties
passed
0.001s