vscode-apollo 2.2.1 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,7 +6,7 @@ orbs:
6
6
  executors:
7
7
  node:
8
8
  docker:
9
- - image: cimg/node:22.7.0
9
+ - image: cimg/node:22.8.0
10
10
  working_directory: ~/vscode-graphql
11
11
 
12
12
  commands:
@@ -11,7 +11,7 @@ jobs:
11
11
  with:
12
12
  cache: "npm"
13
13
  - run: npm install
14
- - run: echo PKG_VERSION="$(git show --no-patch --format=0.0.0-build.%ct.pr.${{ github.event.pull_request.number }}.commit.%h)" >> $GITHUB_ENV
14
+ - run: echo PKG_VERSION="$(git show --no-patch --format=0.0.0-build-%ct.pr-${{ github.event.pull_request.number }}.commit-%h)" >> $GITHUB_ENV
15
15
  - run: npm pkg set "version=${{ env.PKG_VERSION }}"
16
16
  - run: npx -y @vscode/vsce package --out vscode-apollo-${{ env.PKG_VERSION }}.vsix
17
17
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 2.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#209](https://github.com/apollographql/vscode-graphql/pull/209) [`fc73ed30`](https://github.com/apollographql/vscode-graphql/commit/fc73ed3089e281aa1234268f4ec78e6aa68eae15) Thanks [@phryneas](https://github.com/phryneas)! - Change default recommended configuration file format to `json`.
8
+
9
+ ### Patch Changes
10
+
11
+ - [#200](https://github.com/apollographql/vscode-graphql/pull/200) [`d6c6af81`](https://github.com/apollographql/vscode-graphql/commit/d6c6af811e1c04901990278e3b76057ef2221911) Thanks [@phryneas](https://github.com/phryneas)! - Fixed an issue where the configuration was not reloaded when the `.env.local` file changed.
12
+
13
+ - [#202](https://github.com/apollographql/vscode-graphql/pull/202) [`ea5cc094`](https://github.com/apollographql/vscode-graphql/commit/ea5cc0944b7015cd7b2cfee15993469c124a8356) Thanks [@phryneas](https://github.com/phryneas)! - Prevent configuration file parsing loop when transpiling TypeScript configs.
14
+
15
+ - [#204](https://github.com/apollographql/vscode-graphql/pull/204) [`c2351d2e`](https://github.com/apollographql/vscode-graphql/commit/c2351d2e179eb92fb493a4209a3461c8aa92c979) Thanks [@phryneas](https://github.com/phryneas)! - Fix a bug where config file changes could not be picked up
16
+
17
+ - [#200](https://github.com/apollographql/vscode-graphql/pull/200) [`d6c6af81`](https://github.com/apollographql/vscode-graphql/commit/d6c6af811e1c04901990278e3b76057ef2221911) Thanks [@phryneas](https://github.com/phryneas)! - Add support for `apollo.config.yml`, `apollo.config.yaml` and `apollo.config.json`.
18
+
3
19
  ## 2.2.1
4
20
 
5
21
  ### Patch Changes
package/README.md CHANGED
@@ -26,31 +26,35 @@ The Apollo GraphQL extension for VS Code brings an all-in-one tooling experience
26
26
 
27
27
  <h2 id="getting-started">Getting started</h2>
28
28
 
29
- To get all the benefits of the VS Code experience, it's best to link the schema that is being developed against before installing the extension. The best way to do that is by [publishing a schema](https://www.apollographql.com/docs/graphos/delivery/publishing-schemas/) to the Apollo schema registry. After that's done:
29
+ For the VS Code plugin to know how to find the schema, it needs to be linked to either a published schema or a local one.
30
30
 
31
- 1. Create an `apollo.config.js` file at the root of the project.
32
- Alternatively, you can create a `cjs`, `mjs`, or `ts` file with the same configuration.
33
- 2. Obtain a [Personal API key](https://www.apollographql.com/docs/graphos/api-keys) from GraphOS Studio.
31
+ First, create an `apollo.config.json` file at the root of the project.
32
+ Alternatively, you can create a `yaml`, `cjs`, `mjs`, or `ts` file with the same configuration.
34
33
 
35
- <h3 id="apollo-config">Setting up an Apollo config</h3>
34
+ For the contents of this configuration file, select one of these options:
36
35
 
37
- For the VS Code plugin to know how to find the schema, it needs to be linked to either a published schema or a local one. To link a project to a published schema, edit the `apollo.config.js` file to look like this:
36
+ <details>
37
+ <summary>
38
+ <h3>Configure extension for schemas published to Apollo GraphOS</h3>
39
+ </summary>
38
40
 
39
- ```js
40
- module.exports = {
41
- client: {
42
- service: "my-graphql-app",
43
- },
44
- };
41
+ To get all the benefits of the VS Code experience, it's best to link the schema that is being developed against before installing the extension. The best way to do that is by [publishing a schema](https://www.apollographql.com/docs/graphos/delivery/publishing-schemas/) to the Apollo schema registry.
42
+
43
+ After that's done, edit the `apollo.config.json` file to look like this:
44
+
45
+ ```json
46
+ {
47
+ "client": {
48
+ "service": "graphos-graph-name"
49
+ }
50
+ }
45
51
  ```
46
52
 
47
53
  The `service` name is the name of the graph you've created in [GraphOS Studio](https://studio.apollographql.com).
48
54
 
49
55
  See [additional configuration options](#additional-apollo-config-options).
50
56
 
51
- <h3 id="api-key">Setting up the <code>.env</code> file</h3>
52
-
53
- To authenticate with GraphOS Studio to pull down your schema, create a `.env` file in the same directory as the `apollo.config.js` file. This should be an untracked file (that is, don't commit it to Git).
57
+ To authenticate with GraphOS Studio to pull down your schema, create a `.env` file in the same directory as the `apollo.config.json` file. This should be an untracked file (that is, don't commit it to Git).
54
58
 
55
59
  Then go to your [User Settings page](https://studio.apollographql.com/user-settings/api-keys?referrer=docs-content) in GraphOS Studio to create a new Personal API key.
56
60
 
@@ -64,56 +68,68 @@ APOLLO_KEY=<enter copied key here>
64
68
 
65
69
  After this is done, VS Code can be reloaded and the Apollo integration will connect to GraphOS Studio to provide autocomplete, validation, and more.
66
70
 
67
- <h3 id="local-schemas">Local schemas</h3>
71
+ </details>
72
+
73
+ <details>
74
+ <summary>
75
+ <h3 id="local-schemas">Configure extension to use introspection from a locally running service</h3>
76
+ </summary>
68
77
 
69
- Sometimes it may make sense to link the editor to a locally running version of a schema to try out new designs that are in active development. To do this, the `apollo.config.js` file can be linked to a local service definition:
78
+ Sometimes it may make sense to link the editor to a locally running version of a schema to try out new designs that are in active development. To do this, the `apollo.config.json` file can be linked to a local service definition:
70
79
 
71
- ```js
72
- module.exports = {
73
- client: {
74
- service: {
75
- name: "my-graphql-app",
76
- url: "http://localhost:4000/graphql",
77
- },
78
- },
79
- };
80
+ ```json
81
+ {
82
+ "client": {
83
+ "service": {
84
+ "name": "my-graphql-app",
85
+ "url": "http://localhost:4000/graphql"
86
+ }
87
+ }
88
+ }
80
89
  ```
81
90
 
82
91
  Linking to the local schema won't provide all features, such as switching graph variants and performance metrics.
83
92
 
84
- <h3 id="local-schema-files">Local schema files</h3>
93
+ </details>
94
+
95
+ <details>
96
+ <summary>
97
+ <h3 id="local-schema-files">Configure extension for local schema files</h3>
98
+ </summary>
85
99
 
86
100
  You might not always have a running server to link to, so the extension also supports linking to a local schema file.
87
101
  This is useful for working on a schema in isolation or for testing out new features.
88
- To link to a local schema file, add the following to the `apollo.config.js` file:
102
+ To link to a local schema file, add the following to the `apollo.config.json` file:
89
103
 
90
- ```js
91
- module.exports = {
92
- client: {
93
- service: {
104
+ ```json
105
+ {
106
+ "client": {
107
+ "service": {
94
108
  // can be a string pointing to a single file or an array of strings
95
- localSchemaFile: "./path/to/schema.graphql",
96
- },
97
- },
98
- };
109
+ "localSchemaFile": "./path/to/schema.graphql"
110
+ }
111
+ }
112
+ }
99
113
  ```
100
114
 
101
- <h3 id="client-only-schemas">Client-only schemas</h3>
115
+ </details>
116
+
117
+ <h3 id="client-only-schemas">Adding Client-only schemas</h3>
102
118
 
103
119
  One of the best features of the VS Code extension is the automatic merging of remote schemas and local ones when using integrated state management with Apollo Client. This happens automatically whenever schema definitions are found within a client project. By default, the VS Code extension will look for all JavaScript, TypeScript and GraphQL files under `./src` to find both the operations and schema definitions for building a complete schema for the application.
104
120
 
105
- Client side schema definitions can be spread throughout the client app project and will be merged together to create one single schema. The default behavior can be controlled by adding specifications to the `apollo.config.js`:
121
+ Client side schema definitions can be spread throughout the client app project and will be merged together to create one single schema. The default behavior can be controlled by adding specifications to the `apollo.config.json`:
106
122
 
107
- ```js
108
- module.exports = {
109
- client: {
110
- service: "my-graphql-app",
123
+ ```json
124
+ {
125
+ "client": {
126
+ // "service": <your service configuration>,
111
127
  // array of glob patterns
112
- includes: ["./src/**/*.js"],
128
+ "includes": ["./src/**/*.js"],
113
129
  // array of glob patterns
114
- excludes: ["**/__tests__/**"],
115
- },
116
- };
130
+ "excludes": ["**/__tests__/**"]
131
+ }
132
+ }
117
133
  ```
118
134
 
119
135
  <h3 id="get-the-extension">Get the extension</h3>
@@ -195,11 +211,11 @@ _Optional_ - custom tagged template literal.
195
211
 
196
212
  When using GraphQL with JavaScript or TypeScript projects, it is common to use the `gql` tagged template literal to write out operations. Apollo tools look through your files for the `gql` tag to extract your queries, so if you use a different template literal, you can configure it like so:
197
213
 
198
- ```js
199
- module.exports = {
200
- client: {
201
- tagName: "graphql", // highlight-line
202
- service: ...
214
+ ```json
215
+ {
216
+ "client": {
217
+ "tagName": "graphql",
218
+ "service": //...
203
219
  }
204
- };
220
+ }
205
221
  ```
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "vscode-apollo",
3
3
  "displayName": "Apollo GraphQL",
4
4
  "description": "Rich editor support for GraphQL client and server development that seamlessly integrates with the Apollo platform",
5
- "version": "2.2.1",
5
+ "version": "2.3.0",
6
6
  "referenceID": "87197759-7617-40d0-b32e-46d378e907c7",
7
7
  "author": "Apollo GraphQL <opensource@apollographql.com>",
8
8
  "license": "MIT",
@@ -48,6 +48,7 @@
48
48
  "graphql": "16.9.0",
49
49
  "graphql-language-service": "5.2.2",
50
50
  "graphql-tag": "2.12.6",
51
+ "jsonc-parser": "^3.3.1",
51
52
  "lodash.debounce": "4.0.8",
52
53
  "lodash.merge": "4.6.2",
53
54
  "lodash.throttle": "4.1.1",
@@ -84,6 +85,7 @@
84
85
  "eslint-config-prettier": "9.0.0",
85
86
  "eslint-plugin-prettier": "5.0.1",
86
87
  "graphql-http": "^1.22.1",
88
+ "import-fresh": "^3.3.0",
87
89
  "jest": "29.7.0",
88
90
  "jest-environment-node": "29.7.0",
89
91
  "memfs": "4.11.1",
@@ -93,7 +95,8 @@
93
95
  "ts-jest": "29.1.2",
94
96
  "ts-node": "^10.9.2",
95
97
  "typescript": "^5.5.3",
96
- "vscode-tmgrammar-test": "^0.1.3"
98
+ "vscode-tmgrammar-test": "^0.1.3",
99
+ "zod-to-json-schema": "^3.23.3"
97
100
  },
98
101
  "publisher": "apollographql",
99
102
  "categories": [
@@ -103,7 +106,8 @@
103
106
  "icon": "images/icon-apollo-blue-400x400.png",
104
107
  "activationEvents": [
105
108
  "workspaceContains:**/apollo.config.[jt]s",
106
- "workspaceContains:**/apollo.config.[cm]js"
109
+ "workspaceContains:**/apollo.config.[cm]js",
110
+ "workspaceContains:**/apollo.config.{yaml,yml,json}"
107
111
  ],
108
112
  "contributes": {
109
113
  "configuration": {
@@ -147,6 +151,12 @@
147
151
  "GraphQL"
148
152
  ],
149
153
  "configuration": "./graphql.configuration.json"
154
+ },
155
+ {
156
+ "id": "jsonc",
157
+ "filenames": [
158
+ "apollo.config.json"
159
+ ]
150
160
  }
151
161
  ],
152
162
  "grammars": [
@@ -231,6 +241,23 @@
231
241
  }
232
242
  }
233
243
  ],
244
+ "jsonValidation": [
245
+ {
246
+ "fileMatch": "apollo.config.json",
247
+ "url": "./schemas/apollo.config.schema.json"
248
+ }
249
+ ],
250
+ "__yamlValidation": "For context, see https://github.com/redhat-developer/vscode-yaml?tab=readme-ov-file#mapping-a-schema-in-an-extension",
251
+ "yamlValidation": [
252
+ {
253
+ "fileMatch": "apollo.config.yml",
254
+ "url": "./schemas/apollo.config.schema.json"
255
+ },
256
+ {
257
+ "fileMatch": "apollo.config.yaml",
258
+ "url": "./schemas/apollo.config.schema.json"
259
+ }
260
+ ],
234
261
  "commands": [
235
262
  {
236
263
  "command": "apollographql/selectSchemaTag",
package/renovate.json CHANGED
@@ -5,19 +5,19 @@
5
5
  {
6
6
  "groupName": "all @types",
7
7
  "groupSlug": "all-types",
8
- "matchPackagePatterns": ["@types/*"]
8
+ "matchPackageNames": ["/@types/*/"]
9
9
  },
10
10
  {
11
11
  "groupName": "all devDependencies",
12
12
  "groupSlug": "all-dev",
13
- "matchPackagePatterns": ["*"],
14
- "matchDepTypes": ["devDependencies"]
13
+ "matchDepTypes": ["devDependencies"],
14
+ "matchPackageNames": ["*"]
15
15
  },
16
16
  {
17
17
  "groupName": "all dependencies - patch updates",
18
18
  "groupSlug": "all-patch",
19
- "matchPackagePatterns": ["*"],
20
- "matchUpdateTypes": ["patch"]
19
+ "matchUpdateTypes": ["patch"],
20
+ "matchPackageNames": ["*"]
21
21
  }
22
22
  ],
23
23
  "ignoreDeps": [
@@ -0,0 +1,9 @@
1
+ {
2
+ "client": {
3
+ "service": {
4
+ // test
5
+ "name": "localMultiSchema",
6
+ "localSchemaFile": ["./starwarsSchema.graphql", "./planets.graphql"]
7
+ }
8
+ }
9
+ }
@@ -0,0 +1,2 @@
1
+ rover:
2
+ profile: default
File without changes
@@ -0,0 +1,184 @@
1
+ {
2
+ "allOf": [
3
+ {
4
+ "$ref": "#/definitions/baseConfig"
5
+ },
6
+ {
7
+ "type": "object",
8
+ "properties": {
9
+ "client": {
10
+ "$ref": "#/definitions/clientConfig"
11
+ }
12
+ },
13
+ "required": [
14
+ "client"
15
+ ]
16
+ }
17
+ ],
18
+ "definitions": {
19
+ "clientConfig": {
20
+ "type": "object",
21
+ "properties": {
22
+ "service": {
23
+ "anyOf": [
24
+ {
25
+ "type": "string",
26
+ "description": "The name of the Apollo Studio graph to use. Alternatively pass in an object to configure a local schema."
27
+ },
28
+ {
29
+ "type": "object",
30
+ "properties": {
31
+ "name": {
32
+ "type": "string",
33
+ "description": "The name your project will be referred to by the Apollo GraphQL extension."
34
+ },
35
+ "url": {
36
+ "type": "string",
37
+ "description": "URL of a GraphQL to use for the GraphQL Schema for this project. Needs introspection enabled."
38
+ },
39
+ "headers": {
40
+ "type": "object",
41
+ "additionalProperties": {
42
+ "type": "string"
43
+ },
44
+ "default": {},
45
+ "description": "Additional headers to send to the server."
46
+ },
47
+ "skipSSLValidation": {
48
+ "type": "boolean",
49
+ "default": false,
50
+ "description": "Skip SSL validation. May be required for self-signed certificates."
51
+ }
52
+ },
53
+ "required": [
54
+ "url"
55
+ ],
56
+ "additionalProperties": false,
57
+ "description": "Configuration for using a local schema from a URL."
58
+ },
59
+ {
60
+ "type": "object",
61
+ "properties": {
62
+ "name": {
63
+ "type": "string",
64
+ "description": "The name your project will be referred to by the Apollo GraphQL extension."
65
+ },
66
+ "localSchemaFile": {
67
+ "anyOf": [
68
+ {
69
+ "type": "string",
70
+ "description": "Path to a local schema file to use as GraphQL Schema for this project. Can be a string or an array of strings to merge multiple partial schemas into one."
71
+ },
72
+ {
73
+ "type": "array",
74
+ "items": {
75
+ "type": "string"
76
+ },
77
+ "description": "Path to a local schema file to use as GraphQL Schema for this project. Can be a string or an array of strings to merge multiple partial schemas into one."
78
+ }
79
+ ],
80
+ "description": "Path to a local schema file to use as GraphQL Schema for this project. Can be a string or an array of strings to merge multiple partial schemas into one."
81
+ }
82
+ },
83
+ "required": [
84
+ "localSchemaFile"
85
+ ],
86
+ "additionalProperties": false,
87
+ "description": "Configuration for using a local schema from a file."
88
+ }
89
+ ],
90
+ "description": "A string to refer to a graph in Apollo Studio, or an object for a local schema."
91
+ },
92
+ "validationRules": {
93
+ "anyOf": [
94
+ {
95
+ "type": "array",
96
+ "description": "Additional validation rules to check for. To use this feature, please use a configuration file format that allows passing JavaScript objects."
97
+ }
98
+ ],
99
+ "description": "Additional validation rules to check for. To use this feature, please use a configuration file format that allows passing JavaScript objects."
100
+ },
101
+ "includes": {
102
+ "type": "array",
103
+ "items": {
104
+ "type": "string"
105
+ },
106
+ "description": "An array of glob patterns this project should be active on. The Apollo GraphQL extension will only support IntelliSense-like features in files listed here."
107
+ },
108
+ "excludes": {
109
+ "type": "array",
110
+ "items": {
111
+ "type": "string"
112
+ },
113
+ "default": [
114
+ "**/node_modules",
115
+ "**/__tests__"
116
+ ],
117
+ "description": "Files to exclude from this project. The Apollo GraphQL extension will not provide IntelliSense-like features in these files."
118
+ },
119
+ "tagName": {
120
+ "type": "string",
121
+ "default": "gql",
122
+ "description": "The name of the template literal tag or function used in JavaScript files to declare GraphQL Documents."
123
+ },
124
+ "clientOnlyDirectives": {
125
+ "description": "This option is no longer supported, please remove it from your configuration file."
126
+ },
127
+ "clientSchemaDirectives": {
128
+ "description": "This option is no longer supported, please remove it from your configuration file."
129
+ },
130
+ "statsWindow": {
131
+ "description": "This option is no longer supported, please remove it from your configuration file."
132
+ },
133
+ "name": {
134
+ "description": "This option is no longer supported, please remove it from your configuration file."
135
+ },
136
+ "referenceId": {
137
+ "description": "This option is no longer supported, please remove it from your configuration file."
138
+ },
139
+ "version": {
140
+ "description": "This option is no longer supported, please remove it from your configuration file."
141
+ }
142
+ },
143
+ "required": [
144
+ "service"
145
+ ],
146
+ "additionalProperties": false,
147
+ "description": "Configuration for a Client project."
148
+ },
149
+ "engineConfig": {
150
+ "type": "object",
151
+ "properties": {
152
+ "endpoint": {
153
+ "type": "string",
154
+ "default": "https://graphql.api.apollographql.com/api/graphql",
155
+ "description": "The URL of the Apollo Studio API."
156
+ },
157
+ "apiKey": {
158
+ "type": "string",
159
+ "description": "The API key to use for Apollo Studio. If possible, use a `.env` file or `.env.local` file instead to store secrets like this."
160
+ }
161
+ },
162
+ "additionalProperties": false,
163
+ "description": "Network configuration for Apollo Studio API."
164
+ },
165
+ "baseConfig": {
166
+ "type": "object",
167
+ "properties": {
168
+ "engine": {
169
+ "$ref": "#/definitions/engineConfig",
170
+ "default": {},
171
+ "description": "Network configuration for Apollo Studio API."
172
+ },
173
+ "client": {
174
+ "description": "Configuration for a Client project."
175
+ },
176
+ "service": {
177
+ "description": "This option is no longer supported, please remove it from your configuration file."
178
+ }
179
+ },
180
+ "additionalProperties": false
181
+ }
182
+ },
183
+ "$schema": "http://json-schema.org/draft-07/schema#"
184
+ }
package/src/build.js CHANGED
@@ -1,11 +1,19 @@
1
1
  const esbuild = require("esbuild");
2
+ const { zodToJsonSchema } = require("zod-to-json-schema");
3
+ const { writeFileSync } = require("fs");
4
+ const importFresh = require("import-fresh");
2
5
 
3
6
  const production = process.argv.includes("--production");
4
7
  const watch = process.argv.includes("--watch");
5
8
 
6
9
  async function main() {
7
10
  const ctx = await esbuild.context({
8
- entryPoints: ["src/extension.ts", "src/language-server/server.ts"],
11
+ entryPoints: [
12
+ "src/extension.ts",
13
+ "src/language-server/server.ts",
14
+ "src/language-server/config/config.ts",
15
+ "src/language-server/config/cache-busting-resolver.js",
16
+ ],
9
17
  bundle: true,
10
18
  format: "cjs",
11
19
  minify: production,
@@ -19,6 +27,8 @@ async function main() {
19
27
  plugins: [
20
28
  /* add to the end of plugins array */
21
29
  esbuildProblemMatcherPlugin,
30
+ buildJsonSchemaPlugin,
31
+ resolvePlugin,
22
32
  ],
23
33
  });
24
34
  if (watch) {
@@ -51,6 +61,48 @@ const esbuildProblemMatcherPlugin = {
51
61
  },
52
62
  };
53
63
 
64
+ const buildJsonSchemaPlugin = {
65
+ name: "build-json-schema",
66
+ setup(build) {
67
+ build.onEnd(() => {
68
+ const {
69
+ configSchema,
70
+ clientConfig,
71
+ // roverConfig,
72
+ engineConfig,
73
+ baseConfig,
74
+ // @ts-ignore
75
+ } = importFresh("../lib/language-server/config/config.js");
76
+
77
+ const jsonSchema = zodToJsonSchema(configSchema, {
78
+ errorMessages: true,
79
+ definitions: {
80
+ clientConfig,
81
+ //roverConfig,
82
+ engineConfig,
83
+ baseConfig,
84
+ },
85
+ });
86
+ writeFileSync(
87
+ "./schemas/apollo.config.schema.json",
88
+ JSON.stringify(jsonSchema, null, 2),
89
+ );
90
+ });
91
+ },
92
+ };
93
+
94
+ const resolvePlugin = {
95
+ name: "resolve",
96
+ setup(build) {
97
+ build.onResolve(
98
+ { filter: /^jsonc-parser$/ },
99
+ async ({ path, ...options }) => {
100
+ return build.resolve("jsonc-parser/lib/esm/main.js", options);
101
+ },
102
+ );
103
+ },
104
+ };
105
+
54
106
  main().catch((e) => {
55
107
  console.error(e);
56
108
  process.exit(1);
@@ -174,7 +174,10 @@ Object {
174
174
  expect(config?.client?.service).toEqual("hello");
175
175
  });
176
176
 
177
- it("loads config from a cjs file", async () => {
177
+ // we skip these tests because ts-jest transpiles every `import` down to a `require` call,
178
+ // which messes up all the importing anyways.
179
+ // we have to rely on our E2E tests to ensure that config files resolve correctly
180
+ it.skip("loads config from a cjs file", async () => {
178
181
  writeFilesToDir(dir, {
179
182
  "apollo.config.cjs": `module.exports = {"client": {"service": "hello"} }`,
180
183
  });
@@ -182,13 +185,43 @@ Object {
182
185
  expect(config?.client?.service).toEqual("hello");
183
186
  });
184
187
 
185
- it("loads config from a mjs file", async () => {
188
+ it.skip("loads config from a mjs file", async () => {
186
189
  writeFilesToDir(dir, {
187
190
  "apollo.config.mjs": `export default {"client": {"service": "hello"} }`,
188
191
  });
189
192
  const config = await loadConfig({ configPath: dirPath });
190
193
  expect(config?.client?.service).toEqual("hello");
191
194
  });
195
+
196
+ it("loads config from a yml file", async () => {
197
+ writeFilesToDir(dir, {
198
+ "apollo.config.yml": `
199
+ client:
200
+ service: hello
201
+ `,
202
+ });
203
+ const config = await loadConfig({ configPath: dirPath });
204
+ expect(config?.client?.service).toEqual("hello");
205
+ });
206
+
207
+ it("loads config from a yaml file", async () => {
208
+ writeFilesToDir(dir, {
209
+ "apollo.config.yaml": `
210
+ client:
211
+ service: hello
212
+ `,
213
+ });
214
+ const config = await loadConfig({ configPath: dirPath });
215
+ expect(config?.client?.service).toEqual("hello");
216
+ });
217
+
218
+ it("loads config from a json file", async () => {
219
+ writeFilesToDir(dir, {
220
+ "apollo.config.json": `{"client": /* testing jsonc */ {"service": "hello"} }`,
221
+ });
222
+ const config = await loadConfig({ configPath: dirPath });
223
+ expect(config?.client?.service).toEqual("hello");
224
+ });
192
225
  });
193
226
 
194
227
  describe("errors", () => {