@toptal/davinci-qa 5.0.2-alpha-fx-2156-improve-build-performance.1302 → 5.0.2-alpha-tph-1237-github-test-results.1301

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-fx-2156-improve-build-performance.1302+4dbc440",
3
+ "version": "5.0.2-alpha-tph-1237-github-test-results.1301+9f4e3ce",
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-fx-2156-improve-build-performance.1302+4dbc440",
39
+ "@toptal/davinci-cli-shared": "1.4.2-alpha-tph-1237-github-test-results.1301+9f4e3ce",
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": "4dbc440ef664502a9b5c91a33fe52a5602bd8a97"
53
+ "gitHead": "9f4e3ce38bd9fa542410115c3657d0205c755bac"
54
54
  }
@@ -21,6 +21,9 @@ const defaultCIJestReporters = [
21
21
  'jest-html-reporters', {
22
22
  'publicPath': './reports',
23
23
  }
24
+ ],
25
+ [
26
+ '<rootDir>/packages/qa/src/reporters/jest-anvil-reporter.js'
24
27
  ]
25
28
  ]
26
29
 
@@ -0,0 +1,43 @@
1
+ const fs = require('fs')
2
+
3
+ class JestAnvilReporter {
4
+ constructor(globalConfig, options) {
5
+ this._globalConfig = globalConfig
6
+ this._options = options
7
+ }
8
+
9
+ onRunComplete(contexts, results) {
10
+ const fileTestResults = results.testResults
11
+ const individualTestResults = fileTestResults.map(fileTestResult => {
12
+ const fileName = fileTestResult.testFilePath.replace(process.cwd(), '.')
13
+ return fileTestResult.testResults.map(res => ({ ...res, fileName }))
14
+ }).flat()
15
+ const anvilTestResults = individualTestResults.map(testResult => {
16
+ return {
17
+ file_name: testResult.fileName,
18
+ line_number: testResult.location.line,
19
+ status: testResult.status,
20
+ duration: testResult.duration,
21
+ scenario_name: testResult.ancestorTitles.concat(testResult.title).join('/'),
22
+ description: testResult.title,
23
+ error: testResult?.failureDetails[0] ? testResult.failureDetails[0].message : null,
24
+ backtrace: testResult?.failureDetails[0] ? testResult.failureDetails[0].stack : null,
25
+ tag: 'platform', // TODO - change it so projects can modify it
26
+ }
27
+ })
28
+ const anvilPayload = {
29
+ "test_results": [
30
+ anvilTestResults
31
+ ]
32
+ }
33
+ fs.writeFileSync('./anvil_test_results.json', JSON.stringify(anvilPayload, undefined, 2), err => {
34
+ if (err) {
35
+ console.log('Failed to create anvil test results', err)
36
+ throw err
37
+ }
38
+ console.log('Test results created successfully!');
39
+ })
40
+ }
41
+ }
42
+
43
+ module.exports = JestAnvilReporter
@@ -0,0 +1,111 @@
1
+ SUCCESS = {
2
+ numFailedTestSuites: 0,
3
+ numFailedTests: 0,
4
+ numPassedTestSuites: 3,
5
+ numPassedTests: 13,
6
+ numPendingTestSuites: 0,
7
+ numPendingTests: 0,
8
+ numRuntimeErrorTestSuites: 0,
9
+ numTodoTests: 0,
10
+ numTotalTestSuites: 3,
11
+ numTotalTests: 13,
12
+ openHandles: [
13
+ ],
14
+ snapshot: {
15
+ added: 0,
16
+ didUpdate: false,
17
+ failure: false,
18
+ filesAdded: 0,
19
+ filesRemoved: 0,
20
+ filesRemovedList: [
21
+ ],
22
+ filesUnmatched: 0,
23
+ filesUpdated: 0,
24
+ matched: 0,
25
+ total: 0,
26
+ unchecked: 0,
27
+ uncheckedKeysByFile: [
28
+ ],
29
+ unmatched: 0,
30
+ updated: 0,
31
+ },
32
+ startTime: 1635357418106,
33
+ success: false,
34
+ testResults: [
35
+ {
36
+ leaks: false,
37
+ numFailingTests: 0,
38
+ numPassingTests: 6,
39
+ numPendingTests: 0,
40
+ numTodoTests: 0,
41
+ openHandles: [
42
+ ],
43
+ perfStats: {
44
+ end: 1635357420742,
45
+ runtime: 1193,
46
+ slow: false,
47
+ start: 1635357419549,
48
+ },
49
+ skipped: false,
50
+ snapshot: {
51
+ added: 0,
52
+ fileDeleted: false,
53
+ matched: 0,
54
+ unchecked: 0,
55
+ unmatched: 0,
56
+ updated: 0,
57
+ uncheckedKeys: [
58
+ ],
59
+ },
60
+ testFilePath: "/Users/Toptal/git/davinci/packages/qa/src/utils/styled-components-version-check.test.js",
61
+ testResults: [
62
+ {
63
+ ancestorTitles: [
64
+ "styled-components version check",
65
+ "has wrong (^4.4.1) SC version in dependencies",
66
+ ],
67
+ duration: 7,
68
+ failureDetails: [
69
+ ],
70
+ failureMessages: [
71
+ ],
72
+ fullName: "styled-components version check has wrong (^4.4.1) SC version in dependencies should throw an error",
73
+ location: {
74
+ column: 4,
75
+ line: 44,
76
+ },
77
+ numPassingAsserts: 0,
78
+ status: "passed",
79
+ title: "should throw an error",
80
+ },
81
+ {
82
+ ancestorTitles: [
83
+ "styled-components version check",
84
+ "has correct (^5.0.1) SC version in dependencies",
85
+ ],
86
+ duration: 1,
87
+ failureDetails: [
88
+ ],
89
+ failureMessages: [
90
+ ],
91
+ fullName: "styled-components version check has correct (^5.0.1) SC version in dependencies should NOT throw an error",
92
+ location: {
93
+ column: 4,
94
+ line: 50,
95
+ },
96
+ numPassingAsserts: 0,
97
+ status: "passed",
98
+ title: "should NOT throw an error",
99
+ },
100
+ ],
101
+ console: undefined,
102
+ failureMessage: null,
103
+ displayName: undefined,
104
+ sourceMaps: undefined,
105
+ coverage: undefined,
106
+ }
107
+ ],
108
+ wasInterrupted: false,
109
+ }
110
+
111
+ module.exports = SUCCESS