Skip to content

Commit

Permalink
Fix tests for apollo-graphql by adding jest config.
Browse files Browse the repository at this point in the history
I observed that the tests weren't running for the `apollo-graphql` package
when reviewing the work in #1018.

Upon investigating further (via `jest --debug`), it seems that the Jest
configuration was missing the appropriate configuration for it to pickup the
extensions of `ts` and `tsx` within the `apollo-graphql` repository.

It was only then that I realized that this repository still has `jest`
configuration defined in each of its `package.json` files, rather than a
monorepo-root `jest.config.base.json` file.  That's fine, but it caught me
off guard.

I do think that we should try to DRY-up this repetition and align this
across teams and repositories as soon as possible because it's difficult to
start building per-package exceptions which will quickly become hard to
manage.  For now, this will get tests working for `apollo-graphql` within
the scope of the PR that brings it into the `apollo-tooling` repository,
which seems necessary to tick the box for shipping that PR.
  • Loading branch information
abernix committed Feb 14, 2019
1 parent 804a76f commit bf6e3e1
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions packages/apollo-graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,35 @@
},
"peerDependencies": {
"graphql": "^14.0.2"
},
"jest": {
"preset": "ts-jest",
"transformIgnorePatterns": [
"/node_modules/",
"/apollo-env/"
],
"testEnvironment": "node",
"testMatch": [
"**/__tests__/*.(js|ts)"
],
"setupFiles": [
"<rootDir>/../apollo-env/lib/index.js"
],
"testPathIgnorePatterns": [
"<rootDir>/node_modules/",
"<rootDir>/lib/",
"<rootDir>/test/fixtures/",
"<rootDir>/test/test-utils"
],
"moduleFileExtensions": [
"ts",
"js"
],
"globals": {
"ts-jest": {
"tsConfig": "<rootDir>/tsconfig.test.json",
"diagnostics": false
}
}
}
}

0 comments on commit bf6e3e1

Please sign in to comment.