diff --git a/.changeset/dry-eagles-share.md b/.changeset/dry-eagles-share.md new file mode 100644 index 00000000..caeb7fc9 --- /dev/null +++ b/.changeset/dry-eagles-share.md @@ -0,0 +1,5 @@ +--- +"vscode-apollo": patch +--- + +Fix a bug handling windows path separators in `FileSet` instances. diff --git a/.github/workflows/E2E.yml b/.github/workflows/E2E.yml index 890ef982..4a6e3fc5 100644 --- a/.github/workflows/E2E.yml +++ b/.github/workflows/E2E.yml @@ -7,26 +7,63 @@ on: jobs: test: name: Run E2E tests - runs-on: ubuntu-latest + runs-on: "${{ matrix.os }}" strategy: matrix: version: ["1.90.0", "stable", "insiders"] + os: [ubuntu-latest] + include: + - version: "stable" + os: "windows-latest" steps: - run: sudo apt update && sudo apt install -y libasound2 libgbm1 libgtk-3-0 libnss3 xvfb expect + if: runner.os == 'Linux' - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: cache: "npm" - run: npm install - - run: npm run build:production - run: echo 'APOLLO_KEY="service:bob-123:489fhseo4"' > ./sampleWorkspace/spotifyGraph/.env - - run: | + shell: bash + - name: Install & Configure Rover (Linux) + run: | expect < jest.config.ts + shell: bash + if: runner.os == 'Windows' + - run: npm run build:production + - name: "Run Extension E2E tests (Linux)" + run: xvfb-run -a npm run test:extension + env: + VSCODE_VERSION: "${{ matrix.version }}" + if: runner.os == 'Linux' + - name: "Run Extension E2E tests (Windows)" + run: npm run test:extension env: VSCODE_VERSION: "${{ matrix.version }}" + if: runner.os == 'Windows' diff --git a/src/language-server/__e2e__/rover.e2e.ts b/src/language-server/__e2e__/rover.e2e.ts index 2d7d62ad..cbeae25d 100644 --- a/src/language-server/__e2e__/rover.e2e.ts +++ b/src/language-server/__e2e__/rover.e2e.ts @@ -41,6 +41,11 @@ if (test === origTest.skip) { ); } +if (process.platform === "win32") { + console.info("Skipping rover E2E tests in Windows"); + test = origTest.skip; +} + let editor: TextEditor; let getPosition: GetPositionFn; beforeAll(async () => { diff --git a/src/language-server/__e2e__/studioGraph.e2e.ts b/src/language-server/__e2e__/studioGraph.e2e.ts index 9c8fb553..3cbed06d 100644 --- a/src/language-server/__e2e__/studioGraph.e2e.ts +++ b/src/language-server/__e2e__/studioGraph.e2e.ts @@ -63,13 +63,13 @@ test("wrong token", async () => { // currently, this logs twice, along with a full stracktrace, but no indication of where it came from // this should be improved on. - expect(output).toContain( + expect(output.replace(/\s/g, "")).toContain( ` [GraphQL error]: HTTP fetch failed from 'kotlin': 406: Not Acceptable [GraphQL error]: Invalid credentials provided ApolloError: HTTP fetch failed from 'kotlin': 406: Not Acceptable Invalid credentials provided - at new ApolloError`.trim(), + at new ApolloError`.replace(/\s/g, ""), ); } finally { await mocks.loadDefaultMocks(baseUri); diff --git a/src/language-server/fileSet.ts b/src/language-server/fileSet.ts index ca7862b6..91b9e50c 100644 --- a/src/language-server/fileSet.ts +++ b/src/language-server/fileSet.ts @@ -2,7 +2,7 @@ import { minimatch } from "minimatch"; import { globSync } from "glob"; import { invariant } from "../tools"; import { URI } from "vscode-uri"; -import { normalizeURI } from "./utilities"; +import { normalizeURI, withUnixSeparator } from "./utilities"; import { resolve } from "path"; export class FileSet { @@ -35,13 +35,13 @@ export class FileSet { this.includes.some((include) => { return minimatch( normalizedFilePath, - resolve(this.rootURI.fsPath, include), + withUnixSeparator(resolve(this.rootURI.fsPath, include)), ); }) && !this.excludes.some((exclude) => { return minimatch( normalizedFilePath, - resolve(this.rootURI.fsPath, exclude), + withUnixSeparator(resolve(this.rootURI.fsPath, exclude)), ); }) ); diff --git a/src/language-server/utilities/uri.ts b/src/language-server/utilities/uri.ts index 2a830b30..4a746f9c 100644 --- a/src/language-server/utilities/uri.ts +++ b/src/language-server/utilities/uri.ts @@ -1,6 +1,6 @@ import { URI } from "vscode-uri"; -const withUnixSeparator = (uriString: string) => +export const withUnixSeparator = (uriString: string) => uriString.split(/[\/\\]/).join("/"); export const normalizeURI = (uriString: string) => {