Skip to content

Commit

Permalink
Code coverage summary.
Browse files Browse the repository at this point in the history
  • Loading branch information
sfdctaka committed Jun 18, 2023
1 parent 97a4ad8 commit bd33aed
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 54 deletions.
26 changes: 25 additions & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,30 @@ jobs:
- uses: pyvista/setup-headless-display-action@v1
- run: npm install
- run: npm run compile
- run: npm run test-coverage
- run: npm run test-coverage

- name: Copy Coverage To Predictable Location
run: cp coverage/cobertura-coverage.xml coverage.cobertura.xml

- name: Code Coverage Summary Report
uses: irongut/[email protected]
with:
filename: coverage.cobertura.xml
badge: true
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: '60 80'

- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request'
with:
recreate: true
path: code-coverage-results.md
run-tests-win:
runs-on: windows-latest
strategy:
Expand All @@ -28,6 +51,7 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- uses: pyvista/setup-headless-display-action@v1
- run: npm install
- run: npm run compile
- run: npm run test-coverage
34 changes: 0 additions & 34 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@
"nyc": "^15.1.0",
"prettier": "^2.8.8",
"sinon": "^15.1.0",
"typescript": "^4.9.5",
"source-map-support": "^0.5.21",
"ts-node": "^10.9.1"
"typescript": "^4.9.5"
},
"dependencies": {
"@salesforce/core": "^3.36.2",
Expand Down
28 changes: 22 additions & 6 deletions src/test/suite/commands/configureProjectCommand.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,31 @@ suite('Configure Project Command Test Suite', () => {
await CommonUtils.executeCommandAsync('git init');
await writeFile(path.join(process.cwd(), 'README.txt'), 'Some content');
await CommonUtils.executeCommandAsync('git add README.txt');
await CommonUtils.executeCommandAsync(
'git config --global user.email "[email protected]"'
);
await CommonUtils.executeCommandAsync(
'git config --global user.name "Your Name"'
);

try {
await CommonUtils.executeCommandAsync(
'git config --global user.email'
);
} catch {
await CommonUtils.executeCommandAsync(
'git config --global user.email "[email protected]"'
);
}

try {
await CommonUtils.executeCommandAsync(
'git config --global user.name'
);
} catch {
await CommonUtils.executeCommandAsync(
'git config --global user.name "Your Name"'
);
}

await CommonUtils.executeCommandAsync(
'git commit --no-gpg-sign -m "Initial commit"'
);

process.chdir(origCwd);

try {
Expand Down
8 changes: 3 additions & 5 deletions src/test/suite/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,11 @@ const NYC = require('nyc');
let nyc: any = undefined;

export async function run(): Promise<void> {
const testsRoot = path.resolve(__dirname, '..');

// Setup coverage pre-test, including post-test hook to report

if (process.env['CODE_COVERAGE'] === '1') {
nyc = new NYC({
...baseConfig,
cwd: path.join(__dirname, '..', '..', '..'),
reporter: ['text-summary', 'html', 'text'],
reporter: ['text-summary', 'html', 'text', 'cobertura'],
all: true,
silent: false,
instrument: true,
Expand All @@ -45,6 +41,8 @@ export async function run(): Promise<void> {
color: true
});

const testsRoot = path.resolve(__dirname, '..');

return new Promise((c, e) => {
glob('**/**.test.js', { cwd: testsRoot }, async (err, files) => {
if (err) {
Expand Down
6 changes: 1 addition & 5 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
],
"sourceMap": true,
"rootDir": "src",
"strict": true, /* enable all strict type-checking options */
"typeRoots": [
"./node_modules/@types",
"./types"
]
"strict": true /* enable all strict type-checking options */
/* Additional Checks */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
Expand Down

0 comments on commit bd33aed

Please sign in to comment.