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 vitest test data plugin #3

Merged
merged 5 commits into from
Feb 9, 2024
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
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,8 @@ if the version is not updated, delete node_modules folder and reinstall

The idea is you can publish the new version using `release` job on CI.

# for playwright
## for playwright
please read doc/PLAYWRIGHT.md

## for vitest
please read doc/VITEST.md
35 changes: 35 additions & 0 deletions doc/VITEST.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Vitest Test Data
Vedmax marked this conversation as resolved.
Show resolved Hide resolved

This package also supports collecting the test data of projects that are using Vitest (0.x).

## Usage

### Basic usage

#### Vitest

If you use **Vitest**, you can add the following to your `vitest.config.js` file:

```javascript
import { VitestTestDataPlugin } from '@agoda-com/test-metrics'

export default defineConfig({
...,
test: {
...,
reporters: ['default', new VitestTestDataPlugin()],
},
})
```

Don't forget to keep `'default'` reporter in the list, otherwise you won't be able to see your test result in the console.

### Advanced usage

As same as build time, test data collection also sends the command that you used to run the build like `yarn test` to be the custom identifier which should work in most cases in order to help you distinguish between different test configurations.

However, if you would like to define your own identifier, you can do so by passing it as a parameter to the plugin.

```javascript
VitestTestDataPlugin(testOnlyPartA ? 'test-only-part-a' : 'test-everything');
```
Loading
Loading