Skip to content

chore: refactor complex implementation of request-processing filters #819

chore: refactor complex implementation of request-processing filters

chore: refactor complex implementation of request-processing filters #819

Workflow file for this run

name: CLI tests
permissions: read-all
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
pepr-build:
name: controller image
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit
- name: clone pepr
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: defenseunicorns/pepr
path: pepr
- name: "set env: PEPR"
run: echo "PEPR=${GITHUB_WORKSPACE}/pepr" >> "$GITHUB_ENV"
- name: setup node
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: 20
cache-dependency-path: pepr
- name: Prep for CLI tests
run: |
cd "$PEPR"
npm ci
- name: pepr init - displays the help menu
run: |
cd "$PEPR"
npm run gen-data-json
npx ts-node src/cli.ts init --help > result.log
grep " \-\-name" result.log
grep " \-\-description" result.log
grep " \-\-errorBehavior" result.log
grep " \-\-confirm" result.log
- name: pepr init - creates a module with input from flags
run: |
cd "$PEPR"
npm run gen-data-json
npx ts-node src/cli.ts init \
--name my-flagged-module \
--description "Set by flag" \
--errorBehavior reject \
--confirm \
--skip-post-init
RESULT_FILE="my-flagged-module/package.json"
grep "my-flagged-module" $RESULT_FILE
grep "Set by flag" $RESULT_FILE
grep "reject" $RESULT_FILE
- name: pepr init - creates a module with input from stdin
run: |
cd "$PEPR"
npm run gen-data-json
echo "stdin-module" | npx ts-node src/cli.ts init \
--description "Set by flag" \
--errorBehavior reject \
--confirm \
--skip-post-init
RESULT_FILE="stdin-module/package.json"
grep "stdin-module" $RESULT_FILE
grep "Set by flag" $RESULT_FILE
grep "reject" $RESULT_FILE