diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 02e0a83..4fc7512 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -15,15 +15,17 @@ jobs: strategy: matrix: os: [macos-latest, ubuntu-latest, windows-latest] + fail-fast: false runs-on: ${{ matrix.os }} steps: - name: Checkout uses: actions/checkout@v3 - name: Install Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 with: node-version: 16.x + cache: npm - name: Set up Go uses: actions/setup-go@v4 @@ -37,20 +39,32 @@ jobs: run: npm install - name: Run dummy tests - run: xvfb-run -a npm test + run: | + ls -alh + git ls-files + xvfb-run -a npm test if: runner.os == 'Linux' continue-on-error: true - name: Run tests - run: xvfb-run -a npm test + run: | + ls -alh + git ls-files + xvfb-run -a npm test if: runner.os == 'Linux' - name: Run dummy tests - run: npm test + run: | + ls + git ls-files + npm test if: runner.os != 'Linux' continue-on-error: true - name: Run tests - run: npm test + run: | + ls + git ls-files + npm test if: runner.os != 'Linux' diff --git a/.gitignore b/.gitignore index 2de09c9..be28fbf 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ node_modules /test/suite/testdata/**/*/test.yaml .env *.vsix +*.bak diff --git a/package-lock.json b/package-lock.json index cb4b682..b2b9cd2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@types/mocha": "^10.0.1", "@types/node": "^20.4.2", "@types/vscode": "^1.80.0", - "@vscode/test-electron": "^2.3.3", + "@vscode/test-electron": "^2.3.9", "@vscode/vsce": "^2.19.0", "eslint": "^8.45.0", "mocha": "^10.2.0", @@ -199,15 +199,15 @@ "dev": true }, "node_modules/@vscode/test-electron": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/@vscode/test-electron/-/test-electron-2.3.3.tgz", - "integrity": "sha512-hgXCkDP0ibboF1K6seqQYyHAzCURgTwHS/6QU7slhwznDLwsRwg9bhfw1CZdyUEw8vvCmlrKWnd7BlQnI0BC4w==", + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/@vscode/test-electron/-/test-electron-2.3.9.tgz", + "integrity": "sha512-z3eiChaCQXMqBnk2aHHSEkobmC2VRalFQN0ApOAtydL172zXGxTwGrRtviT5HnUB+Q+G3vtEYFtuQkYqBzYgMA==", "dev": true, "dependencies": { "http-proxy-agent": "^4.0.1", "https-proxy-agent": "^5.0.0", "jszip": "^3.10.1", - "semver": "^7.3.8" + "semver": "^7.5.2" }, "engines": { "node": ">=16" diff --git a/package.json b/package.json index fa03de5..cb007a2 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "@types/mocha": "^10.0.1", "@types/node": "^20.4.2", "@types/vscode": "^1.80.0", - "@vscode/test-electron": "^2.3.3", + "@vscode/test-electron": "^2.3.9", "@vscode/vsce": "^2.19.0", "eslint": "^8.45.0", "mocha": "^10.2.0", diff --git a/test/runTest.js b/test/runTest.js index f4cbd65..76882d2 100644 --- a/test/runTest.js +++ b/test/runTest.js @@ -1,29 +1,39 @@ const path = require("path"); const os = require("os"); +const fs = require("fs"); const { runTests } = require("@vscode/test-electron"); +// The folder containing the Extension Manifest package.json +// Passed to `--extensionDevelopmentPath` +const extensionDevelopmentPath = path.resolve(__dirname, "../"); + +// The path to the extension test script +// Passed to --extensionTestsPath +const extensionTestsPath = path.resolve(__dirname, "./suite/index"); + +const projectConfigPath = path.join(extensionDevelopmentPath, ".yamlfmt"); +const backupConfigPath = `${projectConfigPath}.bak`; + async function main() { - try { - // The folder containing the Extension Manifest package.json - // Passed to `--extensionDevelopmentPath` - const extensionDevelopmentPath = path.resolve(__dirname, "../"); + fs.renameSync(projectConfigPath, backupConfigPath); - // The path to the extension test script - // Passed to --extensionTestsPath - const extensionTestsPath = path.resolve(__dirname, "./suite/index"); + let exitCode = 1; + try { // Download VS Code, unzip it and run the integration test - await runTests({ + exitCode = await runTests({ extensionDevelopmentPath, extensionTestsPath, launchArgs: ["--user-data-dir", path.join(os.tmpdir(), "yamlfmt-test")], }); - } catch (err) { console.error("Failed to run tests", err); - process.exit(1); } + + fs.renameSync(backupConfigPath, projectConfigPath); + + process.exit(exitCode); } main();