diff --git a/.github/workflows/autobahn.yml b/.github/workflows/autobahn.yml index bbe80896fe8..6048bd5bdf4 100644 --- a/.github/workflows/autobahn.yml +++ b/.github/workflows/autobahn.yml @@ -2,7 +2,7 @@ name: Autobahn on: workflow_dispatch: - pull_request_target: + pull_request: paths: - '.github/workflows/autobahn.yml' - 'lib/web/websocket/**' @@ -30,7 +30,6 @@ jobs: - name: Checkout Code uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 with: - ref: "${{ github.event.pull_request.merge_commit_sha }}" persist-credentials: false clean: false @@ -49,24 +48,10 @@ jobs: run: npm run test:websocket:autobahn env: FUZZING_SERVER_URL: ws://fuzzingserver:9001 + LOG_ON_ERROR: false - - name: Report into CI + - name: Report CI id: report-ci run: npm run test:websocket:autobahn:report - - - name: Generate Report for PR Comment - if: github.event_name == 'pull_request_target' - id: report-markdown - run: | - echo "comment<> $GITHUB_OUTPUT - node test/autobahn/report.js >> $GITHUB_OUTPUT - echo "nEOFn" >> $GITHUB_OUTPUT env: - REPORTER: markdown - - - name: Comment PR - if: github.event_name == 'pull_request_target' - uses: thollander/actions-comment-pull-request@v2 - with: - message: ${{ steps.report-markdown.outputs.comment }} - comment_tag: autobahn + FAIL_ON_ERROR: true diff --git a/test/autobahn/client.js b/test/autobahn/client.js index 53bc17e722c..3f013922839 100644 --- a/test/autobahn/client.js +++ b/test/autobahn/client.js @@ -2,6 +2,8 @@ const { WebSocket } = require('../..') +const logOnError = process.env.LOG_ON_ERROR === 'true' + let currentTest = 1 let testCount @@ -28,9 +30,11 @@ function nextTest () { currentTest++ process.nextTick(nextTest) }) - ws.addEventListener('error', (e) => { - console.error(e.error) - }) + if (logOnError) { + ws.addEventListener('error', (e) => { + console.error(e.error) + }) + } } const ws = new WebSocket(`${autobahnFuzzingserverUrl}/getCaseCount`) diff --git a/test/autobahn/report.js b/test/autobahn/report.js index 105eb4f1496..7dcae5fed7e 100644 --- a/test/autobahn/report.js +++ b/test/autobahn/report.js @@ -3,7 +3,6 @@ const result = require('./reports/clients/index.json').undici const failOnError = process.env.FAIL_ON_ERROR === 'true' -const reporter = process.env.REPORTER || 'table' let runFailed = false let okTests = 0 @@ -86,57 +85,22 @@ for (const key of keys) { } } -if ( - reporter === 'table' -) { - console.log('Autobahn Test Report\n\nSummary:') - - console.table({ - OK: okTests, - Failed: failedTests, - 'Non-Strict': nonStrictTests, - 'Wrong Code': wrongCodeTests, - Unclean: uncleanTests, - 'Failed By Client': failedByClientTests, - Informational: informationalTests, - Unimplemented: unimplementedTests, - 'Total Tests': totalTests - }) - - console.log('Details:') - - console.table(reorderedResult) -} +console.log('Autobahn Test Report\n\nSummary:') + +console.table({ + OK: okTests, + Failed: failedTests, + 'Non-Strict': nonStrictTests, + 'Wrong Code': wrongCodeTests, + Unclean: uncleanTests, + 'Failed By Client': failedByClientTests, + Informational: informationalTests, + Unimplemented: unimplementedTests, + Total: totalTests +}) -if (reporter === 'markdown') { - console.log(`## Autobahn Test Report - -### Summary - -| Type | Count | -|---|---| -| OK | ${okTests} | -| Failed | ${failedTests} | -| Non-Strict | ${nonStrictTests} | -| Wrong Code | ${wrongCodeTests} | -| Unclean | ${uncleanTests} | -| Failed By Client | ${failedByClientTests} | -| Informational | ${informationalTests} | -| Unimplemented | ${unimplementedTests} | -| Total Tests | ${totalTests} | - -
-Details - -| Test Case | Behavior | Close Behavior | Duration | Remote Close Code | -|---|---|---|---|---| -${keys.map(key => { - const testCase = reorderedResult[key] - return `| ${key} | ${testCase.behavior} | ${testCase.behaviorClose} | ${testCase.duration} | ${testCase.remoteCloseCode} |` -}).join('\n')} - -
-`) -} +console.log('Details:') + +console.table(reorderedResult) process.exit(runFailed ? 1 : 0)