Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: provide ts libdefs #57

Merged
merged 1 commit into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ node_modules
npm-debug.log
.DS_Store
package-lock.json
yarn.lock
/.idea
.eslintcache
/lcov.info
Expand Down
14 changes: 14 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Transform } from 'node:stream'

type ConfigurationPojo = {
pattern: string
outFile?: string
prependSourceFiles?: boolean
prependPathFix?: string
legacyTempFile?: boolean
ignore?: string[]
}

export function mergeCoverageReportFiles(filePaths: string[], options: ConfigurationPojo): Promise<string>

export function mergeCoverageReportFilesStream(filePathsOrMergeOptions: string[] | ConfigurationPojo, mergeOptions?: ConfigurationPojo): Transform
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@
"name": "lcov-result-merger",
"description": "Merges multiple lcov results into one",
"main": "index.js",
"types": "index.d.ts",
"files": [
"index.js",
"index.d.ts",
"bin",
"lib"
],
"scripts": {
"lint": "eslint . --cache",
"test": "npm run lint && npm run test:js",
"test": "npm run lint && npm run test:js && npm run test:dts",
"test:js": "mocha --bail --recursive",
"test:dts": "tsd -f test/test-types/index.test-d.ts",
"test:coverage": "nyc --reporter=html --reporter=lcov mocha -- --recursive",
"release": "release-it",
"cleanup": "rm -rf ./.nyc_output ./coverage ./.eslintcache"
Expand Down Expand Up @@ -45,6 +48,7 @@
},
"devDependencies": {
"@release-it/conventional-changelog": "^6.0.0",
"@types/node": "^20.9.0",
"@types/yargs": "^17.0.10",
"chai": "^4.1.2",
"eslint": "^8.30.0",
Expand All @@ -57,7 +61,8 @@
"nyc": "^15.1.0",
"prettier": "2.8.1",
"release-it": "^15.11.0",
"rimraf": "^5.0.1"
"rimraf": "^5.0.1",
"tsd": "^0.29.0"
},
"engines": {
"node": ">=14"
Expand Down
10 changes: 10 additions & 0 deletions test/test-types/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { expectType, expectError } from 'tsd'
import { Transform } from 'node:stream'
import { mergeCoverageReportFilesStream, mergeCoverageReportFiles } from '../../index'

expectType<Promise<string>>(mergeCoverageReportFiles(['a', 'b'], {pattern: 'a'}))
expectType<Transform>(mergeCoverageReportFilesStream(['a', 'b'], {pattern: 'a'}))
expectType<Transform>(mergeCoverageReportFilesStream({pattern: 'a'}))

expectError(mergeCoverageReportFiles(['a', 'b'], {pattern: 1}))
expectError(mergeCoverageReportFiles(['a', 'b']))