Skip to content

Commit 64c14de

Browse files
authored
fix: Integrate front-end jest tests with datadog reporting (#286)
Fixes #244 - Adds `jest-junit` - Configures `jest-junit` to output `junit.xml` in `site/test_results` - Uploads the emitted `junit.xml` to datadog as part of the `test/js` workflow
1 parent 6717932 commit 64c14de

File tree

7 files changed

+50
-1
lines changed

7 files changed

+50
-1
lines changed

.github/workflows/coder.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,11 @@ jobs:
239239
.eslintcache
240240
key: js-${{ runner.os }}-test-${{ hashFiles('**/yarn.lock') }}
241241

242+
# Go is required for uploading the test results to datadog
243+
- uses: actions/setup-go@v2
244+
with:
245+
go-version: "^1.17"
246+
242247
- uses: actions/setup-node@v2
243248
with:
244249
node-version: "14"
@@ -262,3 +267,11 @@ jobs:
262267
files: ./site/coverage/lcov.info
263268
flags: unittest-js
264269
fail_ci_if_error: true
270+
271+
- name: Upload DataDog Trace
272+
if: (success() || failure()) && github.actor != 'dependabot[bot]'
273+
env:
274+
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
275+
DD_DATABASE: postgresql
276+
GIT_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
277+
run: go run scripts/datadog-cireport/main.go site/test_results/junit.xml

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ site/.eslintcache
2020
site/.next/
2121
site/node_modules/
2222
site/storybook-static/
23+
site/test_results/
2324
site/yarn-error.log
2425
coverage/
2526

site/.eslintignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ vendor
66
out
77
coverage
88
.next
9-
storybook-static
9+
storybook-static
10+
test_results

site/.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ yarn-error.log
1515
coverage/
1616
out/
1717
storybook-static/
18+
test_results/

site/jest.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module.exports = {
99
coverageReporters: ["text", "lcov"],
1010
displayName: "test",
1111
preset: "ts-jest",
12+
1213
roots: ["<rootDir>"],
1314
setupFilesAfterEnv: ["<rootDir>/_jest/setupTests.ts"],
1415
transform: {
@@ -43,4 +44,15 @@ module.exports = {
4344
"!<rootDir>/out/**/*.*",
4445
"!<rootDir>/storybook-static/**/*.*",
4546
],
47+
reporters: [
48+
"default",
49+
[
50+
"jest-junit",
51+
{
52+
suiteName: "Front-end Jest Tests",
53+
outputDirectory: "./test_results",
54+
outputName: "junit.xml",
55+
},
56+
],
57+
],
4658
}

site/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"formik": "2.2.9",
5151
"http-proxy-middleware": "2.0.3",
5252
"jest": "27.5.1",
53+
"jest-junit": "13.0.0",
5354
"jest-runner-eslint": "1.0.0",
5455
"next": "12.0.10",
5556
"next-router-mock": "^0.6.5",

site/yarn.lock

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7931,6 +7931,16 @@ jest-jasmine2@^27.5.1:
79317931
pretty-format "^27.5.1"
79327932
throat "^6.0.1"
79337933

7934+
jest-junit@13.0.0:
7935+
version "13.0.0"
7936+
resolved "https://registry.yarnpkg.com/jest-junit/-/jest-junit-13.0.0.tgz#479be347457aad98ae8a5983a23d7c3ec526c9a3"
7937+
integrity sha512-JSHR+Dhb32FGJaiKkqsB7AR3OqWKtldLd6ZH2+FJ8D4tsweb8Id8zEVReU4+OlrRO1ZluqJLQEETm+Q6/KilBg==
7938+
dependencies:
7939+
mkdirp "^1.0.4"
7940+
strip-ansi "^6.0.1"
7941+
uuid "^8.3.2"
7942+
xml "^1.0.1"
7943+
79347944
jest-leak-detector@^27.5.1:
79357945
version "27.5.1"
79367946
resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-27.5.1.tgz#6ec9d54c3579dd6e3e66d70e3498adf80fde3fb8"
@@ -12087,6 +12097,11 @@ uuid@^3.3.2:
1208712097
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
1208812098
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==
1208912099

12100+
uuid@^8.3.2:
12101+
version "8.3.2"
12102+
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
12103+
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
12104+
1209012105
v8-compile-cache-lib@^3.0.0:
1209112106
version "3.0.0"
1209212107
resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz#0582bcb1c74f3a2ee46487ceecf372e46bce53e8"
@@ -12452,6 +12467,11 @@ xml-name-validator@^3.0.0:
1245212467
resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a"
1245312468
integrity sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==
1245412469

12470+
xml@^1.0.1:
12471+
version "1.0.1"
12472+
resolved "https://registry.yarnpkg.com/xml/-/xml-1.0.1.tgz#78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5"
12473+
integrity sha1-eLpyAgApxbyHuKgaPPzXS0ovweU=
12474+
1245512475
xmlchars@^2.2.0:
1245612476
version "2.2.0"
1245712477
resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy