Skip to content

Commit 5b5e1e4

Browse files
committed
Replace nonexistent getCwd with process.cwd() in coverage script
1 parent 0ded887 commit 5b5e1e4

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

scripts/get-coverage-percentage.mjs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { existsSync } from 'node:fs'
2+
import path from 'node:path'
23

34
import yargsParser from 'yargs-parser'
5+
import colors from 'yoctocolors-cjs'
46

57
import constants from '@socketsecurity/registry/lib/constants'
68
import { logger } from '@socketsecurity/registry/lib/logger'
7-
import { getCwd, resolve } from '@socketsecurity/registry/lib/path'
89
import { indentString } from '@socketsecurity/registry/lib/strings'
910

1011
import { getCodeCoverage } from './utils/get-code-coverage.mjs'
@@ -18,7 +19,11 @@ async function logCoveragePercentage(argv) {
1819
const { spinner } = constants
1920

2021
// Check if coverage data exists to determine whether to generate or read it.
21-
const coverageJsonPath = resolve(getCwd(), 'coverage', 'coverage-final.json')
22+
const coverageJsonPath = path.join(
23+
process.cwd(),
24+
'coverage',
25+
'coverage-final.json',
26+
)
2227

2328
// Get code coverage metrics (statements, branches, functions, lines).
2429
let codeCoverage
@@ -144,7 +149,7 @@ async function logCoveragePercentage(argv) {
144149
logger.info(`Coverage Summary:`)
145150
logger.info(indentString(summaryLines.join('\n'), 2))
146151
logger.info('')
147-
logger.info(logger.bold(`Current coverage: ${overall}% overall!${emoji}`))
152+
logger.info(colors.bold(`Current coverage: ${overall}% overall!${emoji}`))
148153
}
149154
}
150155

scripts/utils/get-code-coverage.mjs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { existsSync } from 'node:fs'
2+
import { resolve } from 'node:path'
23

34
import constants from '@socketsecurity/registry/lib/constants'
45
import { readJson } from '@socketsecurity/registry/lib/fs'
56
import { isObjectObject } from '@socketsecurity/registry/lib/objects'
6-
import { getCwd, resolve } from '@socketsecurity/registry/lib/path'
77
import { spawn } from '@socketsecurity/registry/lib/spawn'
88

99
function countCovered(counts) {
@@ -13,7 +13,11 @@ function countCovered(counts) {
1313
export async function getCodeCoverage(options = {}) {
1414
const { generateIfMissing = true } = { __proto__: null, ...options }
1515

16-
const coverageJsonPath = resolve(getCwd(), 'coverage', 'coverage-final.json')
16+
const coverageJsonPath = resolve(
17+
process.cwd(),
18+
'coverage',
19+
'coverage-final.json',
20+
)
1721

1822
if (!existsSync(coverageJsonPath)) {
1923
if (!generateIfMissing) {

0 commit comments

Comments
 (0)