Skip to content

Commit 565a840

Browse files
authored
🔧 Fix rover tests (#286)
* update binary path * restructure E2E tests to make it a bit clearer what flow happens per env * fix supergraph.yaml and update snapshot * remove profile check in rover test, it’s not needed * remove unused imports * update rover
1 parent 52017e3 commit 565a840

File tree

6 files changed

+65
-47
lines changed

6 files changed

+65
-47
lines changed

‎.github/workflows/E2E.yml

+22-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,17 @@ jobs:
2525
- run: npm install
2626
- run: echo 'APOLLO_KEY="service:bob-123:489fhseo4"' > ./sampleWorkspace/spotifyGraph/.env
2727
shell: bash
28+
29+
# Print rover version per OS
2830
- name: Install & Configure Rover (Linux)
31+
run: ./node_modules/.bin/rover --version
32+
if: runner.os == 'Linux'
33+
- name: Install Rover (Windows)
34+
run: ./node_modules/.bin/rover.cmd --version
35+
if: runner.os == 'Windows'
36+
37+
# auth rover per OS
38+
- name: Configure Rover (Linux)
2939
run: |
3040
expect <<EOF
3141
spawn ./node_modules/.bin/rover config auth --profile VSCode-E2E
@@ -34,9 +44,6 @@ jobs:
3444
expect eof
3545
EOF
3646
if: runner.os == 'Linux'
37-
- name: Install Rover (Windows)
38-
run: ./node_modules/.bin/rover.cmd --version
39-
if: runner.os == 'Windows'
4047
- name: Configure Rover (Windows)
4148
run: |
4249
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
@@ -48,6 +55,15 @@ jobs:
4855
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
4956
if: runner.os == 'Windows'
5057
shell: powershell
58+
59+
# Print profiles per OS
60+
- name: Print Rover profiles (Linux)
61+
run: ./node_modules/.bin/rover config list
62+
if: runner.os == 'Linux'
63+
- name: Print Rover profiles (Windows)
64+
run: ./node_modules/.bin/rover.cmd config list
65+
if: runner.os == 'Windows'
66+
5167
- name: Adjust configuration (Windows)
5268
run: |
5369
sed -i -e 's/\(bin:.*\)/\1.exe/' sampleWorkspace/rover/apollo.config.yaml
@@ -56,7 +72,10 @@ jobs:
5672
echo "module.exports = require('./jest.e2e.config')" > jest.config.ts
5773
shell: bash
5874
if: runner.os == 'Windows'
75+
5976
- run: npm run build:production
77+
78+
# Run test per OS
6079
- name: "Run Extension E2E tests (Linux)"
6180
run: xvfb-run -a npm run test:extension
6281
env:

‎package-lock.json

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"zod-validation-error": "3.4.0"
6868
},
6969
"devDependencies": {
70-
"@apollo/rover": "0.27.0-preview.0",
70+
"@apollo/rover": "0.27.0",
7171
"@changesets/changelog-github": "0.5.0",
7272
"@changesets/cli": "2.27.10",
7373
"@graphql-codegen/cli": "5.0.2",
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
rover:
22
profile: VSCode-E2E
3-
bin: ../../node_modules/@apollo/rover/binary/rover-0.27.0-alpha.0
3+
bin: ../../node_modules/@apollo/rover/binary/rover-0.27.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
subgraphs:
2+
subgraph:
3+
schema:
4+
file: src/test.graphql

‎src/language-server/__e2e__/rover.e2e.ts

+33-38
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
import { test as origTest } from "@jest/globals";
2-
import { load } from "js-yaml";
3-
import { readFileSync } from "node:fs";
4-
import { execFileSync } from "node:child_process";
5-
import { join } from "node:path";
6-
import { ParsedApolloConfigFormat } from "../config";
72
import { TextEditor } from "vscode";
83
import {
94
closeAllEditors,
@@ -16,31 +11,7 @@ import {
1611
getDefinitions,
1712
} from "./utils";
1813

19-
// we want to skip these tests unless the user running them has a rover config profile named "VSCode-E2E"
2014
let test = origTest.skip;
21-
try {
22-
const roverProjectDir = join(__dirname, "../../../sampleWorkspace/rover");
23-
const config = load(
24-
readFileSync(join(roverProjectDir, "apollo.config.yaml"), "utf-8"),
25-
) as ParsedApolloConfigFormat;
26-
const roverBin = join(roverProjectDir, config.rover!.bin);
27-
const result = execFileSync(roverBin, [
28-
"config",
29-
"list",
30-
"--format=json",
31-
]).toString("utf8");
32-
const parsed = JSON.parse(result);
33-
if (parsed.data.profiles.includes("VSCode-E2E")) {
34-
test = origTest;
35-
}
36-
} catch (e) {}
37-
if (test === origTest.skip) {
38-
console.info(
39-
"Skipping rover E2E tests: no profile with the name 'VSCode-E2E'\n" +
40-
"You can create one by running `rover config auth --profile VSCode-E2E`",
41-
);
42-
}
43-
4415
if (process.platform === "win32") {
4516
console.info("Skipping rover E2E tests in Windows");
4617
test = origTest.skip;
@@ -71,6 +42,10 @@ test("completion", async () => {
7142
expect(await getCompletionItems(editor, getPosition("@over|ride(from")))
7243
.toMatchInlineSnapshot(`
7344
[
45+
{
46+
"detail": undefined,
47+
"label": "@authenticated",
48+
},
7449
{
7550
"detail": undefined,
7651
"label": "@deprecated",
@@ -81,39 +56,59 @@ test("completion", async () => {
8156
},
8257
{
8358
"detail": undefined,
84-
"label": "@federation__authenticated",
59+
"label": "@inaccessible",
8560
},
8661
{
8762
"detail": undefined,
88-
"label": "@federation__inaccessible",
63+
"label": "@override(…)",
8964
},
9065
{
9166
"detail": undefined,
92-
"label": "@federation__policy(…)",
67+
"label": "@policy(…)",
9368
},
9469
{
9570
"detail": undefined,
96-
"label": "@federation__provides(…)",
71+
"label": "@provides(…)",
9772
},
9873
{
9974
"detail": undefined,
100-
"label": "@federation__requiresScopes(…)",
75+
"label": "@requires(…)",
10176
},
10277
{
10378
"detail": undefined,
104-
"label": "@federation__tag(…)",
79+
"label": "@requiresScopes(…)",
10580
},
10681
{
10782
"detail": undefined,
108-
"label": "@override(…)",
83+
"label": "@shareable",
10984
},
11085
{
11186
"detail": undefined,
112-
"label": "@requires(…)",
87+
"label": "@tag(…)",
11388
},
11489
{
11590
"detail": undefined,
116-
"label": "@shareable",
91+
"label": "@federation__authenticated",
92+
},
93+
{
94+
"detail": undefined,
95+
"label": "@federation__inaccessible",
96+
},
97+
{
98+
"detail": undefined,
99+
"label": "@federation__policy(…)",
100+
},
101+
{
102+
"detail": undefined,
103+
"label": "@federation__provides(…)",
104+
},
105+
{
106+
"detail": undefined,
107+
"label": "@federation__requiresScopes(…)",
108+
},
109+
{
110+
"detail": undefined,
111+
"label": "@federation__tag(…)",
117112
},
118113
]
119114
`);

0 commit comments

Comments
 (0)