Skip to content

Commit

Permalink
ch(git-action): set up git actions and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Edcreation committed Aug 2, 2023
1 parent 2b7b2f9 commit 5ea4a00
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 1,868 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Run Tests

on:
push:
branches:
- '*'
pull_request:
branches:
- develop

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18'

- name: Install Dependencies
run: npm install

- name: Run tests with coverage
run: npm run coverage
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
node_modules
.env
yarn.lock
.nyc_output
coverage
package-lock.json
31 changes: 29 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "backend for phase II of pulse",
"main": "src/index.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"test": "mocha --parallel -r ts-node/register src/test/**/*.test.ts --recursive --exit --timeout 80000",
"coverage": "nyc npm run test",
"start": "tsc && node dist/index",
"dev": "nodemon src/index.ts",
"seed": "ts-node-dev --transpile-only --no-notify --exit-child src/seeders/index.ts"
Expand All @@ -28,8 +29,16 @@
},
"homepage": "https://github.com/atlp-rwanda/atlp-devpulse-bn#readme",
"devDependencies": {
"@istanbuljs/nyc-config-typescript": "^1.0.2",
"@types/chai": "^4.3.5",
"@types/mocha": "^10.0.1",
"@types/sinon": "^10.0.16",
"apollo-server-core": "^3.11.1",
"nodemon": "^2.0.19",
"chai": "^4.3.7",
"mocha": "^10.2.0",
"nodemon": "^3.0.1",
"nyc": "^15.1.0",
"sinon": "^15.2.0",
"ts-node": "^10.9.1",
"typescript": "^4.8.3"
},
Expand All @@ -45,5 +54,23 @@
"jwt-decode": "^3.1.2",
"mongoose": "^6.6.1",
"ts-node-dev": "^2.0.0"
},
"nyc": {
"extends": "@istanbuljs/nyc-config-typescript",
"check-coverage": true,
"all": true,
"include": [
"src/**/!(*.test.*).[tj]s?(x)"
],
"exclude": [
"src/_tests_/**/*.*"
],
"reporter": [
"html",
"lcov",
"text",
"text-summary"
],
"report-dir": "coverage"
}
}
8 changes: 8 additions & 0 deletions src/test/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { assert, expect } from "chai";

describe("This is a demo test", () => {
it("should return 5 when 2 is added to 3", () => {
const result = 2 + 3;
expect(result).eql(5);
});
});
Loading

0 comments on commit 5ea4a00

Please sign in to comment.