From ec2cba8fd1f02e8b1b6e927a95a951775530ddd3 Mon Sep 17 00:00:00 2001 From: Sonam Serchan Date: Sat, 29 Jul 2023 19:46:28 +1000 Subject: [PATCH] use coverage to run in ci and test for local testing development --- .github/workflows/run-ci-tests.yml | 16 ++++++++-------- Taskfile.yml | 2 +- package.json | 3 ++- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/run-ci-tests.yml b/.github/workflows/run-ci-tests.yml index 6f2520b..7f47799 100644 --- a/.github/workflows/run-ci-tests.yml +++ b/.github/workflows/run-ci-tests.yml @@ -11,13 +11,13 @@ jobs: id-token: write steps: - - name: Checkout repo - uses: actions/checkout@v3 + - name: Checkout repo + uses: actions/checkout@v3 - - name: Install taskfile - run: | - sudo snap install task --classic + - name: Install taskfile + run: | + sudo snap install task --classic - - id: run-unit-tests - name: Run unit tests - run: task install && task test + - id: run-unit-tests + name: Run unit tests + run: task install && task test diff --git a/Taskfile.yml b/Taskfile.yml index 85c1475..f6d3137 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -34,7 +34,7 @@ tasks: test: desc: Run unit tests using jest cmds: - - npm run test + - npm run coverage compile: desc: Compile typescript files diff --git a/package.json b/package.json index 9671801..1d93e91 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,8 @@ "main": "index.js", "scripts": { "start": "functions-framework --target=xplorersbot", - "test": "task clean && jest --verbose --coverage", + "test": "task clean && jest --verbose --coverage --watch", + "coverage": "task clean && jest --verbose --coverage", "start-xplorersbot-server": "task clean && tsc && cd out && npx functions-framework --target=xplorersbot --signature-type=http", "start-openai-server": "task clean && tsc && cd out && npx functions-framework --target=xplorersbotOpenAI --signature-type=http" },