anuraag016 / Jest-Coverage-Diff

Jest Coverage report diff as a comment for Pull requests
MIT License
59 stars 46 forks source link

Error: Command failed #15

Closed paytonelsey3 closed 3 years ago

paytonelsey3 commented 3 years ago

I'm trying to use this action in a microservice and I keep getting this error: Error: Command failed: npx jest --coverage --coverageReporters="json-summary"

Screen Shot 2021-05-13 at 3 17 48 PM

Here are my build steps:

steps:
            - name: Checkout repository
              uses: actions/checkout@v2

            - name: Set up Node.js
              uses: actions/setup-node@v1
              with:
                  node-version: ${{ matrix.node-version }}
                  registry-url: 'https://registry.npmjs.org'

            - run: npm ci
              env:
                  NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

            - name: TestCoverage
              id: testCovergae
              uses: anuraag016/Jest-Coverage-Diff@master
              with:
                  fullCoverageDiff: false
                  delta: 0.5

I have node-version as 12.x and platform as ubuntu-latest. There's not a lot of information in the error message so I'm not sure what else to try.

paytonelsey3 commented 3 years ago

For anyone running into this issue, here's the updated yaml file that seems to work:

        steps:
            - name: Checkout repository
              uses: actions/checkout@v2

            - name: Set up Node.js
              uses: actions/setup-node@v1
              with:
                  node-version: ${{ matrix.node-version }}
                  registry-url: 'https://registry.npmjs.org'

            - name: Install
              run: npm ci
              env:
                  NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

            - run: npm build

            - name: TestCoverage
              id: testCovergae
              uses: anuraag016/Jest-Coverage-Diff@master
              with:
                  fullCoverageDiff: false
                  runCommand: "npx jest --passWithNoTests --collectCoverageFrom='[\"src/**/*.{js,jsx,ts,tsx}\"]' --coverage --collectCoverage=true --coverageDirectory='./' --coverageReporters='json-summary' --forceExit --detectOpenHandles test/.*test.*"