Skip to content

Commit 946d443

Browse files
committed
feat(vitest-config): avoid test output noise
1 parent 553c643 commit 946d443

File tree

7 files changed

+65
-34
lines changed

7 files changed

+65
-34
lines changed

.changeset/flat-deers-buy.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@apitree.cz/vitest-config': patch
3+
---
4+
5+
Avoid tests output noise and only log Vite build errors that are fatal.

packages/eslint-config/README.md

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@
1212

1313
## Installation
1414

15-
In a `pnpm` monorepo, add the following to your root `.npmrc` file:
16-
17-
```
18-
public-hoist-pattern[]=*eslint*
15+
```bash
16+
pnpm add --save-dev @apitree.cz/eslint-config eslint
1917
```
2018

21-
Then, install the package in your repository root:
19+
### Monorepos
2220

23-
```bash
24-
pnpm add --save-dev @apitree.cz/eslint-config eslint
21+
Prior to the installation, add the following to your repository root `.npmrc`:
22+
23+
```
24+
public-hoist-pattern[]=*eslint*
2525
```
2626

2727
## Usage
@@ -80,14 +80,27 @@ import { base, react, storybook } from '@apitree.cz/eslint-config';
8080
export default [...base, ...react, ...storybook];
8181
```
8282

83-
## IntelliJ (JetBrains) IDE Setup
83+
## IntelliJ IDE Setup
8484

85-
In order to have our `typescript-eslint` configuration working in monorepos with IntelliJ IDEs, go to `Settings` >
86-
`Languages & Frameworks` > `JavaScript` > `Code Quality Tools` > `ESLint` and set the following:
85+
In order to have our `typescript-eslint` configuration working in monorepos with IntelliJ IDEs use the following setup:
8786

8887
<img alt="IntelliJ ESLint Flat Config Setup" src="../../public/intellij-eslint-setup.png" width="730" />
8988

9089
Extend the `Working directories` pattern with any other workspace directories you have.
9190

92-
> If your project is not a monorepo, simply use `Automatic ESLint configuration` option and only specify the
93-
> `Run for files` pattern.
91+
If your project is not a monorepo, simply use `Automatic ESLint configuration` option and only specify the
92+
`Run for files` pattern.
93+
94+
### Recommended Values
95+
96+
#### Working directories
97+
98+
```
99+
apps/*;packages/*;
100+
```
101+
102+
#### Run for files
103+
104+
```
105+
{**/*,*}.{js,ts,tsx}
106+
```

packages/prettier-config/README.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@
1212

1313
## Installation
1414

15-
In a `pnpm` monorepo, add the following to your root `.npmrc` file:
16-
17-
```
18-
public-hoist-pattern[]=*prettier*
15+
```bash
16+
pnpm add --save-dev @apitree.cz/prettier-config prettier
1917
```
2018

21-
Then, install the package in your repository root:
19+
### Monorepos
20+
21+
Prior to the installation, add the following to your repository root `.npmrc`:
2222

23-
```bash
24-
pnpm add --save-dev @apitree.cz/prettier-config prettier
23+
```
24+
public-hoist-pattern[]=*prettier*
2525
```
2626

2727
## Usage
@@ -32,8 +32,16 @@ Add the following configuration to your `prettier.config.js`:
3232
export { config as default } from '@apitree.cz/prettier-config';
3333
```
3434

35-
## IntelliJ (JetBrains) IDE Setup
35+
## IntelliJ IDE Setup
3636

37-
Go to `Settings` > `Languages & Frameworks` > `JavaScript` > `Prettier` and set the following:
37+
Following IntelliJ IDEs setup is recommended for the best developer experience:
3838

3939
<img alt="IntelliJ Prettier Setup" src="../../public/intellij-prettier-setup.png" width="730" />
40+
41+
### Recommended Values
42+
43+
#### Run for files
44+
45+
```
46+
{**/*,*}.{css,ejs,graphql,html,js,json,md,mdx,ts,tsx,yml,yaml}
47+
```

packages/vitest-config/README.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,21 @@
1212

1313
## Installation
1414

15-
In a `pnpm` monorepo, add the following to your root `.npmrc` file:
16-
17-
```
18-
public-hoist-pattern[]=*vitest*
15+
```bash
16+
pnpm add --save-dev @apitree.cz/vitest-config vitest
1917
```
2018

21-
Then, install the package inside a specific workspace:
19+
### Monorepos
20+
21+
Prior to the installation, add the following to your repository root `.npmrc`:
2222

23-
```bash
24-
pnpm add --save-dev @apitree.cz/vitest-config vitest
23+
```
24+
public-hoist-pattern[]=*vitest*
2525
```
2626

2727
## Usage
2828

29-
Use one of the following configurations in your `vitest.config.ts`.
30-
31-
> ⚠️ Avoid using [Vitest Workspace](https://vitest.dev/guide/workspace#workspace), prefer defining the configuration in
32-
> each package.
29+
Use one of the following configurations in your `vitest.config.ts`:
3330

3431
### Base
3532

packages/vitest-config/src/base.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { defineConfig } from 'vitest/config';
22

3-
import { coverage } from './constants.js';
3+
import { build, coverage } from './constants.js';
44

55
export const base = defineConfig({
6+
...build,
67
test: {
78
environment: 'node',
89
coverage: {

packages/vitest-config/src/constants.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1+
import type { ViteUserConfig } from 'vitest/config';
12
import type { CoverageOptions } from 'vitest/node';
23

4+
export const build = {
5+
build: { sourcemap: false },
6+
logLevel: 'error',
7+
} satisfies ViteUserConfig;
8+
39
export const coverage = {
410
all: true,
511
provider: 'v8',

packages/vitest-config/src/react.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import viteReact from '@vitejs/plugin-react';
22
import { defineConfig } from 'vitest/config';
33

4-
import { coverage } from './constants.js';
4+
import { build, coverage } from './constants.js';
55

66
export const react = defineConfig({
7+
...build,
78
plugins: [viteReact()],
89
test: {
910
environment: 'jsdom',

0 commit comments

Comments
 (0)