Skip to content

Commit

Permalink
Merge pull request #17 from humanitec/test-against-windows
Browse files Browse the repository at this point in the history
chore(ci): add windows
  • Loading branch information
johanneswuerbach authored Jun 20, 2024
2 parents 258dc9d + e1bc96a commit fe8d62e
Show file tree
Hide file tree
Showing 9 changed files with 275 additions and 37 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
build:
strategy:
matrix:
os: [macos-latest, ubuntu-latest] # windows-latest should also be tested, but currently fails due to https://github.com/mochajs/mocha/issues/4851
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
env:
TEST_HUMANITEC_TOKEN: ${{ secrets.HUMANITEC_TOKEN }}
Expand All @@ -27,6 +27,7 @@ jobs:
- run: npm ci

- run: npm run lint
if: runner.os == 'Linux'

- run: xvfb-run -a npm test
if: runner.os == 'Linux'
Expand Down
20 changes: 16 additions & 4 deletions .vscode-test.mjs
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
import * as path from 'path';
import * as fs from 'fs';
import * as os from 'os';
import * as path from 'node:path';
import * as fs from 'node:fs';
import * as os from 'node:os';
import { platform } from 'node:process';
import { defineConfig } from '@vscode/test-cli';
import { globSync } from 'glob';

// Workaround https://github.com/microsoft/vscode/issues/86382, but creating a tmp user data dir
const userDir = fs.mkdtempSync(path.join(os.tmpdir(), 'vscode-humanitec-'));

let files = 'out/test/**/*.test.js';

if (platform === 'win32') {
// Workaround https://github.com/mochajs/mocha/issues/4851
files = globSync('out/test/**/*.test.js', { absolute: true }).map(f =>
f.toLowerCase()
);
}

export default defineConfig([
{
label: 'unitTests',
files: 'out/test/**/*.test.js',
files,
workspaceFolder: './src/test/test-fixtures/workspace',
mocha: {
ui: 'tdd',
timeout: 20000,
asyncOnly: true,
failZero: true,
},
launchArgs: [`--user-data-dir=${userDir}`, '--disable-extensions'],
},
Expand Down
14 changes: 14 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import globals from 'globals';

export default tseslint.config(
eslint.configs.recommended,
Expand All @@ -22,6 +23,19 @@ export default tseslint.config(
},
files: ['src/test/**/*.test.ts'],
},
{
name: 'scripts',
languageOptions: {
globals: {
...globals.node,
},
},
rules: {
// scripts are plain js
'@typescript-eslint/no-require-imports': 'off',
},
files: ['scripts/*.js'],
},
eslintPluginPrettierRecommended,
{
ignores: ['out/', 'dist/', '.vscode-test/'],
Expand Down
148 changes: 143 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,11 @@
}
},
"scripts": {
"preinstall": "./scripts/download-humctl.sh",
"preinstall": "node ./scripts/download-humctl.js",
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"pretest": "npm run compile && npm run lint",
"pretest": "npm run compile",
"lint": "eslint .",
"test": "vscode-test",
"prettier": "npx prettier . --write",
Expand All @@ -185,12 +185,14 @@
"eslint": "^9.5.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"extract-zip": "^2.0.1",
"husky": "^9.0.11",
"lint-staged": "^15.2.7",
"mocha": "^10.4.0",
"prettier": "^3.3.2",
"sinon": "^18.0.0",
"sinon-chai": "^3.7.0",
"tar": "^7.4.0",
"typescript": "^5.4.5",
"typescript-eslint": "^8.0.0-alpha.30",
"wait-for-expect": "^3.0.2"
Expand Down
Loading

0 comments on commit fe8d62e

Please sign in to comment.