@toptal/davinci-qa 5.0.2-alpha-tph-1237-github-test-results.1301 → 5.0.2-alpha-tph-1237-github-test-results.1302
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toptal/davinci-qa",
|
|
3
|
-
"version": "5.0.2-alpha-tph-1237-github-test-results.
|
|
3
|
+
"version": "5.0.2-alpha-tph-1237-github-test-results.1302+dcf5e8e",
|
|
4
4
|
"description": "QA package to test your application",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@cypress/webpack-preprocessor": "^5.7.0",
|
|
37
37
|
"@testing-library/jest-dom": "^5.14.1",
|
|
38
38
|
"@testing-library/react": "^12.0.0",
|
|
39
|
-
"@toptal/davinci-cli-shared": "1.4.2-alpha-tph-1237-github-test-results.
|
|
39
|
+
"@toptal/davinci-cli-shared": "1.4.2-alpha-tph-1237-github-test-results.1302+dcf5e8e",
|
|
40
40
|
"@types/jest": "^26.0.15",
|
|
41
41
|
"babel-jest": "^26.3.0",
|
|
42
42
|
"cypress": "^8.6.0",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"matchmedia-polyfill": "^0.3.2",
|
|
51
51
|
"semver": "^7.3.2"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "dcf5e8e895eb9fe3d5823b00c559fe84c8c289c6"
|
|
54
54
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
const { print, files } = require('@toptal/davinci-cli-shared')
|
|
2
2
|
const jest = require('jest')
|
|
3
|
+
const path = require('path')
|
|
3
4
|
|
|
4
5
|
const excludedFilesFromCoverage = require('../configs/excludeFilesFromCoverage')
|
|
5
6
|
const styledComponentsVersionCheck = require('../utils/styled-components-version-check')
|
|
6
7
|
const toJestCLIArguments = require('../utils/to-jest-cli-arguments')
|
|
8
|
+
const getAbsolutePath = relativePath => path.join(__dirname, relativePath)
|
|
7
9
|
|
|
8
10
|
const defaultCIJestReporters = [
|
|
9
11
|
[
|
|
@@ -22,9 +24,7 @@ const defaultCIJestReporters = [
|
|
|
22
24
|
'publicPath': './reports',
|
|
23
25
|
}
|
|
24
26
|
],
|
|
25
|
-
|
|
26
|
-
'<rootDir>/packages/qa/src/reporters/jest-anvil-reporter.js'
|
|
27
|
-
]
|
|
27
|
+
getAbsolutePath('../reporters/jest-anvil-reporter.js')
|
|
28
28
|
]
|
|
29
29
|
|
|
30
30
|
const unitTestsCommand = ({
|
|
@@ -65,9 +65,12 @@ const unitTestsCommand = ({
|
|
|
65
65
|
|
|
66
66
|
// to show smaller log of tests running on CI
|
|
67
67
|
// and a nicer html report
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
if (jestOptions.reporters) {
|
|
69
|
+
defaultOptions.reporters = jestOptions.reporters
|
|
70
|
+
} else {
|
|
71
|
+
defaultOptions.testLocationInResults = true // allows reporters to return test line number
|
|
72
|
+
defaultOptions.reporters = defaultCIJestReporters
|
|
73
|
+
}
|
|
71
74
|
}
|
|
72
75
|
|
|
73
76
|
const options = {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const { print } = require('@toptal/davinci-cli-shared')
|
|
1
2
|
const fs = require('fs')
|
|
2
3
|
|
|
3
4
|
class JestAnvilReporter {
|
|
@@ -7,11 +8,14 @@ class JestAnvilReporter {
|
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
onRunComplete(contexts, results) {
|
|
11
|
+
print.grey('Starting Anvil processing...')
|
|
12
|
+
console.time('Anvil reporter run')
|
|
10
13
|
const fileTestResults = results.testResults
|
|
11
|
-
const
|
|
12
|
-
|
|
14
|
+
const runPath = process.cwd()
|
|
15
|
+
const individualTestResults = fileTestResults.flatMap(fileTestResult => {
|
|
16
|
+
const fileName = fileTestResult.testFilePath.replace(runPath, '.')
|
|
13
17
|
return fileTestResult.testResults.map(res => ({ ...res, fileName }))
|
|
14
|
-
})
|
|
18
|
+
})
|
|
15
19
|
const anvilTestResults = individualTestResults.map(testResult => {
|
|
16
20
|
return {
|
|
17
21
|
file_name: testResult.fileName,
|
|
@@ -32,11 +36,11 @@ class JestAnvilReporter {
|
|
|
32
36
|
}
|
|
33
37
|
fs.writeFileSync('./anvil_test_results.json', JSON.stringify(anvilPayload, undefined, 2), err => {
|
|
34
38
|
if (err) {
|
|
35
|
-
|
|
39
|
+
print.red('Failed to create anvil test results', err)
|
|
36
40
|
throw err
|
|
37
41
|
}
|
|
38
|
-
console.log('Test results created successfully!');
|
|
39
42
|
})
|
|
43
|
+
console.timeEnd('Anvil reporter run')
|
|
40
44
|
}
|
|
41
45
|
}
|
|
42
46
|
|