Skip to content

Commit d0d8f4b

Browse files
Distribute @apollo/server-integration-testsuite as CJS (correctly) (#7055)
Right now the integration testsuite package declares `"type": "module"` but builds as CJS. This seems to be problematic for some integrations, and we should resolve the misconfiguration. This also moves the tsconfig/build "things" over to the CJS branch of our build step. This also removes the ESM configuration options for how we run jest/ts-jest in this repo. Confirmed this doesn't cause a regression in our local dev in that a change in test code is immediately reflected in a test run without running an additional build. Fixes #7042 <!-- First, 🌠 thank you 🌠 for taking the time to consider a contribution to Apollo! Here are some important details to follow: * ⏰ Your time is important To save your precious time, if the contribution you are making will take more than an hour, please make sure it has been discussed in an issue first. This is especially true for feature requests! * 💡 Features Feature requests can be created and discussed within a GitHub Issue. Be sure to search for existing feature requests (and related issues!) prior to opening a new request. If an existing issue covers the need, please upvote that issue by using the 👍 emote, rather than opening a new issue. * 🔌 Integrations Apollo Server has many web-framework integrations including Express, Koa, Hapi and more. When adding a new feature, or fixing a bug, please take a peak and see if other integrations are also affected. In most cases, the fix can be applied to the other frameworks as well. Please note that, since new web-frameworks have a high maintenance cost, pull-requests for new web-frameworks should be discussed with a project maintainer first. * 🕷 Bug fixes These can be created and discussed in this repository. When fixing a bug, please _try_ to add a test which verifies the fix. If you cannot, you should still submit the PR but we may still ask you (and help you!) to create a test. * 📖 Contribution guidelines Follow https://github.com/apollographql/apollo-server/blob/main/CONTRIBUTING.md when submitting a pull request. Make sure existing tests still pass, and add tests for all new behavior. * ✏️ Explain your pull request Describe the big picture of your changes here to communicate to what your pull request is meant to accomplish. Provide 🔗 links 🔗 to associated issues! We hope you will find this to be a positive experience! Open source contribution can be intimidating and we hope to alleviate that pain as much as possible. Without following these guidelines, you may be missing context that can help you succeed with your contribution, which is why we encourage discussion first. Ultimately, there is no guarantee that we will be able to merge your pull-request, but by following these guidelines we can try to avoid disappointment. -->
1 parent 58d9e32 commit d0d8f4b

9 files changed

Lines changed: 8 additions & 7 deletions

File tree

.changeset/small-dodos-collect.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@apollo/server-integration-testsuite': patch
3+
---
4+
5+
Fix build configuration issue and align on CJS correctly

jest.config.base.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@ export default {
99
testPathIgnorePatterns: ['/node_modules/', '/dist/'],
1010
moduleFileExtensions: [...defaults.moduleFileExtensions, 'ts', 'tsx'],
1111
clearMocks: true,
12-
extensionsToTreatAsEsm: ['.ts'],
1312
transform: {
1413
'^.+\\.test.ts$': [
1514
'ts-jest',
1615
{
17-
useESM: true,
1816
tsconfig: '<rootDir>/src/__tests__/tsconfig.json',
1917
diagnostics: true,
2018
},

packages/integration-testsuite/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"name": "@apollo/server-integration-testsuite",
33
"version": "4.0.1",
44
"description": "Test suite for Apollo Server integrations",
5-
"type": "module",
65
"main": "dist/index.js",
76
"types": "dist/index.d.ts",
87
"repository": {
File renamed without changes.

packages/server/src/__tests__/runQuery.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ describe('request pipeline life-cycle hooks', () => {
319319
* sooner in the request life-cycle: when "source" is populated via an APQ
320320
* cache HIT.
321321
*
322-
* That functionality is tested in `apollo-server-integration-testsuite`,
322+
* That functionality is tested in `@apollo/server-integration-testsuite`,
323323
* within the "Persisted Queries" tests. (Search for "didResolveSource").
324324
*/
325325
it('didResolveSource called with the source', async () => {

packages/server/src/__tests__/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"exclude": ["gatewayCompatibility0.test.ts", "gatewayCompatibility2.test.ts"],
55
"references": [
66
{ "path": "../../" },
7-
{ "path": "../../../integration-testsuite" }
7+
{ "path": "../../../integration-testsuite/tsconfig.cjs.json" }
88
]
99
}

tsconfig.build.cjs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"include": [],
77
"references": [
88
{ "path": "./packages/cache-control-types/tsconfig.cjs.json" },
9+
{ "path": "./packages/integration-testsuite/tsconfig.cjs.json" },
910
{ "path": "./packages/plugin-response-cache/tsconfig.cjs.json" },
1011
{ "path": "./packages/server/tsconfig.cjs.json" },
1112
]

tsconfig.build.esm.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"references": [
88
{ "path": "./packages/cache-control-types" },
99
{ "path": "./packages/gateway-interface" },
10-
{ "path": "./packages/integration-testsuite/" },
1110
{ "path": "./packages/plugin-response-cache" },
1211
{ "path": "./packages/server" },
1312
]

tsconfig.test.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"files": [],
66
"include": [],
77
"references": [
8-
{ "path": "./packages/integration-testsuite/" },
98
{ "path": "./packages/plugin-response-cache/src/__tests__/" },
109
{ "path": "./packages/server/src/__tests__/" },
1110
{ "path": "./packages/server/src/__tests__/tsconfig.gatewayCompatibility0.json" },

0 commit comments

Comments
 (0)