Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyhastings committed Sep 13, 2022
1 parent 9625c39 commit 5f318a4
Show file tree
Hide file tree
Showing 8 changed files with 8,067 additions and 2,040 deletions.
5 changes: 4 additions & 1 deletion server/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
!src/
!.nvmrc
!.prettierrc.json
!jest-mjs-resolver.ts
!jest.config.ts
!package.json
!package-lock.json
!tsconfig.json
!tsconfig.json
!tsconfig.build.json
18 changes: 18 additions & 0 deletions server/jest-mjs-resolver.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// @ts-nocheck

const mjsResolver = (path, options) => {
const mjsExtRegex = /\.mjs$/i;
const resolver = options.defaultResolver;

if (mjsExtRegex.test(path)) {
try {
return resolver(path.replace(mjsExtRegex, '.mts'), options);
} catch {
// use default resolver
}
}

return resolver(path, options);
};

module.exports = mjsResolver;
18 changes: 18 additions & 0 deletions server/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { InitialOptionsTsJest } from 'ts-jest';

const configuration: InitialOptionsTsJest = {
extensionsToTreatAsEsm: ['.ts', '.mts'],
moduleFileExtensions: ['js', 'ts', 'tsx', 'mts'],
resolver: '<rootDir>/jest-mjs-resolver.ts',
testMatch: ['**/*.spec.mts'],
transform: {
'^.+\\.m?tsx?$': [
'ts-jest',
{
useESM: true,
},
],
},
};

export default configuration;
Loading

0 comments on commit 5f318a4

Please sign in to comment.