Skip to content

Commit

Permalink
Feat/add test (#4)
Browse files Browse the repository at this point in the history
* simplest test for db

* CI

* e2e

* ghe action

* ignore e2e

* e2e on xvfb-run

* e2e on xvfb-run
  • Loading branch information
makinzm authored Dec 21, 2024
1 parent faa20a9 commit 7eb95c9
Show file tree
Hide file tree
Showing 11 changed files with 4,640 additions and 1,138 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: E2E Tests

on: [push, pull_request]

jobs:
e2e-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 22

- name: Install dependencies
run: npm install

- name: Build extension
run: npm run build

- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium

# Error: https://github.com/makinzm/cliplex/actions/runs/12446276709/job/34748502856
- name: Run E2E tests with xvfb
run: xvfb-run --auto-servernum --server-args="-screen 0 1920x1080x24" npm run test:e2e
22 changes: 22 additions & 0 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Run Tests

on: [push, pull_request]

jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 22

- name: Install Dependencies
run: npm install

- name: Run Tests
run: npm run test

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
node_modules/

coverage/
.tmp-user-data/
test-results/
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ cliplex/
以下のスクリプトを活用してコード品質を維持:

- コードの整形: `npm run format`
- E2Eテストのコード作成: `npx playwright codegen https://makinzm.github.io/rust-wasm-github/`

---

Expand Down
8 changes: 8 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node', // ブラウザAPIを使わないユニットテストなら node でOK
testMatch: ['**/tests/**/*.spec.ts', '**/tests/**/*.test.ts'],
testPathIgnorePatterns: ['/node_modules/', '/dist/', '/tests/e2e/'],
};

Loading

0 comments on commit 7eb95c9

Please sign in to comment.