Skip to content

Commit 6a1b7e9

Browse files
committed
feat: added unit test cases check in workflow
1 parent 897fc4a commit 6a1b7e9

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

.github/workflows/unit-test.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Unit Test & Reports
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
jobs:
8+
# Create a job for each plugin dynamically
9+
test-plugins:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
plugin:
14+
- contentstack-audit
15+
- contentstack-export-to-csv
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: '22'
25+
26+
- name: Install dependencies
27+
run: |
28+
npm install
29+
30+
- name: Run tests for the plugin
31+
run: |
32+
cd packages/${{ matrix.plugin }} # Navigate to the plugin directory
33+
npm test:unit # Run unit tests for the plugin

packages/contentstack-audit/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@
7474
"test": "mocha --forbid-only \"test/**/*.test.ts\"",
7575
"version": "oclif readme && git add README.md",
7676
"clean": "rm -rf ./lib ./node_modules tsconfig.tsbuildinfo oclif.manifest.json",
77-
"test:unit:report": "nyc --extension .ts mocha --forbid-only \"test/unit/**/*.test.ts\""
77+
"test:unit:report": "nyc --extension .ts mocha --forbid-only \"test/unit/**/*.test.ts\"",
78+
"test:unit": "mocha --timeout 10000 --forbid-only \"test/unit/**/*.test.ts\""
7879
},
7980
"engines": {
8081
"node": ">=16"

0 commit comments

Comments
 (0)