Note:
I added the withReuse() option to the PostgreSqlContainer. I think this should run fine in ci but I'm not 100% sure.
Benchmarks
Before:
✓ src/modules/user/__test__/user-service.e2e-spec.ts (4) 35020ms
✓ users (4) 35020ms
✓ can create new users 9889ms
✓ will not allow two users the same subject 8424ms
✓ will find users by their user id 8364ms
✓ can update users given their id 8342ms
After:
Without reusing container
✓ src/modules/user/__test__/user-service.e2e-spec.ts (4) 13469ms
✓ users (4) 4478ms
✓ can create new users 1239ms
✓ will not allow two users the same subject 1089ms
✓ will find users by their user id 1084ms
✓ can update users given their id 1064ms
With reusing container
✓ src/modules/user/__test__/user-service.e2e-spec.ts (4) 4924ms
✓ users (4) 4098ms
✓ can create new users 838ms
✓ will not allow two users the same subject 1098ms
✓ will find users by their user id 1105ms
✓ can update users given their id 1056ms
Set up one container at the start of running tests. Instead of starting new containers for each test, do this:
Note: I added the
withReuse()
option to thePostgreSqlContainer
. I think this should run fine in ci but I'm not 100% sure.Benchmarks
Before:
After: Without reusing container
With reusing container