Skip to content

Commit f6235ff

Browse files
committed
Test on PR and push to master
1 parent 2552002 commit f6235ff

File tree

4 files changed

+49
-5
lines changed

4 files changed

+49
-5
lines changed

.github/workflows/test.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Test
2+
permissions: read-all
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches: master
9+
types: [opened, synchronize, reopened]
10+
11+
jobs:
12+
test:
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
os: [macos-latest, ubuntu-latest, windows-latest]
17+
runs-on: ${{ matrix.os }}
18+
steps:
19+
- uses: actions/checkout@v2
20+
- uses: actions/setup-node@v2
21+
with:
22+
node-version: 16
23+
cache: yarn
24+
- run: yarn install --frozen-lockfile
25+
- run: xvfb-run -a yarn test
26+
if: runner.os == 'Linux'
27+
- run: yarn test
28+
if: runner.os != 'Linux'

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@
194194
"test-compile": "tsc -p ./",
195195
"compile": "tsc -p ./",
196196
"watch": "tsc -watch -p ./",
197-
"pretest": "yarn run compile && yarn run lint",
197+
"pretest": "yarn run compile && yarn run lint && yarn run esbuild",
198198
"lint": "eslint src --ext ts",
199199
"test": "node ./out/test/runTest.js"
200200
},

src/test/runTest.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import * as path from "path";
2+
import * as cp from "child_process";
23

3-
import { runTests } from "vscode-test";
4+
import {
5+
runTests,
6+
resolveCliPathFromVSCodeExecutablePath,
7+
downloadAndUnzipVSCode,
8+
} from "vscode-test";
49

510
async function main() {
611
try {
@@ -12,11 +17,21 @@ async function main() {
1217
// Passed to --extensionTestsPath
1318
const extensionTestsPath = path.resolve(__dirname, "./suite/index");
1419

15-
// Download VS Code, unzip it and run the integration test
20+
const vscodeExecutablePath = await downloadAndUnzipVSCode();
21+
const cliPath =
22+
resolveCliPathFromVSCodeExecutablePath(vscodeExecutablePath);
23+
24+
// Install extension dependencies
25+
cp.spawnSync(cliPath, ["--install-extension", "pokey.parse-tree"], {
26+
encoding: "utf-8",
27+
stdio: "inherit",
28+
});
29+
30+
// Run the integration test
1631
await runTests({
32+
vscodeExecutablePath,
1733
extensionDevelopmentPath,
1834
extensionTestsPath,
19-
launchArgs: ["--disable-extensions"],
2035
});
2136
} catch (err) {
2237
console.error("Failed to run tests");

src/test/suite/recorded.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ suite("recorded test cases", async function () {
3333
__dirname,
3434
"../../../src/test/suite/fixtures/recorded"
3535
);
36-
const files = await walkFilesSync(directory);
36+
const files = walkFilesSync(directory);
3737

3838
teardown(() => {
3939
sinon.restore();
@@ -82,6 +82,7 @@ suite("recorded test cases", async function () {
8282

8383
// Wait for cursorless to set up decorations
8484
cursorlessApi.addDecorations();
85+
await new Promise((resolve) => setTimeout(resolve, 100));
8586

8687
// Assert that recorded decorations are present
8788
Object.entries(fixture.marks).forEach(([key, token]) => {

0 commit comments

Comments
 (0)