File tree Expand file tree Collapse file tree 1 file changed +25
-14
lines changed Expand file tree Collapse file tree 1 file changed +25
-14
lines changed Original file line number Diff line number Diff line change @@ -318,29 +318,40 @@ A working `.circleci/config.yml` section might look like this:
318
318
// karma.conf.js
319
319
320
320
// additional config...
321
-
322
- reporters: ['junit'],
323
-
324
- junitReporter: {
325
- outputDir : process.env.JUNIT_REPORT_PATH ,
326
- outputFile: process.env.JUNIT_REPORT_NAME,
327
- useBrowserName: false
328
- },
321
+ {
322
+ reporters: ['junit'],
323
+ junitReporter: {
324
+ outputDir: process.env.JUNIT_REPORT_PATH,
325
+ outputFile : process.env.JUNIT_REPORT_NAME ,
326
+ useBrowserName: false
327
+ },
328
+ }
329
329
// additional config...
330
330
` ` `
331
331
332
332
# ### Jest
333
333
334
- To collect Jest data, add a JUnit coverage reporter by running :
334
+ To collect Jest data,
335
+ first create a Jest config file called `jest.config.js` with the following :
335
336
336
- yarn add --dev jest-junit
337
+ ` ` ` javascript
338
+ // jest.config.js
339
+ {
340
+ reporters: ["default", "jest-junit"],
341
+ }
342
+ ` ` `
337
343
338
- In your configuration, form a command to output using the reporter :
344
+ In your `.circleci/config.yml`,
345
+ add the following `run` steps :
339
346
340
347
` ` ` yaml
341
- - run:
342
- name: Jest Suite
343
- command: yarn jest tests --ci --testResultsProcessor="jest-junit"
348
+ steps:
349
+ - run:
350
+ name: Install JUnit coverage reporter
351
+ run: yarn add --dev jest-junit
352
+ - run:
353
+ name: Run tests with JUnit as reporter
354
+ command: jest --ci --reporters=default --reporters=jest-junit
344
355
environment:
345
356
JEST_JUNIT_OUTPUT: "reports/junit/js-test-results.xml"
346
357
` ` `
You can’t perform that action at this time.
0 commit comments