playwright-slack-report: EISDIR: illegal operation on a directory, read

I get this error:

node:fs:744
  handleErrorFromBinding(ctx);
  ^

Error: EISDIR: illegal operation on a directory, read
    at Object.readSync (node:fs:744:3)
    at tryReadSync (node:fs:444:20)
    at Object.readFileSync (node:fs:490:19)
    at ResultsParser.parseFromJsonFile (/home/runner/.npm/_npx/912153[8](https://github.com/.../actions/runs/7176906992/job/19542812131?pr=7957#step:8:9)dc03c[9](https://github.com/.../actions/runs/7176906992/job/19542812131?pr=7957#step:8:10)62b/node_modules/playwright-slack-report/dist/src/ResultsParser.js:39:25)
    at Command.<anonymous> (/home/runner/.npm/_npx/9[12](https://github.com/.../actions/runs/7176906992/job/19542812131?pr=7957#step:8:13)[15](https://github.com/.../actions/runs/7176906992/job/19542812131?pr=7957#step:8:16)38dc03c962b/node_modules/playwright-slack-report/dist/cli.js:32:47) {
  errno: -21,
  syscall: 'read',
  code: 'EISDIR'
}

by running the following command: SLACK_BOT_USER_OAUTH_TOKEN=xxx npx playwright-slack-report -c playwright/cli_config.json -j blob-report/

The artifact is created based on this in my playwright.yml file:

    - name: Download blob reports from GitHub Actions Artifacts
      uses: actions/download-artifact@v3
      with:
        name: all-blob-reports
        path: blob-report

    - name: Merge into JSON Report
      run: npx playwright merge-reports --reporter json blob-report/

    - name: Upload JSON Report
      uses: actions/upload-artifact@v3
      with:
        name: json-report--attempt-${{ github.run_attempt }}
        path: blob-report
        retention-days: 3

When I tried including the actual json file, it says the artifact can’t be found: SLACK_BOT_USER_OAUTH_TOKEN=xxx npx playwright-slack-report -c playwright/cli_config.json -j blob-report/json-report--attempt-${{ github.run_attempt }}.json

Exact error: ❌ JSON results file does not exist: blob-report/json-report–attempt-1/: Use --json-results <path> e.g. --json-results=“./results.json”

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 20 (10 by maintainers)

Most upvoted comments

@poponuts try updating to the latest.

Couple things:

  • TypeError: Cannot destructure property 'retries' of 'parsedData.config.projects[0]' as it is undefined. was legit issue, the app wasn’t handling situations where retry is not configured in the Playwright config
  • Redirection is required when merging results 🤦

❌ This won’t work: npx playwright merge-reports --reporter json ./all-blob-reports

✅ This should work: npx playwright merge-reports --reporter json ./all-blob-reports > merged_tests_results.json

here is a full sample of my working GH action

name: Playwright Tests
on:
  push:
    branches: [ main, master ]
  pull_request:
    branches: [ main, master ]
jobs:
  playwright-tests:
    timeout-minutes: 60
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        shard: [1/2, 2/2]
    steps:
    - uses: actions/checkout@v3
    - uses: actions/setup-node@v3
      with:
        node-version: 18
    - name: Install dependencies
      run: npm ci
    - name: Install Playwright browsers
      run: npx playwright install --with-deps

    - name: Run Playwright tests
      run: npx playwright test --shard ${{ matrix.shard }}

    - name: Upload blob report to GitHub Actions Artifacts
      if: always()
      uses: actions/upload-artifact@v3
      with:
        name: all-blob-reports
        path: blob-report
        retention-days: 1

  merge-reports:
    # Merge reports after playwright-tests, even if some shards have failed
    if: always()
    needs: [playwright-tests]

    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - uses: actions/setup-node@v3
      with:
        node-version: 18
    - name: Install dependencies
      run: npm ci

    - name: Download blob reports from GitHub Actions Artifacts
      uses: actions/download-artifact@v3
      with:
        name: all-blob-reports
        path: all-blob-reports

    - name: Merge into JSON Report
      run: npx playwright merge-reports --reporter json ./all-blob-reports > merged_tests_results.json

    - name: List files
      run: ls -la

    - name: The path
      run: echo ${GITHUB_WORKSPACE}

    - name: View merged results
      run: cat ${GITHUB_WORKSPACE}/merged_tests_results.json

    - name: Send report to Slack using CLI
      env:
        SLACK_BOT_USER_OAUTH_TOKEN: ${{ secrets.SLACK_BOT_USER_OAUTH_TOKEN }}
      run: npx playwright-slack-report --config="${GITHUB_WORKSPACE}/cli_config.json" --json-results="${GITHUB_WORKSPACE}/merged_tests_results.json"


thanks for raising, let me try and repro