Skip to content

Commit

Permalink
chore: run tests with vitest
Browse files Browse the repository at this point in the history
  • Loading branch information
alessbell committed Jul 23, 2024
1 parent e95908e commit 11993a1
Show file tree
Hide file tree
Showing 5 changed files with 301 additions and 34 deletions.
28 changes: 27 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,32 @@ jobs:
- name: Install dependencies
run: pnpm install

test-vitest:
name: Vitest tests
if: github.repository == 'apollographql/graphql-testing-library'
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"

- name: Install dependencies
run: pnpm install

- name: Run Vitest tests
run: pnpm run test:vitest

test-jest:
name: Jest tests
if: github.repository == 'apollographql/graphql-testing-library'
Expand All @@ -65,7 +91,7 @@ jobs:
run: pnpm install

- name: Run Jest tests
run: pnpm run test --coverage | tee ./coverage.txt && exit ${PIPESTATUS[0]}
run: pnpm run test:jest --coverage | tee ./coverage.txt && exit ${PIPESTATUS[0]}

- name: Jest Coverage Comment
id: coverageComment
Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@
"changeset-publish": "pnpm run clean && pnpm run build && pnpm run prepdist:changesets && cd dist && changeset publish",
"changeset-version": "changeset version && pnpm i",
"changeset-check": "changeset status --verbose --since=origin/main",
"test": "jest",
"test:jest": "jest",
"test:vitest": "vitest",
"test:storybook": "test-storybook",
"relay": "relay-compiler",
"lint": "eslint --ext .ts src",
"prettier": "prettier --check .",
"type-check": "tsc --noEmit",
"prepublishOnly": "pnpm run build",
"test-storybook": "test-storybook",
"build-and-test-storybook": "pnpm run build-storybook && npx concurrently -k -s first -n \"SB,TEST\" -c \"magenta,blue\" \"npx http-server storybook-static --port 6006 --silent\" \"npx wait-on tcp:6006 && pnpm run test-storybook\"",
"build-and-test-storybook": "pnpm run build-storybook && npx concurrently -k -s first -n \"SB,TEST\" -c \"magenta,blue\" \"npx http-server storybook-static --port 6006 --silent\" \"npx wait-on tcp:6006 && pnpm run test:storybook\"",
"storybook": "storybook dev -p 6006",
"build-storybook": "pnpm run clean-storybook && storybook build"
},
Expand All @@ -56,7 +57,6 @@
"@graphql-tools/merge": "9.0.4",
"@graphql-tools/mock": "9.0.3",
"@graphql-tools/schema": "10.0.4",
"@jest/globals": "29.7.0",
"@playwright/test": "1.45.0",
"@storybook/addon-docs": "8.2.2",
"@storybook/addon-essentials": "8.2.2",
Expand Down Expand Up @@ -108,8 +108,10 @@
"tsup": "8.2.0",
"typescript": "5.5.2",
"undici": "6.19.2",
"vite": "5.3.4",
"vite-plugin-graphql-loader": "3.0.1",
"vite-plugin-relay": "2.1.0",
"vitest": "2.0.4",
"wait-on": "7.2.0"
},
"dependencies": {
Expand Down
Loading

1 comment on commit 11993a1

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines Statements Branches Functions
Coverage: 100%
100% (66/66) 89.47% (17/19) 100% (13/13)
Tests Skipped Failures Errors Time
5 0 💤 0 ❌ 0 🔥 2.161s ⏱️
Coverage Report (100%)
File% Stmts% Branch% Funcs% LinesUncovered Line #s
All files10089.47100100 
   handlers.ts10089.4710010021–29

Please sign in to comment.