Skip to content

Commit 628c250

Browse files
committed
Automated developer guide update
1 parent 58a3838 commit 628c250

File tree

1 file changed

+21
-8
lines changed
  • docs/developer-guide/02-projects/image-builder-frontend

1 file changed

+21
-8
lines changed

docs/developer-guide/02-projects/image-builder-frontend/index.md

+21-8
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ echo "127.0.0.1 stage.foo.redhat.com" >> /etc/hosts
7070
Choose a runner (podman or docker), and point the SPANDX_CONFIG variable to
7171
`profile/local-frontend.js` included in image-builder-frontend.
7272

73-
```
73+
```bash
7474
sudo insights-proxy/scripts/patch-etc-hosts.sh
7575
export RUNNER="podman"
7676
export SPANDX_CONFIG=$PATH_TO/image-builder-frontend/profiles/local-frontend.js
@@ -81,7 +81,7 @@ echo "127.0.0.1 stage.foo.redhat.com" >> /etc/hosts
8181

8282
In the image-builder-frontend checkout directory
8383

84-
```
84+
```bash
8585
npm install
8686
npm start
8787
```
@@ -109,7 +109,7 @@ For a hypothetical API called foobar
109109
2. Create a new "empty" API file under `src/store/emptyFoobarApi.ts` that has following
110110
content:
111111

112-
```{ts}
112+
```typescript
113113
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react';
114114
115115
import { FOOBAR_API } from '../constants';
@@ -124,13 +124,13 @@ export const emptyFoobarApi = createApi({
124124
125125
3. Declare new constant `FOOBAR_API` with the API url in `src/constants.ts`
126126
127-
```
127+
```typescript
128128
export const FOOBAR_API = 'api/foobar/v1'
129129
```
130130
131131
4. Create the config file for code generation in `api/config/foobar.ts` containing:
132132
133-
```
133+
```typescript
134134
import type { ConfigFile } from '@rtk-query/codegen-openapi';
135135
136136
const config: ConfigFile = {
@@ -146,7 +146,7 @@ const config: ConfigFile = {
146146
147147
5. Update the `api.sh` script by adding a new line for npx to generate the code:
148148
149-
```
149+
```bash
150150
npx @rtk-query/codegen-openapi ./api/config/foobar.ts &
151151
```
152152
@@ -159,7 +159,7 @@ foobarApi.ts
159159
160160
7. run api generation
161161
162-
```
162+
```bash
163163
npm run api
164164
```
165165
@@ -247,7 +247,7 @@ There are also additional rules added to enforce code style. Those being:
247247
248248
## Test Guidelines
249249
250-
This project is tested using the [Jest](https://jestjs.io/docs/getting-started) framework, [React Testing Library](https://testing-library.com/docs/react-testing-library/intro), and the [Mock Service Worker](https://mswjs.io/docs/) library.
250+
This project is tested using the [Vitest](https://vitest.dev/guide/) framework, [React Testing Library](https://testing-library.com/docs/react-testing-library/intro), and the [Mock Service Worker](https://mswjs.io/docs/) library.
251251
252252
All UI contributions must also include a new test or update an existing test in order to maintain code coverage.
253253
@@ -260,6 +260,19 @@ npm run test
260260
261261
These tests will also be run in our CI when a PR is opened.
262262
263+
Note that `testing-library` DOM printout is currently disabled for all tests by the following configuration in `src/test/setup.ts`:
264+
```typescript
265+
configure({
266+
getElementError: (message: string) => {
267+
const error = new Error(message);
268+
error.name = 'TestingLibraryElementError';
269+
error.stack = '';
270+
return error;
271+
},
272+
});
273+
```
274+
If you'd like to see the stack printed out you can either temporarily disable the configuration or generate a [Testing Playground](https://testing-playground.com/) link by adding `screen.logTestingPlaygroundURL()` to your test.
275+
263276
### Using MSW data in development
264277
265278
If you want to develop in environment with mocked data, run the command `npm run stage-beta:msw`.

0 commit comments

Comments
 (0)