Skip to content

fix jest error2

fix jest error2 #140

Workflow file for this run

name: run-jest
on:
push:
paths:
- "src/**.tsx"
- "src/**.ts"
- "public/**.html"
- ".github/workflows/react-jest.yaml"
defaults:
run:
shell: bash
jobs:
frontend-jest: # job id(typed by user)
runs-on: ubuntu-latest
permissions:
contents: read
# デフォルトのワーキングディレクトリのため設定不要だが,明示的に指定。
defaults:
run:
working-directory: /home/runner/work/devsecops-demo-aws-ecs/devsecops-demo-aws-ecs
strategy:
matrix:
node_version: [20, 22]
environment_type: ["development", "staging", "production"]
steps:
# checkout repository to runner
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: set up node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: ${{ matrix.node_version }}
- name: install package using aqua
uses: aquaproj/aqua-installer@6ce1f8848ec8e61f14d57bd5d7597057a6dd187c # v3.0.1
with:
aqua_version: v2.29.0
- name: install dependencies
run: github-comment exec --token ${{ secrets.token }} -- npm install
# 3環境まとめてテスト
- name: run npm test
run: |
if [ ${{ matrix.environment_type }} = "development" ]; then
npm_type="dev"
elif [ ${{ matrix.environment_type }} = "staging" ]; then
npm_type="stg"
elif [ ${{ matrix.environment_type }} = "production" ]; then
npm_type="prod"
else
echo "invalid environment_type"
exit 1
fi
# github actions environment variableから.envファイルを作成
cat <<EOF >> .env.${{ matrix.environment_type }}
gh variable list --env ${{ matrix.environment_type }} | awk '{print $1"="$2}'
EOF
github-comment exec --token ${{ secrets.token }} -- npm run test-$npm_type -- --watchall=false