Skip to content

Commit

Permalink
Add E2E tests (#150)
Browse files Browse the repository at this point in the history
* add a very basic e2e test setup

* add spotify studio graph

* add schema via http

* work on tests

* adjust configs

* some more completion tests

* split tests, add ts-jest, hover tests

* add localSchemaArray test case

* use different config formats in tests

* update tsconfig

* forward argv to jest
  • Loading branch information
phryneas authored Jul 30, 2024
1 parent f7e27c7 commit eeed0b8
Show file tree
Hide file tree
Showing 41 changed files with 3,448 additions and 217 deletions.
8 changes: 8 additions & 0 deletions .changeset/afraid-foxes-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"vscode-apollo": patch
---

Modernization

- update `glob`
- add E2E tests
15 changes: 10 additions & 5 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@
"name": "Launch VS Code Extension",
"type": "extensionHost",
"request": "launch",
"preLaunchTask": "npm: watch",
"preLaunchTask": "BuildAndStartWorkspace",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceRoot}"],
"stopOnEntry": false,
"args": [
"--extensionDevelopmentPath=${workspaceRoot}",
"--disable-extensions",
"${workspaceFolder}/sampleWorkspace/sampleWorkspace.code-workspace"
],
"sourceMaps": true,
"outFiles": ["${workspaceRoot}/lib/**/*.js"]
},
Expand All @@ -28,10 +31,12 @@
"runtimeExecutable": "${execPath}",
"args": [
"--disable-extensions",
"--extensionDevelopmentPath=${workspaceFolder}"
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/src/__e2e__/run.js",
"${workspaceFolder}/sampleWorkspace/sampleWorkspace.code-workspace"
],
"outFiles": ["${workspaceFolder}/lib/**/*.js"],
"preLaunchTask": "npm: watch"
"preLaunchTask": "BuildAndStartWorkspace"
},
{
"name": "Attach to Test Debugger",
Expand Down
27 changes: 27 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"version": "2.0.0",
"tasks": [
{
"label": "npm: watch",
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
Expand All @@ -13,6 +14,32 @@
"kind": "build",
"isDefault": true
}
},
{
"label": "sampleWorkspace",
"type": "npm",
"script": "sampleWorkspace:run",
"isBackground": true,
"problemMatcher": {
"owner": "custom",
"pattern": [
{
"regexp": "never match this please",
"file": 1,
"location": 2,
"message": 3
}
],
"background": {
"activeOnStart": true,
"beginsPattern": "^\\s*Starting server.*",
"endsPattern": "^\\s*Server ready at.*"
}
}
},
{
"label": "BuildAndStartWorkspace",
"dependsOn": ["npm: watch", "sampleWorkspace"]
}
]
}
17 changes: 17 additions & 0 deletions jest.e2e.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// see https://github.com/microsoft/vscode-test/issues/37#issuecomment-700167820
const path = require("path");

module.exports = {
moduleFileExtensions: ["js", "ts"],
testMatch: ["<rootDir>/src/**/*.e2e.ts"],
testEnvironment: "./src/__e2e__/vscode-environment.js",
setupFiles: ["./src/__e2e__/setup.js"],
verbose: true,
moduleNameMapper: {
vscode: path.join(__dirname, "src", "__e2e__", "vscode.js"),
},
transform: {
"^.+\\.(ts)$": "ts-jest",
},
prettierPath: null,
};
Loading

0 comments on commit eeed0b8

Please sign in to comment.