-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bddef6f
commit 0d34a16
Showing
18 changed files
with
470 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
|
||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>package.json</title> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/semantic.min.css" type="text/css" rel="stylesheet"> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.58.2/codemirror.min.js" type="text/javascript" charset="utf-8"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.58.2/mode/javascript/javascript.min.js" type="text/javascript" charset="utf-8"></script> | ||
<link href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.58.2/codemirror.min.css" type="text/css" rel="stylesheet"> | ||
<script src="../assets/source-file.js" type="text/javascript" charset="utf-8"></script> | ||
<link href="../assets/source-file.css" type="text/css" rel="stylesheet"> | ||
</head> | ||
<body> | ||
<div style="margin-top:3em" class="ui container"><h1 class="ui header"><a href="../index.html">TypeScript coverage report</a></h1><table style="margin-top:2em" class="ui celled table"><thead class=""><tr class=""><th class="">Filename</th><th class="">Percent</th><th class="">Threshold</th><th class="">Total</th><th class="">Covered</th><th class="">Uncovered</th></tr></thead><tbody class=""><tr class="positive"><td class="">package.json</td><td class="">100.00%</td><td class="">90%</td><td class="">0</td><td class="">0</td><td class="">0</td></tr></tbody></table><textarea id="editor" readonly="" style="margin-top:3em">{ | ||
"name": "typescript-coverage-report", | ||
"version": "0.6.1", | ||
"description": "Node command tool to generate TypeScript coverage report.", | ||
"main": "dist/lib/index.js", | ||
"bin": { | ||
"typescript-coverage-report": "dist/bin/typescript-coverage-report.js" | ||
}, | ||
"repository": "[email protected]:alexcanessa/typescript-coverage-report.git", | ||
"author": "Alex Canessa <[email protected]>", | ||
"license": "MIT", | ||
"private": false, | ||
"dependencies": { | ||
"colors": "^1.4.0", | ||
"commander": "^5.0.0", | ||
"ncp": "^2.0.0", | ||
"react": "^16.13.1", | ||
"react-dom": "^16.13.1", | ||
"rimraf": "^3.0.2", | ||
"semantic-ui-react": "^0.88.2", | ||
"terminal-table": "^0.0.12", | ||
"type-coverage-core": "^2.17.2" | ||
}, | ||
"scripts": { | ||
"build": "tsc", | ||
"lint": "tsc --noEmit && eslint '*/**/*.{js,ts,tsx}' --quiet --fix", | ||
"type-coverage": "node ./dist/bin/typescript-coverage-report", | ||
"docs": "yarn type-coverage --outputDir docs", | ||
"prepublish": "yarn lint && yarn build", | ||
"test": "jest", | ||
"release": "gren release" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.9.0", | ||
"@babel/preset-env": "^7.9.0", | ||
"@babel/preset-react": "^7.9.4", | ||
"@babel/preset-typescript": "^7.9.0", | ||
"@commitlint/cli": "^8.3.5", | ||
"@commitlint/config-conventional": "^8.3.4", | ||
"@testing-library/react": "^10.0.1", | ||
"@types/jest": "^25.1.4", | ||
"@types/ncp": "^2.0.3", | ||
"@types/node": "^13.9.2", | ||
"@types/react": "^16.9.23", | ||
"@types/react-dom": "^16.9.5", | ||
"@types/testing-library__react": "^9.1.3", | ||
"@typescript-eslint/eslint-plugin": "^2.25.0", | ||
"@typescript-eslint/parser": "^2.25.0", | ||
"babel-jest": "^25.1.0", | ||
"eslint": "^6.8.0", | ||
"eslint-config-prettier": "^6.10.1", | ||
"eslint-plugin-jest": "^23.8.2", | ||
"eslint-plugin-prettier": "^3.1.2", | ||
"eslint-plugin-react": "^7.19.0", | ||
"github-release-notes": "^0.17.1", | ||
"husky": "^4.2.3", | ||
"jest": "^25.1.0", | ||
"lint-staged": "^10.0.8", | ||
"package-json-type": "^1.0.3", | ||
"prettier": "^2.0.2", | ||
"typescript": "4.1.3" | ||
}, | ||
"peerDependencies": { | ||
"typescript": "2 || 3 || 4" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS", | ||
"pre-commit": "lint-staged" | ||
} | ||
}, | ||
"lint-staged": { | ||
"*.{js,ts,tsx}": [ | ||
"eslint --fix" | ||
], | ||
"*.{js,ts,tsx,json,md,css}": [ | ||
"prettier --write" | ||
] | ||
}, | ||
"typeCoverage": { | ||
"atLeast": 90 | ||
} | ||
} | ||
</textarea><pre id="annotations" style="display:none">[]</pre></div> | ||
<p class="footer-text">TypeScript Coverage Report generated by <a href="https://github.com/plantain-00/type-coverage">type-coverage</a> and <a href="https://github.com/alexcanessa/typescript-coverage-report">typescript-coverage-report</a> at Mon, 20 Dec 2021 10:37:39 GMT</p> | ||
</body> | ||
</html> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,25 +4,45 @@ | |
<head> | ||
<title>typescript-coverage-report.ts</title> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/semantic.min.css" type="text/css" rel="stylesheet"> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.52.2/codemirror.min.js" type="text/javascript" charset="utf-8"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.52.2/mode/javascript/javascript.min.js" type="text/javascript" charset="utf-8"></script> | ||
<link href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.52.2/codemirror.min.css" type="text/css" rel="stylesheet"> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.58.2/codemirror.min.js" type="text/javascript" charset="utf-8"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.58.2/mode/javascript/javascript.min.js" type="text/javascript" charset="utf-8"></script> | ||
<link href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.58.2/codemirror.min.css" type="text/css" rel="stylesheet"> | ||
<script src="../../../assets/source-file.js" type="text/javascript" charset="utf-8"></script> | ||
<link href="../../../assets/source-file.css" type="text/css" rel="stylesheet"> | ||
</head> | ||
<body> | ||
<div style="margin-top:3em" class="ui container"><h1 class="ui header"><a href="../../../index.html">TypeScript coverage report</a></h1><table style="margin-top:2em" class="ui celled table"><thead class=""><tr class=""><th class="">Filename</th><th class="">Percent</th><th class="">Threshold</th><th class="">Total</th><th class="">Covered</th><th class="">Uncovered</th></tr></thead><tbody class=""><tr class="positive"><td class="">src/bin/typescript-coverage-report.ts</td><td class="">84.75%</td><td class="">80%</td><td class="">59</td><td class="">50</td><td class="">9</td></tr></tbody></table><textarea id="editor" readonly="" style="margin-top:3em">#!/usr/bin/env node | ||
<div style="margin-top:3em" class="ui container"><h1 class="ui header"><a href="../../../index.html">TypeScript coverage report</a></h1><table style="margin-top:2em" class="ui celled table"><thead class=""><tr class=""><th class="">Filename</th><th class="">Percent</th><th class="">Threshold</th><th class="">Total</th><th class="">Covered</th><th class="">Uncovered</th></tr></thead><tbody class=""><tr class="positive"><td class="">src/bin/typescript-coverage-report.ts</td><td class="">91.41%</td><td class="">90%</td><td class="">128</td><td class="">117</td><td class="">11</td></tr></tbody></table><textarea id="editor" readonly="" style="margin-top:3em">#!/usr/bin/env node | ||
|
||
import { program } from "commander"; | ||
import generateCoverageReport from "../lib"; | ||
import getOptions from "../lib/getOptions"; | ||
import generateCoverageReport, { ProgramOptions } from "../lib"; | ||
import path from "path"; | ||
import { IPackageJson } from "package-json-type"; | ||
|
||
type TypeCoverageConfig = { | ||
outputDir?: string; | ||
atLeast?: number; | ||
strict?: boolean; | ||
debug?: boolean; | ||
cache?: boolean; | ||
project?: string; | ||
ignoreFiles?: boolean; | ||
ignoreCatch?: boolean; | ||
ignoreUnread?: boolean; | ||
}; | ||
|
||
const { | ||
version, | ||
description, | ||
description | ||
}: // eslint-disable-next-line @typescript-eslint/no-var-requires | ||
IPackageJson = require("../../package.json"); | ||
|
||
const { | ||
typeCoverage = {} | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
} = require("../../package.json"); | ||
}: // eslint-disable-next-line @typescript-eslint/no-var-requires | ||
IPackageJson & { typeCoverage?: TypeCoverageConfig } = require(path.join( | ||
process.cwd(), | ||
"/package.json" | ||
)); | ||
|
||
const argvWithVersion = (argvs: string[]): string[] => { | ||
const vPos = argvs.indexOf("-v"); | ||
|
@@ -34,25 +54,73 @@ | |
return argvs; | ||
}; | ||
|
||
const { | ||
outputDir = "coverage-ts", | ||
atLeast = 80, | ||
strict = false, | ||
debug = false, | ||
cache = false, | ||
project = ".", | ||
ignoreFiles = false, | ||
ignoreCatch = false, | ||
ignoreUnread = false | ||
} = typeCoverage; | ||
|
||
program | ||
.version(version) | ||
.description(description) | ||
.option( | ||
"-o, --outputDir [string]", | ||
"The output directory where to generate the report.", | ||
"coverage-ts" | ||
"the output directory where to generate the report.", | ||
outputDir | ||
) | ||
.option( | ||
"-t, --threshold [number]", | ||
"The minimum percentage of coverage required.", | ||
"the minimum percentage of coverage required.", | ||
parseFloat, | ||
typeCoverage.atLeast || 80 | ||
atLeast | ||
) | ||
.option("-s, --strict [boolean]", "run the check in strict mode.", strict) | ||
.option("-d, --debug [boolean]", "show debug information.", debug) | ||
.option( | ||
"-c, --cache [boolean]", | ||
"save and reuse type check result from cache.", | ||
cache | ||
) | ||
.option( | ||
"-p, --project [string]", | ||
'file path to tsconfig file, eg: --project "./app/tsconfig.app.json"', | ||
project | ||
) | ||
.option( | ||
"-i, --ignore-files [string[]]", | ||
'ignore specified files, eg: --ignore-files "demo1/*.ts" --ignore-files "demo2/foo.ts"', | ||
ignoreFiles | ||
) | ||
.option( | ||
"--ignore-catch [boolean]", | ||
"ignore type any for (try-)catch clause variable", | ||
ignoreCatch | ||
) | ||
.option( | ||
"-u, --ignore-unread [boolean]", | ||
"allow writes to variables with implicit any types", | ||
ignoreUnread | ||
) | ||
.option("-s, --strict [boolean]", "Run the check in strict mode.", false) | ||
.option("-d, --debug [boolean]", "Show debug information.", false) | ||
.parse(argvWithVersion(process.argv)); | ||
|
||
const options = getOptions(program); | ||
const options: ProgramOptions = { | ||
/* camelCase keys matching "long" flags in options above */ | ||
outputDir: program.outputDir, | ||
threshold: program.threshold, | ||
tsProjectFile: program.project, | ||
strict: program.strict, | ||
debug: program.debug, | ||
cache: program.cache, | ||
ignoreFiles: program.ignoreFiles, | ||
ignoreCatch: program.ignoreCatch, | ||
ignoreUnread: program.ignoreUnread | ||
}; | ||
|
||
generateCoverageReport(options) | ||
.then(({ percentage }) => { | ||
|
@@ -73,8 +141,8 @@ | |
|
||
process.exit(255); | ||
}); | ||
</textarea><pre id="annotations" style="display:none">[{"file":"src/bin/typescript-coverage-report.ts","line":7,"character":2,"text":"version"},{"file":"src/bin/typescript-coverage-report.ts","line":8,"character":2,"text":"description"},{"file":"src/bin/typescript-coverage-report.ts","line":9,"character":2,"text":"typeCoverage"},{"file":"src/bin/typescript-coverage-report.ts","line":24,"character":11,"text":"version"},{"file":"src/bin/typescript-coverage-report.ts","line":25,"character":15,"text":"description"},{"file":"src/bin/typescript-coverage-report.ts","line":35,"character":4,"text":"typeCoverage"},{"file":"src/bin/typescript-coverage-report.ts","line":35,"character":17,"text":"atLeast"},{"file":"src/bin/typescript-coverage-report.ts","line":57,"character":10,"text":"error"},{"file":"src/bin/typescript-coverage-report.ts","line":58,"character":18,"text":"error"}]</pre></div> | ||
<p class="footer-text">TypeScript Coverage Report generated by <a href="https://github.com/plantain-00/type-coverage">type-coverage</a> and <a href="https://github.com/alexcanessa/typescript-coverage-report">typescript-coverage-report</a> at Mon, 30 Mar 2020 11:56:57 GMT</p> | ||
</textarea><pre id="annotations" style="display:none">[{"file":"src/bin/typescript-coverage-report.ts","line":100,"character":21,"text":"outputDir","kind":1},{"file":"src/bin/typescript-coverage-report.ts","line":101,"character":21,"text":"threshold","kind":1},{"file":"src/bin/typescript-coverage-report.ts","line":102,"character":25,"text":"project","kind":1},{"file":"src/bin/typescript-coverage-report.ts","line":103,"character":18,"text":"strict","kind":1},{"file":"src/bin/typescript-coverage-report.ts","line":104,"character":17,"text":"debug","kind":1},{"file":"src/bin/typescript-coverage-report.ts","line":105,"character":17,"text":"cache","kind":1},{"file":"src/bin/typescript-coverage-report.ts","line":106,"character":23,"text":"ignoreFiles","kind":1},{"file":"src/bin/typescript-coverage-report.ts","line":107,"character":23,"text":"ignoreCatch","kind":1},{"file":"src/bin/typescript-coverage-report.ts","line":108,"character":24,"text":"ignoreUnread","kind":1},{"file":"src/bin/typescript-coverage-report.ts","line":125,"character":10,"text":"error","kind":1},{"file":"src/bin/typescript-coverage-report.ts","line":126,"character":18,"text":"error","kind":1}]</pre></div> | ||
<p class="footer-text">TypeScript Coverage Report generated by <a href="https://github.com/plantain-00/type-coverage">type-coverage</a> and <a href="https://github.com/alexcanessa/typescript-coverage-report">typescript-coverage-report</a> at Mon, 20 Dec 2021 10:37:39 GMT</p> | ||
</body> | ||
</html> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,14 +4,14 @@ | |
<head> | ||
<title>DetailPage.tsx</title> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/semantic.min.css" type="text/css" rel="stylesheet"> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.52.2/codemirror.min.js" type="text/javascript" charset="utf-8"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.52.2/mode/javascript/javascript.min.js" type="text/javascript" charset="utf-8"></script> | ||
<link href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.52.2/codemirror.min.css" type="text/css" rel="stylesheet"> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.58.2/codemirror.min.js" type="text/javascript" charset="utf-8"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.58.2/mode/javascript/javascript.min.js" type="text/javascript" charset="utf-8"></script> | ||
<link href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.58.2/codemirror.min.css" type="text/css" rel="stylesheet"> | ||
<script src="../../../../assets/source-file.js" type="text/javascript" charset="utf-8"></script> | ||
<link href="../../../../assets/source-file.css" type="text/css" rel="stylesheet"> | ||
</head> | ||
<body> | ||
<div style="margin-top:3em" class="ui container"><h1 class="ui header"><a href="../../../../index.html">TypeScript coverage report</a></h1><table style="margin-top:2em" class="ui celled table"><thead class=""><tr class=""><th class="">Filename</th><th class="">Percent</th><th class="">Threshold</th><th class="">Total</th><th class="">Covered</th><th class="">Uncovered</th></tr></thead><tbody class=""><tr class="positive"><td class="">src/components/DetailPage/DetailPage.tsx</td><td class="">100.00%</td><td class="">80%</td><td class="">133</td><td class="">133</td><td class="">0</td></tr></tbody></table><textarea id="editor" readonly="" style="margin-top:3em">import React from "react"; | ||
<div style="margin-top:3em" class="ui container"><h1 class="ui header"><a href="../../../../index.html">TypeScript coverage report</a></h1><table style="margin-top:2em" class="ui celled table"><thead class=""><tr class=""><th class="">Filename</th><th class="">Percent</th><th class="">Threshold</th><th class="">Total</th><th class="">Covered</th><th class="">Uncovered</th></tr></thead><tbody class=""><tr class="positive"><td class="">src/components/DetailPage/DetailPage.tsx</td><td class="">100.00%</td><td class="">90%</td><td class="">133</td><td class="">133</td><td class="">0</td></tr></tbody></table><textarea id="editor" readonly="" style="margin-top:3em">import React from "react"; | ||
import path from "path"; | ||
import { Container, Table, Header } from "semantic-ui-react"; | ||
|
||
|
@@ -93,7 +93,7 @@ | |
|
||
export default DetailPage; | ||
</textarea><pre id="annotations" style="display:none">[]</pre></div> | ||
<p class="footer-text">TypeScript Coverage Report generated by <a href="https://github.com/plantain-00/type-coverage">type-coverage</a> and <a href="https://github.com/alexcanessa/typescript-coverage-report">typescript-coverage-report</a> at Mon, 30 Mar 2020 11:56:57 GMT</p> | ||
<p class="footer-text">TypeScript Coverage Report generated by <a href="https://github.com/plantain-00/type-coverage">type-coverage</a> and <a href="https://github.com/alexcanessa/typescript-coverage-report">typescript-coverage-report</a> at Mon, 20 Dec 2021 10:37:39 GMT</p> | ||
</body> | ||
</html> | ||
|
Oops, something went wrong.