Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 135 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
name: Tests

on:
pull_request:
branches:
- main
push:
branches:
- main

env:
YARN_CACHE_FOLDER: ~/.yarn

jobs:
unit-tests:
name: Unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 14

- name: Caching
uses: actions/cache@v2
with:
path: ${{ env.YARN_CACHE_FOLDER }}
key: ${{ runner.OS }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-yarn-${{ env.cache-name }}
${{ runner.OS }}-yarn-

- name: Installing dependencies
run: yarn install --frozen-lockfile

- name: Unit test
run: yarn test

- uses: artiomtr/jest-coverage-report-action@v2.0-rc.1
if: "github.event_name == 'pull_request'"
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
skip-step: all

typecheck:
name: Typecheck
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 14

- name: Caching
uses: actions/cache@v2
with:
path: ${{ env.YARN_CACHE_FOLDER }}
key: ${{ runner.OS }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-yarn-${{ env.cache-name }}
${{ runner.OS }}-yarn-

- name: Installing dependencies
run: yarn install --frozen-lockfile

- name: Typecheck
run: yarn typecheck

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 14

- name: Caching
uses: actions/cache@v2
with:
path: ${{ env.YARN_CACHE_FOLDER }}
key: ${{ runner.OS }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-yarn-${{ env.cache-name }}
${{ runner.OS }}-yarn-

- name: Installing dependencies
run: yarn install --frozen-lockfile

- name: Lint
run: yarn lint

check-format:
name: Check format
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 14

- name: Caching
uses: actions/cache@v2
with:
path: ${{ env.YARN_CACHE_FOLDER }}
key: ${{ runner.OS }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-yarn-${{ env.cache-name }}
${{ runner.OS }}-yarn-

- name: Installing dependencies
run: yarn install --frozen-lockfile

- name: Check format
run: yarn lint:format
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ dist
coverage/
junit.xml
*.tgz
report.json
4 changes: 2 additions & 2 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ const config: Config.InitialOptions = {
roots: ['<rootDir>/test'],
moduleNameMapper,
testEnvironment: 'jest-environment-jsdom',
reporters: ['default', 'jest-junit'],
collectCoverage: true,
coverageReporters: ['json', 'text', 'cobertura'],
coverageReporters: ['json'],
testLocationInResults: true,
};

export default config;
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@
"scripts": {
"build": "rollup -c rollup.config.ts --configPlugin rollup-plugin-typescript2",
"clean": "rm -rf dist/ node_modules/",
"lint": "prettier --check . && eslint --max-warnings 0 .",
"lint": "eslint --max-warnings 0 .",
"lint:format": "prettier --check .",
"start": "rollup -c rollup.config.js --watch",
"test": "NODE_OPTIONS=--experimental-vm-modules jest --forceExit --detectOpenHandles",
"test": "NODE_OPTIONS=--experimental-vm-modules jest --forceExit --detectOpenHandles --testLocationInResults --json --outputFile=report.json",
"test:watch": "yarn test --watch",
"typecheck": "tsc --noEmit",
"release": "semantic-release"
},
"devDependencies": {
Expand All @@ -36,7 +38,6 @@
"esbuild": "0.12.9",
"eslint": "7.29.0",
"jest": "26.6.3",
"jest-junit": "12.2.0",
"mongodb": "3.6.10",
"prettier": "2.3.1",
"rollup": "2.52.2",
Expand Down
Loading