@toptal/davinci-qa 8.0.1 → 8.0.2-alpha-fx-2755-interactive-workflow-generation.4
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 +9 -7
- package/src/commands/code-metrics.js +4 -4
- package/src/commands/integration-tests.js +9 -9
- package/src/commands/unit-tests.js +17 -17
- package/src/configs/cypress/plugins/webpack-preprocessor.js +10 -10
- package/src/configs/excludeFilesFromCoverage.js +1 -1
- package/src/configs/jest/babel-preprocessor.js +5 -5
- package/src/configs/jest/jss-snapshot-serializer.js +1 -1
- package/src/configs/jest.config.js +6 -7
- package/src/index.js +2 -2
- package/src/reporters/anvil-results-helper.js +3 -3
- package/src/reporters/cypress-anvil-reporter.js +6 -6
- package/src/reporters/jest-anvil-reporter.js +2 -2
- package/src/reporters/test-result-mocks.js +61 -61
- package/src/utils/jest-args-to-cli-converters.js +1 -1
- package/src/utils/to-jest-cli-arguments.js +1 -1
- package/dist-package/package.json +0 -61
- package/src/commands/integration-tests.test.js +0 -69
- package/src/commands/unit-tests.test.js +0 -213
- package/src/configs/cypress/plugins/__snapshots__/extends.test.js.snap +0 -28
- package/src/configs/cypress/plugins/extends.test.js +0 -43
- package/src/configs/jest/export-maps-resolver.js +0 -32
- package/src/reporters/anvil-results-helper.test.js +0 -87
- package/src/reporters/cypress-anvil-reporter.test.js +0 -269
- package/src/reporters/jest-anvil-reporter.test.js +0 -223
- package/src/utils/jest-args-to-cli-converters.test.js +0 -59
- package/src/utils/styled-components-version-check.test.js +0 -81
- package/src/utils/to-jest-cli-arguments.test.js +0 -32
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toptal/davinci-qa",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.2-alpha-fx-2755-interactive-workflow-generation.4+46405792",
|
|
4
4
|
"description": "QA package to test your application",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -36,16 +36,17 @@
|
|
|
36
36
|
"@bahmutov/cypress-extends": "^1.1.0",
|
|
37
37
|
"@cypress/code-coverage": "^3.9.12",
|
|
38
38
|
"@cypress/webpack-preprocessor": "^5.11.0",
|
|
39
|
-
"@testing-library/jest-dom": "^5.
|
|
39
|
+
"@testing-library/jest-dom": "^5.16.4",
|
|
40
40
|
"@testing-library/react": "^12.1.2",
|
|
41
|
-
"@toptal/davinci-cli-shared": "1.5.
|
|
42
|
-
"@types/jest": "^27.
|
|
43
|
-
"babel-jest": "^
|
|
41
|
+
"@toptal/davinci-cli-shared": "1.5.3-alpha-fx-2755-interactive-workflow-generation.4+46405792",
|
|
42
|
+
"@types/jest": "^27.5.1",
|
|
43
|
+
"babel-jest": "^28.1.0",
|
|
44
44
|
"cypress": "^9.7.0",
|
|
45
45
|
"enhanced-resolve": "^5.9.2",
|
|
46
46
|
"fs-extra": "^10.0.0",
|
|
47
47
|
"glob": "^8.0.3",
|
|
48
|
-
"jest": "^
|
|
48
|
+
"jest": "^28.1.0",
|
|
49
|
+
"jest-environment-jsdom": "^28.1.0",
|
|
49
50
|
"jest-html-reporters": "^3.0.6",
|
|
50
51
|
"jest-junit": "^13.1.0",
|
|
51
52
|
"jest-silent-reporter": "^0.5.0",
|
|
@@ -57,5 +58,6 @@
|
|
|
57
58
|
"devDependencies": {
|
|
58
59
|
"json5": "^2.2.1",
|
|
59
60
|
"mocha": "^10.0.0"
|
|
60
|
-
}
|
|
61
|
+
},
|
|
62
|
+
"gitHead": "46405792bfc49fdb4b954b2ca9ddbb9ce8660801"
|
|
61
63
|
}
|
|
@@ -17,12 +17,12 @@ const codeMetricsCommand = async ({ options = [] }) => {
|
|
|
17
17
|
const defaultOptions = {
|
|
18
18
|
name: projectName,
|
|
19
19
|
url: 'https://sonarqube.toptal.net',
|
|
20
|
-
version
|
|
20
|
+
version,
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
const sonarOptions = {
|
|
24
24
|
...defaultOptions,
|
|
25
|
-
...options
|
|
25
|
+
...options,
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
print.yellow(
|
|
@@ -34,7 +34,7 @@ const codeMetricsCommand = async ({ options = [] }) => {
|
|
|
34
34
|
`-Dsonar.host.url=${sonarOptions.url}`,
|
|
35
35
|
`-Dsonar.login=${sonarOptions.login}`,
|
|
36
36
|
'-Dsonar.sources=src',
|
|
37
|
-
'-Dsonar.javascript.lcov.reportPaths=coverage/lcov.info'
|
|
37
|
+
'-Dsonar.javascript.lcov.reportPaths=coverage/lcov.info',
|
|
38
38
|
])
|
|
39
39
|
} catch (err) {
|
|
40
40
|
print.red(err.message)
|
|
@@ -47,7 +47,7 @@ const codeMetricsCommandCreator = {
|
|
|
47
47
|
return codeMetricsCommand({ options })
|
|
48
48
|
},
|
|
49
49
|
allowUnknownOptions: true,
|
|
50
|
-
command: 'code-metrics'
|
|
50
|
+
command: 'code-metrics',
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
module.exports = codeMetricsCommandCreator
|
|
@@ -2,12 +2,12 @@ const {
|
|
|
2
2
|
runSync,
|
|
3
3
|
print,
|
|
4
4
|
convertToCLIParameters,
|
|
5
|
-
files
|
|
5
|
+
files,
|
|
6
6
|
} = require('@toptal/davinci-cli-shared')
|
|
7
7
|
|
|
8
8
|
const integrationTestCommand = ({
|
|
9
9
|
options: { open = false, baseUrl, anvilTag, ...cypressOptions } = {},
|
|
10
|
-
files: testFiles = []
|
|
10
|
+
files: testFiles = [],
|
|
11
11
|
}) => {
|
|
12
12
|
print.green('Running integration tests...')
|
|
13
13
|
|
|
@@ -34,10 +34,10 @@ const integrationTestCommand = ({
|
|
|
34
34
|
'--reporter',
|
|
35
35
|
cypressReporterPath,
|
|
36
36
|
'--reporter-options',
|
|
37
|
-
`anvilTag=${anvilTag}
|
|
37
|
+
`anvilTag=${anvilTag}`,
|
|
38
38
|
]
|
|
39
39
|
: []),
|
|
40
|
-
...convertToCLIParameters(cypressOptions)
|
|
40
|
+
...convertToCLIParameters(cypressOptions),
|
|
41
41
|
])
|
|
42
42
|
}
|
|
43
43
|
|
|
@@ -50,18 +50,18 @@ const integrationCommandCreator = {
|
|
|
50
50
|
options: [
|
|
51
51
|
{
|
|
52
52
|
label: 'opens the Cypress Test Runner',
|
|
53
|
-
name: '--open'
|
|
53
|
+
name: '--open',
|
|
54
54
|
},
|
|
55
55
|
{
|
|
56
56
|
label: "URL used as prefix for cy.visit() or cy.request() command's URL",
|
|
57
|
-
name: '--baseUrl <baseUrl>'
|
|
57
|
+
name: '--baseUrl <baseUrl>',
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
label:
|
|
61
61
|
"the project name matching Anvil's expected tag to generate Anvil Reports",
|
|
62
|
-
name: '--anvilTag <anvilTag>'
|
|
63
|
-
}
|
|
64
|
-
]
|
|
62
|
+
name: '--anvilTag <anvilTag>',
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
module.exports = integrationCommandCreator
|
|
@@ -14,28 +14,28 @@ const defaultCIJestReporters = anvilTag => {
|
|
|
14
14
|
{
|
|
15
15
|
useDots: true,
|
|
16
16
|
showPaths: true,
|
|
17
|
-
showWarnings: true
|
|
18
|
-
}
|
|
17
|
+
showWarnings: true,
|
|
18
|
+
},
|
|
19
19
|
],
|
|
20
20
|
[
|
|
21
21
|
'jest-junit',
|
|
22
22
|
{
|
|
23
|
-
outputDirectory: 'reports'
|
|
24
|
-
}
|
|
23
|
+
outputDirectory: 'reports',
|
|
24
|
+
},
|
|
25
25
|
],
|
|
26
26
|
[
|
|
27
27
|
'jest-html-reporters',
|
|
28
28
|
{
|
|
29
|
-
publicPath: './reports'
|
|
30
|
-
}
|
|
31
|
-
]
|
|
29
|
+
publicPath: './reports',
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
32
|
]
|
|
33
33
|
|
|
34
34
|
const anvilReporter = [
|
|
35
35
|
getRootProjectPath('../reporters/jest-anvil-reporter.js'),
|
|
36
36
|
{
|
|
37
|
-
anvilTag: anvilTag
|
|
38
|
-
}
|
|
37
|
+
anvilTag: anvilTag,
|
|
38
|
+
},
|
|
39
39
|
]
|
|
40
40
|
|
|
41
41
|
return anvilTag ? reporters.concat([anvilReporter]) : reporters
|
|
@@ -44,7 +44,7 @@ const defaultCIJestReporters = anvilTag => {
|
|
|
44
44
|
// eslint-disable-next-line max-statements
|
|
45
45
|
const unitTestsCommand = ({
|
|
46
46
|
options: { anvilTag, ...jestOptions } = {},
|
|
47
|
-
files: testPathPattern = []
|
|
47
|
+
files: testPathPattern = [],
|
|
48
48
|
}) => {
|
|
49
49
|
print.green('Running unit tests...')
|
|
50
50
|
|
|
@@ -64,7 +64,7 @@ const unitTestsCommand = ({
|
|
|
64
64
|
|
|
65
65
|
const isCi = process.env.CI || jestOptions.ci || jestOptions.coverage
|
|
66
66
|
const defaultOptions = {
|
|
67
|
-
config: jestConfigPath
|
|
67
|
+
config: jestConfigPath,
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
if (isCi) {
|
|
@@ -81,7 +81,7 @@ const unitTestsCommand = ({
|
|
|
81
81
|
if (!isConfigFileHasCollectCoverageFrom) {
|
|
82
82
|
defaultOptions.collectCoverageFrom = [
|
|
83
83
|
'src/**/*.(ts|tsx)',
|
|
84
|
-
...excludedFilesFromCoverage.map(globPath => `!${globPath}`)
|
|
84
|
+
...excludedFilesFromCoverage.map(globPath => `!${globPath}`),
|
|
85
85
|
]
|
|
86
86
|
}
|
|
87
87
|
|
|
@@ -108,7 +108,7 @@ const unitTestsCommand = ({
|
|
|
108
108
|
|
|
109
109
|
const options = {
|
|
110
110
|
testPathPattern,
|
|
111
|
-
...toJestCLIArguments({ ...defaultOptions, ...jestOptions })
|
|
111
|
+
...toJestCLIArguments({ ...defaultOptions, ...jestOptions }),
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
print.grey('Jest arguments:', options)
|
|
@@ -130,14 +130,14 @@ const unitTestsCommandCreator = {
|
|
|
130
130
|
{
|
|
131
131
|
label:
|
|
132
132
|
'a list of paths to modules that run some code to configure or set up the testing framework before each test file in the suite is executed',
|
|
133
|
-
name: '--setupFilesAfterEnv <setupFilesAfterEnv>'
|
|
133
|
+
name: '--setupFilesAfterEnv <setupFilesAfterEnv>',
|
|
134
134
|
},
|
|
135
135
|
{
|
|
136
136
|
label:
|
|
137
137
|
"the project name matching Anvil's expected tag. Used to generate Anvil-compatible test reports.",
|
|
138
|
-
name: '--anvilTag <anvilTag>'
|
|
139
|
-
}
|
|
140
|
-
]
|
|
138
|
+
name: '--anvilTag <anvilTag>',
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
module.exports = unitTestsCommandCreator
|
|
@@ -13,21 +13,21 @@ const options = {
|
|
|
13
13
|
loader: 'babel-loader',
|
|
14
14
|
options: {
|
|
15
15
|
presets: ['@babel/preset-env'],
|
|
16
|
-
plugins: ['istanbul']
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
]
|
|
20
|
-
}
|
|
21
|
-
]
|
|
16
|
+
plugins: ['istanbul'],
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
22
|
},
|
|
23
23
|
resolve: {
|
|
24
|
-
extensions: ['.tsx', '.ts', '.jsx', '.js']
|
|
25
|
-
}
|
|
24
|
+
extensions: ['.tsx', '.ts', '.jsx', '.js'],
|
|
25
|
+
},
|
|
26
26
|
},
|
|
27
|
-
watchOptions: {}
|
|
27
|
+
watchOptions: {},
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
module.exports = {
|
|
31
31
|
options,
|
|
32
|
-
webpackPreprocessor: webpack(options)
|
|
32
|
+
webpackPreprocessor: webpack(options),
|
|
33
33
|
}
|
|
@@ -4,14 +4,14 @@ const babelOptions = {
|
|
|
4
4
|
'@babel/preset-env',
|
|
5
5
|
{
|
|
6
6
|
targets: {
|
|
7
|
-
node: 'current'
|
|
8
|
-
}
|
|
9
|
-
}
|
|
7
|
+
node: 'current',
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
10
|
],
|
|
11
11
|
'@babel/preset-typescript',
|
|
12
|
-
'@babel/preset-react'
|
|
12
|
+
'@babel/preset-react',
|
|
13
13
|
],
|
|
14
|
-
plugins: ['babel-plugin-styled-components']
|
|
14
|
+
plugins: ['babel-plugin-styled-components'],
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
module.exports = require('babel-jest').default.createTransformer(babelOptions)
|
|
@@ -37,7 +37,7 @@ module.exports = {
|
|
|
37
37
|
),
|
|
38
38
|
'^@modules(.*)$': '<rootDir>/src/modules$1',
|
|
39
39
|
'^@src(.*)$': '<rootDir>/src$1',
|
|
40
|
-
'^~(.*)$': '<rootDir>/src$1'
|
|
40
|
+
'^~(.*)$': '<rootDir>/src$1',
|
|
41
41
|
},
|
|
42
42
|
|
|
43
43
|
/**
|
|
@@ -47,7 +47,7 @@ module.exports = {
|
|
|
47
47
|
modulePathIgnorePatterns: [
|
|
48
48
|
'<rootDir>/.*/__mocks__',
|
|
49
49
|
'/dist-package',
|
|
50
|
-
'/dist'
|
|
50
|
+
'/dist',
|
|
51
51
|
],
|
|
52
52
|
resetMocks: true,
|
|
53
53
|
restoreMocks: true,
|
|
@@ -56,7 +56,7 @@ module.exports = {
|
|
|
56
56
|
|
|
57
57
|
setupFilesAfterEnv: [
|
|
58
58
|
'@testing-library/jest-dom/extend-expect',
|
|
59
|
-
getAbsolutePath('./jest/tests-setup.js')
|
|
59
|
+
getAbsolutePath('./jest/tests-setup.js'),
|
|
60
60
|
],
|
|
61
61
|
|
|
62
62
|
/*
|
|
@@ -68,19 +68,18 @@ module.exports = {
|
|
|
68
68
|
testMatch: [
|
|
69
69
|
'**/test.(js|jsx|ts|tsx)',
|
|
70
70
|
'**/*.test.(js|jsx|ts|tsx)',
|
|
71
|
-
'**/__tests__/*.test.(js|jsx|ts|tsx)'
|
|
71
|
+
'**/__tests__/*.test.(js|jsx|ts|tsx)',
|
|
72
72
|
],
|
|
73
73
|
testPathIgnorePatterns: [
|
|
74
74
|
'/node_modules/',
|
|
75
75
|
'/build/',
|
|
76
76
|
'/dist/',
|
|
77
|
-
'/dist-package/'
|
|
77
|
+
'/dist-package/',
|
|
78
78
|
],
|
|
79
79
|
transform: {
|
|
80
|
-
'^.+\\.(js|jsx|ts|tsx)$': getAbsolutePath('./jest/babel-preprocessor.js')
|
|
80
|
+
'^.+\\.(js|jsx|ts|tsx)$': getAbsolutePath('./jest/babel-preprocessor.js'),
|
|
81
81
|
},
|
|
82
82
|
|
|
83
83
|
transformIgnorePatterns: ['node_modules/(?!@toptal|@topkit)'],
|
|
84
84
|
verbose: true,
|
|
85
|
-
resolver: getAbsolutePath('./jest/export-maps-resolver.js')
|
|
86
85
|
}
|
package/src/index.js
CHANGED
|
@@ -12,7 +12,7 @@ const anvilMapper = ({
|
|
|
12
12
|
backtrace,
|
|
13
13
|
testType,
|
|
14
14
|
pendingMessage,
|
|
15
|
-
tag
|
|
15
|
+
tag,
|
|
16
16
|
}) => ({
|
|
17
17
|
file_name: fileName,
|
|
18
18
|
line_number: lineNumber,
|
|
@@ -24,7 +24,7 @@ const anvilMapper = ({
|
|
|
24
24
|
backtrace,
|
|
25
25
|
test_type: testType,
|
|
26
26
|
pending_message: pendingMessage,
|
|
27
|
-
tag
|
|
27
|
+
tag,
|
|
28
28
|
})
|
|
29
29
|
|
|
30
30
|
const generateAnvilResults = (fileName, testResults) => {
|
|
@@ -42,5 +42,5 @@ const generateAnvilResults = (fileName, testResults) => {
|
|
|
42
42
|
|
|
43
43
|
module.exports = {
|
|
44
44
|
anvilMapper,
|
|
45
|
-
generateAnvilResults
|
|
45
|
+
generateAnvilResults,
|
|
46
46
|
}
|
|
@@ -9,7 +9,7 @@ const {
|
|
|
9
9
|
EVENT_TEST_FAIL,
|
|
10
10
|
EVENT_TEST_PASS,
|
|
11
11
|
EVENT_TEST_PENDING,
|
|
12
|
-
EVENT_TEST_RETRY
|
|
12
|
+
EVENT_TEST_RETRY,
|
|
13
13
|
} = Runner.constants
|
|
14
14
|
|
|
15
15
|
class CypressAnvilReporter extends Base {
|
|
@@ -54,7 +54,7 @@ class CypressAnvilReporter extends Base {
|
|
|
54
54
|
backtrace: test?.err?.stack || null,
|
|
55
55
|
testType: 'integration',
|
|
56
56
|
pendingMessage: null,
|
|
57
|
-
tag: anvilTag
|
|
57
|
+
tag: anvilTag,
|
|
58
58
|
})
|
|
59
59
|
)
|
|
60
60
|
})
|
|
@@ -71,7 +71,7 @@ class CypressAnvilReporter extends Base {
|
|
|
71
71
|
backtrace: test?.err?.stack || null,
|
|
72
72
|
testType: 'integration',
|
|
73
73
|
pendingMessage: null,
|
|
74
|
-
tag: anvilTag
|
|
74
|
+
tag: anvilTag,
|
|
75
75
|
})
|
|
76
76
|
)
|
|
77
77
|
})
|
|
@@ -88,7 +88,7 @@ class CypressAnvilReporter extends Base {
|
|
|
88
88
|
backtrace: test?.err?.stack || null,
|
|
89
89
|
testType: 'integration',
|
|
90
90
|
pendingMessage: null,
|
|
91
|
-
tag: anvilTag
|
|
91
|
+
tag: anvilTag,
|
|
92
92
|
})
|
|
93
93
|
)
|
|
94
94
|
})
|
|
@@ -105,13 +105,13 @@ class CypressAnvilReporter extends Base {
|
|
|
105
105
|
backtrace: test?.err?.stack || null,
|
|
106
106
|
testType: 'integration',
|
|
107
107
|
pendingMessage: null,
|
|
108
|
-
tag: anvilTag
|
|
108
|
+
tag: anvilTag,
|
|
109
109
|
})
|
|
110
110
|
)
|
|
111
111
|
})
|
|
112
112
|
.once(EVENT_RUN_END, () => {
|
|
113
113
|
generateAnvilResults('anvil_cypress_test_results.json', {
|
|
114
|
-
test_results: tests
|
|
114
|
+
test_results: tests,
|
|
115
115
|
})
|
|
116
116
|
})
|
|
117
117
|
}
|
|
@@ -46,11 +46,11 @@ class JestAnvilReporter {
|
|
|
46
46
|
: null,
|
|
47
47
|
testType: 'unit',
|
|
48
48
|
pendingMessage: null,
|
|
49
|
-
tag: this._options.anvilTag
|
|
49
|
+
tag: this._options.anvilTag,
|
|
50
50
|
})
|
|
51
51
|
})
|
|
52
52
|
const anvilPayload = {
|
|
53
|
-
test_results: [...anvilTestResults]
|
|
53
|
+
test_results: [...anvilTestResults],
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
generateAnvilResults('anvil_jest_test_results.json', anvilPayload)
|