Skip to content

Commit 9ec1248

Browse files
authored
ci: add vitest e2e tests (#5896)
**What's the problem this PR addresses?** Vitest is increasingly important tool in JS ecosystem. While nowhere near "industry standard", it's [quickly gaining traction](https://npmtrends.com/vitest). ... **How did you fix it?** Copy Jest's E2E and "migrate" it to Vitest. ... **Checklist** <!--- Don't worry if you miss something, chores are automatically tested. --> <!--- This checklist exists to help you remember doing the chores when you submit a PR. --> <!--- Put an `x` in all the boxes that apply. --> - [ ] I have read the [Contributing Guide](https://yarnpkg.com/advanced/contributing). <!-- See https://yarnpkg.com/advanced/contributing#preparing-your-pr-to-be-released for more details. --> <!-- Check with `yarn version check` and fix with `yarn version check -i` --> - [ ] I have set the packages that need to be released for my changes to be effective. <!-- The "Testing chores" workflow validates that your PR follows our guidelines. --> <!-- If it doesn't pass, click on it to see details as to what your PR might be missing. --> - [ ] I will check that all automated PR checks pass before the PR gets reviewed.
1 parent 63eaed1 commit 9ec1248

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
on:
2+
schedule:
3+
- cron: '0 */4 * * *'
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
paths:
9+
- .github/actions/prepare/action.yml
10+
- .github/workflows/e2e-vitest-workflow.yml
11+
- scripts/e2e-setup-ci.sh
12+
13+
name: 'E2E Vitest'
14+
jobs:
15+
chore:
16+
name: 'Validating Vitest'
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@v3
21+
22+
- uses: ./.github/actions/prepare
23+
24+
- name: 'Running the integration test'
25+
run: |
26+
source scripts/e2e-setup-ci.sh
27+
28+
yarn init -p
29+
yarn add vitest
30+
31+
echo "import { it, expect } from 'vitest'; it('should pass', () => { expect(true).toBeTruthy(); });" | tee pass.test.js
32+
yarn vitest run pass.test.js
33+
34+
echo "import { it, expect } from 'vitest'; it('should fail', () => { expect(false).toBeTruthy(); });" | tee fail.test.js
35+
! yarn vitest run fail.test.js
36+
37+
yarn add left-pad
38+
39+
echo "import { it, expect } from 'vitest'; import leftPad from 'left-pad'; it('should resolve a module', () => { expect(typeof leftPad).toBe('function');});" | tee module.test.js
40+
yarn vitest run module.test.js

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ On top of our classic integration tests, we also run Yarn every day against the
161161
[![](https://github.com/yarnpkg/berry/actions/workflows/e2e-rollup-workflow.yml/badge.svg?event=schedule)](https://github.com/yarnpkg/berry/actions/workflows/e2e-rollup-workflow.yml)<br/>
162162
[![](https://github.com/yarnpkg/berry/actions/workflows/e2e-storybook-workflow.yml/badge.svg?event=schedule)](https://github.com/yarnpkg/berry/actions/workflows/e2e-storybook-workflow.yml)<br/>
163163
[![](https://github.com/yarnpkg/berry/actions/workflows/e2e-typescript-workflow.yml/badge.svg?event=schedule)](https://github.com/yarnpkg/berry/actions/workflows/e2e-typescript-workflow.yml)<br/>
164+
[![](https://github.com/yarnpkg/berry/actions/workflows/e2e-vitest-workflow.yml/badge.svg?event=schedule)](https://github.com/yarnpkg/berry/actions/workflows/e2e-vitest-workflow.yml)<br/>
164165
[![](https://github.com/yarnpkg/berry/actions/workflows/e2e-webpack-workflow.yml/badge.svg?event=schedule)](https://github.com/yarnpkg/berry/actions/workflows/e2e-webpack-workflow.yml)<br/>
165166
</td></tr>
166167

0 commit comments

Comments
 (0)