Skip to content

Commit

Permalink
Project configuration with e2e tests and coverage.
Browse files Browse the repository at this point in the history
  • Loading branch information
daemontus committed Sep 23, 2024
0 parents commit 5ead804
Show file tree
Hide file tree
Showing 33 changed files with 15,514 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"presets": ["@babel/preset-env", "@babel/preset-typescript"],
"env": {
"test": {
"plugins": ["istanbul"]
},
"development": {
"plugins": ["istanbul"]
}
}
}
118 changes: 118 additions & 0 deletions .github/workflows/validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: Validation
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
check-format:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Check formatting using prettier
run: npm run check-format

check-types:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Check types using tsc
run: npm run check-types

check-lint:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Check using eslint
run: npm run check-lint

build-dev:
timeout-minutes: 60
runs-on: ubuntu-latest
needs: [check-format, check-types, check-lint]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Check using eslint
run: npm run build-dev


test-unit:
timeout-minutes: 60
runs-on: ubuntu-latest
needs: [build-dev]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Run unit tests
run: npx jest

test-ui:
timeout-minutes: 60
runs-on: ubuntu-latest
needs: [build-dev]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: npx playwright test
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30

test-coverage:
timeout-minutes: 60
runs-on: ubuntu-latest
needs: [test-ui, test-unit]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run all tests with coverage
run: npm run coverage
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: coverage-total
path: coverage-total/
retention-days: 30
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
node_modules/
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/

coverage-ui
coverage-unit
coverage-total
.nyc_output

# macos temp files
.DS_Store
3 changes: 3 additions & 0 deletions .nycrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "@istanbuljs/nyc-config-babel"
}
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{

}
18 changes: 18 additions & 0 deletions custom.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
Declare all *.jpg, *.png and *.svg files as modules.
*/

declare module "*.jpg" {
const content: any;
export default content;
}

declare module "*.png" {
const content: any;
export default content;
}

declare module "*.svg" {
const content: any;
export default content;
}
10 changes: 10 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";

export default [
{ files: ["**/*.{js,mjs,cjs,ts}"] },
{ languageOptions: { globals: globals.browser } },
pluginJs.configs.recommended,
...tseslint.configs.recommended,
];
5 changes: 5 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
collectCoverage: true,
coverageDirectory: "coverage-unit",
testPathIgnorePatterns: ["/node-modules/", "/test-ui/"],
};
Loading

0 comments on commit 5ead804

Please sign in to comment.