fix(auth): use env-configurable bcrypt rounds to prevent test timeout
HashedPassword.vo.spec.ts was timing out because SALT_ROUNDS=12 is too expensive for the test runner. Make bcrypt rounds configurable via BCRYPT_ROUNDS env var (default 12 for production), and set BCRYPT_ROUNDS=4 in vitest config for fast unit tests. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -6,7 +6,10 @@ interface HashedPasswordProps {
|
||||
}
|
||||
|
||||
export class HashedPassword extends ValueObject<HashedPasswordProps> {
|
||||
private static readonly SALT_ROUNDS = 12;
|
||||
private static readonly SALT_ROUNDS = parseInt(
|
||||
process.env.BCRYPT_ROUNDS ?? '12',
|
||||
10,
|
||||
);
|
||||
private static readonly MIN_LENGTH = 8;
|
||||
|
||||
get value(): string {
|
||||
|
||||
@@ -7,6 +7,9 @@ export default defineConfig({
|
||||
environment: 'node',
|
||||
include: ['src/**/*.spec.ts'],
|
||||
exclude: ['src/**/*.integration.spec.ts', 'node_modules'],
|
||||
env: {
|
||||
BCRYPT_ROUNDS: '4',
|
||||
},
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
|
||||
Reference in New Issue
Block a user