Skip to content

Commit

Permalink
Merge pull request #57 from antongolub/master
Browse files Browse the repository at this point in the history
feat: provide ts libdefs
  • Loading branch information
mdeanjones authored Nov 20, 2023
2 parents 6cd3b21 + 246c7c6 commit 5af5e54
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
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']))

0 comments on commit 5af5e54

Please sign in to comment.