Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"jsc": {
"parser": {
"syntax": "typescript",
"tsx": true,
"decorators": false
},
"target": "es2022"
},
"module": {
"type": "commonjs"
}
}
27 changes: 2 additions & 25 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,14 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
roots: ['<rootDir>/tests', '<rootDir>/src'],
testMatch: ['**/__tests__/**/*.test.{ts,js}', '**/?(*.)+(spec|test).{ts,js}'],
globalSetup: '<rootDir>/tests/setup/globalSetup.ts',
globalTeardown: '<rootDir>/tests/setup/globalTeardown.ts',
setupFilesAfterEnv: ['<rootDir>/tests/setup/testHelpers.ts'],
transform: {
'^.+\\.tsx?$': [
'ts-jest',
{
tsconfig: {
esModuleInterop: true,
allowSyntheticDefaultImports: true,
jsx: 'react-jsx',
strict: false,
},
},
],
'^.+\\.jsx?$': [
'ts-jest',
{
tsconfig: {
esModuleInterop: true,
allowSyntheticDefaultImports: true,
allowJs: true,
strict: false,
jsx: 'react-jsx',
},
},
],
'^.+\\.(ts|tsx|js|jsx)$': '@swc/jest',
},
transformIgnorePatterns: ['migrations/'],
transformIgnorePatterns: ['/node_modules/(?!(uuid|upsignon-mail|react-intl|@formatjs|intl-messageformat)/)', 'migrations/'],
collectCoverageFrom: ['src/**/*.{ts,js}', '!src/**/*.d.ts'],
coverageDirectory: 'coverage',
coverageReporters: ['text', 'lcov', 'html'],
Expand Down
35 changes: 18 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,37 @@
"dotenv": "^17.4.2",
"express": "^5.2.1",
"global-agent": "^4.1.3",
"helmet": "^8.2.0",
"joi": "^18.2.1",
"helmet": "^8.3.0",
"joi": "^18.2.5",
"jsonwebtoken": "^9.0.3",
"jwks-rsa": "^4.0.1",
"jwks-rsa": "^4.1.0",
"libsodium-wrappers": "^0.8.4",
"nodemailer": "^8.0.9",
"pg": "^8.21.0",
"nodemailer": "^9.1.0",
"pg": "^8.23.0",
"upsignon-mail": "git+https://github.com/rgsystemes/upsignon-mail.git#v1.0.9",
"upsignon-ms-entra": "git+https://github.com/rgsystemes/upsignon-ms-entra.git#v1.0.4",
"uuid": "^14.0.0"
"uuid": "^14.0.2"
},
"devDependencies": {
"@swc/core": "^1.16.1",
"@swc/jest": "^0.2.39",
"@types/express": "^5.0.6",
"@types/jest": "^30.0.0",
"@types/joi": "^17.2.3",
"@types/jsonwebtoken": "^9.0.10",
"@types/libsodium-wrappers": "^0.8.2",
"@types/nodemailer": "^8.0.0",
"@types/pg": "^8.20.0",
"@types/supertest": "^7.2.0",
"@types/nodemailer": "^8.0.1",
"@types/pg": "^8.23.1",
"@types/supertest": "^7.2.1",
"@types/uuid": "^11.0.0",
"@typescript-eslint/eslint-plugin": "^8.60.0",
"@typescript-eslint/parser": "^8.60.0",
"eslint": "^10.4.0",
"@typescript-eslint/eslint-plugin": "^8.69.0",
"@typescript-eslint/parser": "^8.69.0",
"eslint": "^10.9.1",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-prettier": "^5.5.5",
"jest": "30.4.2",
"prettier": "^3.8.3",
"eslint-plugin-prettier": "^5.5.6",
"jest": "30.5.1",
"prettier": "^3.9.6",
"supertest": "^7.0.0",
"ts-jest": "29.4.11",
"typescript": "6.0.3"
"typescript": "7.0.2"
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { beforeEach, describe, it, jest, expect } from '@jest/globals';
import { beforeEach, describe, it, expect } from '@jest/globals';
import { abortShamirRecovery } from '../../../src/api2/routes/shamirRecovery/abortShamirRecovery';
import { cleanDatabase } from '../../setup/testHelpers';
import { Request, Response } from 'express';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { beforeEach, describe, it, jest, expect } from '@jest/globals';
import { beforeEach, describe, it, expect } from '@jest/globals';
import { denyShamirRequestApproval } from '../../../src/api2/routes/shamirRecovery/denyShamirRequestApproval';
import { cleanDatabase } from '../../setup/testHelpers';
import { Request, Response } from 'express';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { beforeEach, describe, it, jest, expect } from '@jest/globals';
import { beforeEach, describe, it, expect } from '@jest/globals';
import { finishShamirRecovery } from '../../../src/api2/routes/shamirRecovery/finishShamirRecovery';
import { cleanDatabase } from '../../setup/testHelpers';
import { Request, Response } from 'express';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { beforeEach, describe, it, jest, expect } from '@jest/globals';
import { beforeEach, describe, it, expect } from '@jest/globals';
import { getRecoveryKeyPair } from '../../../src/api2/routes/shamirRecovery/getRecoveryKeyPair';
import { cleanDatabase } from '../../setup/testHelpers';
import { Request, Response } from 'express';
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/shamirRecovery/getShamirConfigs.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { beforeEach, describe, it, jest, expect } from '@jest/globals';
import { beforeEach, describe, it, expect } from '@jest/globals';
import { getShamirConfigs } from '../../../src/api2/routes/shamirRecovery/getShamirConfigs';
import { cleanDatabase } from '../../setup/testHelpers';
import { Request, Response } from 'express';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { beforeEach, describe, it, jest, expect } from '@jest/globals';
import { beforeEach, describe, it, expect } from '@jest/globals';
import { getShamirRecoveryChallenge } from '../../../src/api2/routes/shamirRecovery/getShamirRecoveryChallenge';
import { cleanDatabase } from '../../setup/testHelpers';
import { Request, Response } from 'express';
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/shamirRecovery/getShamirStatus.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { beforeEach, describe, it, jest, expect } from '@jest/globals';
import { beforeEach, describe, it, expect } from '@jest/globals';
import { getShamirStatus } from '../../../src/api2/routes/shamirRecovery/getShamirStatus';
import { cleanDatabase } from '../../setup/testHelpers';
import { Request, Response } from 'express';
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/shamirRecovery/openShamirShares.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { beforeEach, describe, it, jest, expect } from '@jest/globals';
import { beforeEach, describe, it, expect } from '@jest/globals';
import { openShamirShares } from '../../../src/api2/routes/shamirRecovery/openShamirShares';
import { cleanDatabase } from '../../setup/testHelpers';
import { Request, Response } from 'express';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { beforeEach, describe, it, jest, expect } from '@jest/globals';
import { beforeEach, describe, it, expect } from '@jest/globals';
import { requestShamirRecovery } from '../../../src/api2/routes/shamirRecovery/requestShamirRecovery';
import { cleanDatabase } from '../../setup/testHelpers';
import { Request, Response } from 'express';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { beforeEach, describe, it, jest, expect } from '@jest/globals';
import { beforeEach, describe, it, expect } from '@jest/globals';
import { retrieveShamirConfigChangeToApprove } from '../../../src/api2/routes/shamirRecovery/retrieveShamirConfigChangeToApprove';
import { cleanDatabase } from '../../setup/testHelpers';
import { json, Request, Response } from 'express';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { beforeEach, describe, it, jest, expect } from '@jest/globals';
import { beforeEach, describe, it, expect } from '@jest/globals';
import { retrieveShamirRecoveriesToApprove } from '../../../src/api2/routes/shamirRecovery/retrieveShamirRecoveriesToApprove';
import { cleanDatabase } from '../../setup/testHelpers';
import { Request, Response } from 'express';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { beforeEach, describe, it, jest, expect } from '@jest/globals';
import { beforeEach, describe, it, expect } from '@jest/globals';
import { shamirSecurityAlert } from '../../../src/api2/routes/shamirRecovery/shamirSecurityAlert';
import { cleanDatabase } from '../../setup/testHelpers';
import { Request, Response } from 'express';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { beforeEach, describe, it, jest, expect } from '@jest/globals';
import { beforeEach, describe, it, expect } from '@jest/globals';
import { signShamirConfigChange } from '../../../src/api2/routes/shamirRecovery/signShamirConfigChange';
import { cleanDatabase } from '../../setup/testHelpers';
import { Request, Response } from 'express';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { beforeEach, describe, it, jest, expect } from '@jest/globals';
import { beforeEach, describe, it, expect } from '@jest/globals';
import { upsertShamirBackup } from '../../../src/api2/routes/shamirRecovery/upsertShamirBackup';
import { cleanDatabase } from '../../setup/testHelpers';
import { Request, Response } from 'express';
Expand Down
8 changes: 6 additions & 2 deletions tests/setup/globalSetup.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import path from 'path';
require('dotenv').config({ path: path.join(__dirname, '..', '..', '.env.test') });

import { TestDatabase } from './testDatabase';
import libsodium from 'libsodium-wrappers';
// Use requires instead of imports because swc will run imports before any other code,
// thus running the dotenv config too late and causing the tests to fail due to missing environment variables.
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { TestDatabase } = require('./testDatabase');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const libsodium = require('libsodium-wrappers');

export default async function globalSetup() {
console.log('Setting up test environment...');
Expand Down
Loading
Loading