From 3a275b5e068814e05fd5c7127932e17d73cfad3b Mon Sep 17 00:00:00 2001 From: James Pogran Date: Wed, 8 Dec 2021 15:09:48 -0500 Subject: [PATCH] run unit tests in GH --- .github/workflows/test.yml | 38 ++++++++++++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 39 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cd146609fa..dbf819a7bf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,6 +31,44 @@ jobs: - name: lint run: npm run lint + unit: + strategy: + fail-fast: false + matrix: + os: + - windows-latest + - macos-latest + - ubuntu-latest + runs-on: ${{ matrix.os }} + timeout-minutes: 3 + + steps: + - name: Checkout Repo + uses: actions/checkout@v2 + - + name: Read Node.js version (Unix) + if: ${{ runner.os != 'Windows' }} + id: nodejs-version-unix + run: | + content=`cat ./.nvmrc` + echo "::set-output name=content::$content" + - + name: Read Node.js version (Windows) + if: ${{ runner.os == 'Windows' }} + id: nodejs-version-win + run: | + $content = Get-Content .\.nvmrc -Raw + echo "::set-output name=content::$content" + - name: Setup Node.js + uses: actions/setup-node@v1 + with: + # See https://github.com/actions/setup-node/issues/32 + node-version: ${{ steps.nodejs-version-unix.outputs.content || steps.nodejs-version-win.outputs.content }} + - name: npm install + run: npm ci + - name: unit test + run: npm run test:unit + test: strategy: matrix: diff --git a/package.json b/package.json index 9b9e2f2a23..cc3acb8d90 100644 --- a/package.json +++ b/package.json @@ -325,6 +325,7 @@ "lint": "eslint src --ext ts", "pretest": "npm run compile && npm run lint", "test": "node ./out/test/runTest.js", + "test:unit": "jest", "package": "vsce package", "prettier": "prettier \"**/*.+(js|json|ts)\"", "format": "npm run prettier -- --write",