Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Run Unit Tests

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
# Install dependencies once globally
install-dependencies:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22.x'

- name: Install dependencies for all plugins
run: |
npm run setup-repo-old

# # Test plugins dynamically
# test-plugins:
# runs-on: ubuntu-latest
# needs: install-dependencies # Ensures this job runs after dependencies are installed
# strategy:
# matrix:
# plugin:
# - cli-audit
# - cli-cm-export-to-csv

# steps:
# - name: Checkout code
# uses: actions/checkout@v4

# - name: Set up Node.js
# uses: actions/setup-node@v4
# with:
# node-version: '22.x'

# - name: Check current directory
# run: pwd

- name: List files in plugin directory
run: ls -R /home/runner/work/cli


- name: Run tests for the plugin
working-directory: ./packages/contentstack-audit
run: npm run test:unit
3 changes: 2 additions & 1 deletion packages/contentstack-audit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@
"test": "mocha --forbid-only \"test/**/*.test.ts\"",
"version": "oclif readme && git add README.md",
"clean": "rm -rf ./lib ./node_modules tsconfig.tsbuildinfo oclif.manifest.json",
"test:unit:report": "nyc --extension .ts mocha --forbid-only \"test/unit/**/*.test.ts\""
"test:unit:report": "nyc --extension .ts mocha --forbid-only \"test/unit/**/*.test.ts\"",
"test:unit": "mocha --timeout 10000 --forbid-only \"test/unit/**/*.test.ts\""
},
"engines": {
"node": ">=16"
Expand Down
Loading