Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add jest and config #82

Merged
merged 4 commits into from
Dec 13, 2020
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
42 changes: 42 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Test

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
jest:
name: Jest
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@2

- name: Setup node env
uses: actions/setup-node@v2.1.2
with:
node-version: 14

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache node_modules
uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

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

- name: Run tests
run: yarn run test
4 changes: 4 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node'
};
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@
"build:production": "webpack --config webpack.config.js --mode=production",
"build:development": "webpack --config webpack.config.js --mode=development",
"prettier": "prettier --check ./src/",
"lint": "eslint ./src/"
"lint": "eslint ./src/",
"pretest": "eslint ./src/",
"test": "jest --passWithNoTests"
},
"devDependencies": {
"@types/chromecast-caf-receiver": "^5.0.12",
"@types/jest": "^26.0.19",
"@typescript-eslint/eslint-plugin": "^4.6.0",
"@typescript-eslint/parser": "^4.6.0",
"clean-webpack-plugin": "^3.0.0",
Expand All @@ -34,10 +37,12 @@
"html-loader": "^1.3.2",
"html-webpack-plugin": "^4.5.0",
"husky": "^4.3.0",
"jest": "^26.6.3",
"prettier": "^2.2.1",
"pretty-quick": "^3.1.0",
"source-map-loader": "^1.1.2",
"style-loader": "^2.0.0",
"ts-jest": "^26.4.4",
"ts-loader": "^8.0.7",
"typescript": "^4.0.5",
"url-loader": "^4.1.1",
Expand Down
Loading