Skip to content

Commit

Permalink
Merge f2c8700 into f3c3a98
Browse files Browse the repository at this point in the history
  • Loading branch information
anishkny committed Nov 13, 2022
2 parents f3c3a98 + f2c8700 commit ba21aed
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 2 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: denoland/setup-deno@v1
- run: deno task test

# Upload coverage result to coveralls
- uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./test/lcov.info
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
coverage/
lcov.info
node_modules/
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Deno API Tests Coverage

[![Coverage Status](https://coveralls.io/repos/github/anishkny/deno-api-tests-coverage/badge.svg?branch=main)](https://coveralls.io/github/anishkny/deno-api-tests-coverage?branch=main)

Demonstrates code coverage measurement of a Deno server when running Postman (`newman`) API tests.

See accompanying [blog post](https://dev.to/anishkny/code-coverage-for-a-running-deno-server-35ga) for more details.
Expand Down
1 change: 1 addition & 0 deletions deno.jsonc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"importMap": "./import_map.json",
"tasks": {
"start": "deno run --allow-net ./src/main.ts",
"test": "./test/run-tests.sh"
}
}
33 changes: 33 additions & 0 deletions test/api-tests.postman.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,39 @@
}
},
"response": []
},
{
"name": "404",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 404\", function () {",
" pm.response.to.have.status(404);",
"});",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "PATCH",
"header": [],
"url": {
"raw": "http://localhost:8000/",
"protocol": "http",
"host": [
"localhost"
],
"port": "8000",
"path": [
""
]
}
},
"response": []
}
]
}
3 changes: 3 additions & 0 deletions test/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ deno test --allow-net --allow-run --coverage=coverage ./server_test.ts

# Generate coverage reports
deno coverage coverage/

# Generate LCOV report
deno coverage coverage/ --lcov > lcov.info

0 comments on commit ba21aed

Please sign in to comment.