Skip to content

Commit

Permalink
Testing use JSDOM environment
Browse files Browse the repository at this point in the history
  • Loading branch information
obany committed Nov 30, 2023
1 parent 1802e51 commit c2f4faf
Show file tree
Hide file tree
Showing 5 changed files with 499 additions and 2 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,31 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Node 18
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://registry.npmjs.org
scope: '@openfin'

- name: Restore root node_modules from cache
id: node-cache
uses: actions/cache@v3
with:
path: node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}

- name: Install dependencies
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm ci

- name: Run prettier
run: npm run prettier-check

- name: Run eslint
run: npm run eslint

- name: Run markdownlint
run: npm run markdownlint

10 changes: 10 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,26 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Node 18
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://registry.npmjs.org
scope: '@openfin'

- name: Restore root node_modules from cache
id: node-cache
uses: actions/cache@v3
with:
path: node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}

- name: Install dependencies
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm ci

- name: Run Workspace Platform Starter Unit Tests
working-directory: ./how-to/workspace-platform-starter
run: npm run test
2 changes: 1 addition & 1 deletion how-to/workspace-platform-starter/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testEnvironment: 'jsdom',
testMatch: ['**/*.spec.ts'],
moduleFileExtensions: ['ts', 'js'],
transform: {
Expand Down
1 change: 1 addition & 0 deletions how-to/workspace-platform-starter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"express": "^4.18.2",
"fast-glob": "^3.3.2",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"markdownlint-cli": "0.37.0",
"prettier": "3.1.0",
"ts-loader": "^9.5.1",
Expand Down
Loading

0 comments on commit c2f4faf

Please sign in to comment.