Skip to content

Commit

Permalink
chore(ci): add Vitest Coverage Action (#1136)
Browse files Browse the repository at this point in the history
Fixes: #1041
  • Loading branch information
ayushmanchhabra authored Jun 23, 2024
1 parent 1cdbdd1 commit 4d32845
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 16 deletions.
23 changes: 22 additions & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Get Node version from NW.js manifest
- name: Setup Volta
uses: volta-cli/[email protected]
- name: Node.js version
run: node -v
Expand All @@ -34,3 +34,24 @@ jobs:
run: npm run lint
- name: Run tests
run: npm run test
cov:
runs-on: ubuntu-22.04
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Setup Volta
uses: volta-cli/[email protected]
- name: Node.js version
run: node -v
- name: npm version
run: npm -v
- name: Install dependencies
run: npm ci
- name: Enable Coverage
run: npm run test:cov
- name: Report Coverage
if: always()
uses: davelosert/[email protected]
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.DS_Store

.idea
coverage
node_modules

test/fixture/cache
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@
"markdown:fix": "markdownlint --fix ./README.md",
"docs": "jsdoc -d docs ./README.md ./src/index.js ./src/get.js ./src/run.js ./src/bld.js",
"test": "vitest run --coverage",
"demo": "cd test/fixture && node demo.js"
"test:cov": "vitest --coverage.enabled true",
"demo": "cd test/fixture && node demo.js",
"tmp": "vitest --coverage.enabled true"
},
"devDependencies": {
"@stylistic/eslint-plugin-js": "^2.2.2",
Expand Down
4 changes: 1 addition & 3 deletions src/get/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,5 @@ export default async function request(url, filePath) {
responseType: "stream"
});

response.data.pipe(writeStream);

// await stream.promises.pipeline(response.data, writeStream);
await stream.promises.pipeline(response.data, writeStream);
}
Empty file.
21 changes: 10 additions & 11 deletions vitest.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { defineConfig
} from 'vitest/config'
import { defineConfig } from 'vitest/config'

export default defineConfig
({
test: {
coverage: {
provider: 'v8',
reporter: ['text'],
},
},
})
export default defineConfig({
test: {
coverage: {
provider: 'v8',
reporter: ['json-summary'],
reportOnFailure: true,
}
}
});

0 comments on commit 4d32845

Please sign in to comment.