@toptal/davinci-monorepo 8.1.4-alpha-CRT-5891-create-coverage-command-2488e674.2 → 8.1.4-alpha-CRT-5891-create-coverage-command-23386c1d.2
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 +3 -3
- package/src/commands/coverage.js +2 -2
- package/src/commands/generate-team-coverage.js +9 -7
- package/src/commands/group-coverage-by-codeowners.js +7 -4
- package/src/commands/__snapshots__/group-coverage-by-codeowners.test.js.snap +0 -61
- package/src/commands/group-coverage-by-codeowners.test.js +0 -23
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toptal/davinci-monorepo",
|
|
3
|
-
"version": "8.1.4-alpha-CRT-5891-create-coverage-command-
|
|
3
|
+
"version": "8.1.4-alpha-CRT-5891-create-coverage-command-23386c1d.2+23386c1d",
|
|
4
4
|
"description": "Monorepo utility tools",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@nodelib/fs.walk": "^1.2.6",
|
|
37
37
|
"@oclif/core": "^1.16.1",
|
|
38
|
-
"@toptal/davinci-cli-shared": "2.3.1-alpha-CRT-5891-create-coverage-command-
|
|
38
|
+
"@toptal/davinci-cli-shared": "2.3.1-alpha-CRT-5891-create-coverage-command-23386c1d.34+23386c1d",
|
|
39
39
|
"chalk": "^4.1.2",
|
|
40
40
|
"codeowners": "5.1.1",
|
|
41
41
|
"dependency-cruiser": "^12.5.0",
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@jest/globals": "^29.4.2"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "23386c1d709c03d921ae81f6e8ede8bbaccd64aa"
|
|
57
57
|
}
|
package/src/commands/coverage.js
CHANGED
|
@@ -4,8 +4,8 @@ import { groupCoverageByCodeownersCommand } from './group-coverage-by-codeowners
|
|
|
4
4
|
export const coverageCommand = program => {
|
|
5
5
|
const coverage = program.createCommand('coverage').description('TODO ..')
|
|
6
6
|
|
|
7
|
-
generateTeamCoverageCommand(
|
|
8
|
-
groupCoverageByCodeownersCommand(
|
|
7
|
+
generateTeamCoverageCommand(coverage)
|
|
8
|
+
groupCoverageByCodeownersCommand(coverage)
|
|
9
9
|
|
|
10
10
|
return coverage
|
|
11
11
|
}
|
|
@@ -2,6 +2,7 @@ import path from 'path'
|
|
|
2
2
|
import * as url from 'url'
|
|
3
3
|
import execa from 'execa'
|
|
4
4
|
import fs from 'fs'
|
|
5
|
+
import { print } from '@toptal/davinci-cli-shared'
|
|
5
6
|
|
|
6
7
|
import Codeowners from './codeowners/core/codeowners/codeowners.js'
|
|
7
8
|
|
|
@@ -14,7 +15,9 @@ const sanitizeNycPercentage = percentage =>
|
|
|
14
15
|
percentage === 'Unknown' ? 0 : percentage
|
|
15
16
|
|
|
16
17
|
// eslint-disable-next-line max-statements
|
|
17
|
-
const generateTeamCoverage = async
|
|
18
|
+
const generateTeamCoverage = async options => {
|
|
19
|
+
print.header('generateTeamCoverage')
|
|
20
|
+
|
|
18
21
|
const codeowners = new Codeowners(rootProjectPath)
|
|
19
22
|
|
|
20
23
|
const ownerEntries = codeowners.ownerEntries
|
|
@@ -66,15 +69,12 @@ const generateTeamCoverage = async () => {
|
|
|
66
69
|
const results = []
|
|
67
70
|
const created_at = new Date().toISOString()
|
|
68
71
|
|
|
69
|
-
// TODO pass it as param
|
|
70
|
-
const repo = 'client-portal'
|
|
71
|
-
|
|
72
72
|
for await (const team of teams) {
|
|
73
73
|
const sanitizedTeam = sanitizeTeamName(team)
|
|
74
74
|
const result = {
|
|
75
75
|
created_at,
|
|
76
76
|
team,
|
|
77
|
-
repo,
|
|
77
|
+
repo: options.repository,
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
const jestCoverageSummary = JSON.parse(
|
|
@@ -127,12 +127,14 @@ const generateTeamCoverage = async () => {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
export const generateTeamCoverageCommand = program => {
|
|
130
|
+
print.header('generateTeamCoverageCommand')
|
|
131
|
+
|
|
130
132
|
return program
|
|
131
|
-
.
|
|
133
|
+
.command('generate-team-coverage')
|
|
132
134
|
.description('TODO: generate-team-coverage')
|
|
133
135
|
.requiredOption(
|
|
134
136
|
'-r, --repository <repository_name>',
|
|
135
137
|
'specify repository name'
|
|
136
138
|
)
|
|
137
|
-
.action(
|
|
139
|
+
.action(options => generateTeamCoverage(options))
|
|
138
140
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import path from 'path'
|
|
2
2
|
import fs from 'fs'
|
|
3
3
|
import * as url from 'url'
|
|
4
|
+
import { print } from '@toptal/davinci-cli-shared'
|
|
4
5
|
|
|
5
6
|
import Codeowners from './codeowners/core/codeowners/codeowners.js'
|
|
6
7
|
|
|
@@ -74,8 +75,8 @@ const getAllTeams = codeowners => {
|
|
|
74
75
|
return uniqueTeams
|
|
75
76
|
}
|
|
76
77
|
|
|
77
|
-
const groupCoverageByCodeowners = async
|
|
78
|
-
|
|
78
|
+
const groupCoverageByCodeowners = async () => {
|
|
79
|
+
print.header('groupCoverageByCodeowners')
|
|
79
80
|
|
|
80
81
|
const jestReport = readJestCoverageReport()
|
|
81
82
|
const cypressReport = readCypressCoverageReport()
|
|
@@ -88,12 +89,14 @@ const groupCoverageByCodeowners = async options => {
|
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
export const groupCoverageByCodeownersCommand = program => {
|
|
92
|
+
print.header('groupCoverageByCodeownersCommand')
|
|
93
|
+
|
|
91
94
|
return program
|
|
92
|
-
.
|
|
95
|
+
.command('group-coverage-by-codeowners')
|
|
93
96
|
.description('TODO: group-coverage-by-codeowners')
|
|
94
97
|
.requiredOption(
|
|
95
98
|
'-r, --repository <repository_name>',
|
|
96
99
|
'specify repository name'
|
|
97
100
|
)
|
|
98
|
-
.action(
|
|
101
|
+
.action(groupCoverageByCodeowners)
|
|
99
102
|
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`groupCoverageByCodeownersCommand has the correct command structure 1`] = `
|
|
4
|
-
"{
|
|
5
|
-
"_events": {},
|
|
6
|
-
"_eventsCount": 1,
|
|
7
|
-
"commands": [],
|
|
8
|
-
"options": [
|
|
9
|
-
{
|
|
10
|
-
"flags": "-r, --repository <repository_name>",
|
|
11
|
-
"description": "specify repository name",
|
|
12
|
-
"required": true,
|
|
13
|
-
"optional": false,
|
|
14
|
-
"variadic": false,
|
|
15
|
-
"mandatory": true,
|
|
16
|
-
"short": "-r",
|
|
17
|
-
"long": "--repository",
|
|
18
|
-
"negate": false,
|
|
19
|
-
"hidden": false,
|
|
20
|
-
"conflictsWith": []
|
|
21
|
-
}
|
|
22
|
-
],
|
|
23
|
-
"parent": null,
|
|
24
|
-
"_allowUnknownOption": false,
|
|
25
|
-
"_allowExcessArguments": true,
|
|
26
|
-
"_args": [],
|
|
27
|
-
"args": [],
|
|
28
|
-
"rawArgs": [],
|
|
29
|
-
"processedArgs": [],
|
|
30
|
-
"_scriptPath": null,
|
|
31
|
-
"_name": "group-coverage-by-codeowners",
|
|
32
|
-
"_optionValues": {},
|
|
33
|
-
"_optionValueSources": {},
|
|
34
|
-
"_storeOptionsAsProperties": false,
|
|
35
|
-
"_executableHandler": false,
|
|
36
|
-
"_executableFile": null,
|
|
37
|
-
"_executableDir": null,
|
|
38
|
-
"_defaultCommandName": null,
|
|
39
|
-
"_exitCallback": null,
|
|
40
|
-
"_aliases": [],
|
|
41
|
-
"_combineFlagAndOptionalValue": true,
|
|
42
|
-
"_description": "TODO: group-coverage-by-codeowners",
|
|
43
|
-
"_summary": "",
|
|
44
|
-
"_enablePositionalOptions": false,
|
|
45
|
-
"_passThroughOptions": false,
|
|
46
|
-
"_lifeCycleHooks": {},
|
|
47
|
-
"_showHelpAfterError": false,
|
|
48
|
-
"_showSuggestionAfterError": true,
|
|
49
|
-
"_outputConfiguration": {},
|
|
50
|
-
"_hidden": false,
|
|
51
|
-
"_hasHelpOption": true,
|
|
52
|
-
"_helpFlags": "-h, --help",
|
|
53
|
-
"_helpDescription": "display help for command",
|
|
54
|
-
"_helpShortFlag": "-h",
|
|
55
|
-
"_helpLongFlag": "--help",
|
|
56
|
-
"_helpCommandName": "help",
|
|
57
|
-
"_helpCommandnameAndArgs": "help [command]",
|
|
58
|
-
"_helpCommandDescription": "display help for command",
|
|
59
|
-
"_helpConfiguration": {}
|
|
60
|
-
}"
|
|
61
|
-
`;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { jest } from '@jest/globals'
|
|
2
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3
|
-
import { Command } from 'commander'
|
|
4
|
-
|
|
5
|
-
import { groupCoverageByCodeownersCommand } from './group-coverage-by-codeowners.js'
|
|
6
|
-
|
|
7
|
-
describe('groupCoverageByCodeownersCommand', () => {
|
|
8
|
-
let program
|
|
9
|
-
|
|
10
|
-
beforeEach(() => {
|
|
11
|
-
program = new Command()
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
afterEach(() => {
|
|
15
|
-
jest.clearAllMocks()
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
it('has the correct command structure', () => {
|
|
19
|
-
const command = groupCoverageByCodeownersCommand(program)
|
|
20
|
-
|
|
21
|
-
expect(JSON.stringify(command, null, 2)).toMatchSnapshot()
|
|
22
|
-
})
|
|
23
|
-
})
|