Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration tests #4

Merged
merged 2 commits into from
Sep 14, 2022
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
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ start-apollo-server-dev:

start-apollo-server-types-check:
docker-compose run --rm --service-ports apollo-server-dev npm run types:check

start-apollo-server-test:
docker-compose run --rm --service-ports apollo-server-dev npm run test
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