Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update pkgjs/action from 0.1.7 to 0.1.9 #2567

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
jobs:
build:
name: Test
uses: pkgjs/action/.github/workflows/node-test.yaml@v0.1.7
uses: pkgjs/action/.github/workflows/node-test.yaml@v0.1.9
with:
runs-on: ubuntu-latest, windows-latest
test-command: npm run coverage:ci
Expand Down
57 changes: 53 additions & 4 deletions test/mock-interceptor-unused-assertions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
const { test, beforeEach, afterEach } = require('tap')
const { MockAgent, setGlobalDispatcher } = require('..')
const PendingInterceptorsFormatter = require('../lib/mock/pending-interceptors-formatter')
const util = require('../lib/core/util')

// Since Node.js v21 `console.table` rows are aligned to the left
// https://github.com/nodejs/node/pull/50135
const tableRowsAlignedToLeft = util.nodeMajor >= 21

// Avoid colors in the output for inline snapshots.
const pendingInterceptorsFormatter = new PendingInterceptorsFormatter({ disableColors: true })
Expand Down Expand Up @@ -40,7 +45,17 @@ test('1 pending interceptor', t => {

const err = t.throws(() => mockAgentWithOneInterceptor().assertNoPendingInterceptors({ pendingInterceptorsFormatter }))

t.same(err.message, `
t.same(err.message, tableRowsAlignedToLeft
? `
1 interceptor is pending:
┌─────────┬────────┬───────────────────────┬──────┬─────────────┬────────────┬─────────────┬───────────┐
│ (index) │ Method │ Origin │ Path │ Status code │ Persistent │ Invocations │ Remaining │
├─────────┼────────┼───────────────────────┼──────┼─────────────┼────────────┼─────────────┼───────────┤
│ 0 │ 'GET' │ 'https://example.com' │ '/' │ 200 │ '❌' │ 0 │ 1 │
└─────────┴────────┴───────────────────────┴──────┴─────────────┴────────────┴─────────────┴───────────┘
`.trim()
: `
1 interceptor is pending:
┌─────────┬────────┬───────────────────────┬──────┬─────────────┬────────────┬─────────────┬───────────┐
Expand All @@ -61,7 +76,18 @@ test('2 pending interceptors', t => {
.reply(204, 'OK')
const err = t.throws(() => withTwoInterceptors.assertNoPendingInterceptors({ pendingInterceptorsFormatter }))

t.same(err.message, `
t.same(err.message, tableRowsAlignedToLeft
? `
2 interceptors are pending:
┌─────────┬────────┬──────────────────────────┬──────────────┬─────────────┬────────────┬─────────────┬───────────┐
│ (index) │ Method │ Origin │ Path │ Status code │ Persistent │ Invocations │ Remaining │
├─────────┼────────┼──────────────────────────┼──────────────┼─────────────┼────────────┼─────────────┼───────────┤
│ 0 │ 'GET' │ 'https://example.com' │ '/' │ 200 │ '❌' │ 0 │ 1 │
│ 1 │ 'GET' │ 'https://localhost:9999' │ '/some/path' │ 204 │ '❌' │ 0 │ 1 │
└─────────┴────────┴──────────────────────────┴──────────────┴─────────────┴────────────┴─────────────┴───────────┘
`.trim()
: `
2 interceptors are pending:
┌─────────┬────────┬──────────────────────────┬──────────────┬─────────────┬────────────┬─────────────┬───────────┐
Expand Down Expand Up @@ -123,7 +149,20 @@ test('Variations of persist(), times(), and pending status', async t => {

const err = t.throws(() => agent.assertNoPendingInterceptors({ pendingInterceptorsFormatter }))

t.same(err.message, `
t.same(err.message, tableRowsAlignedToLeft
? `
4 interceptors are pending:
┌─────────┬────────┬──────────────────────────┬──────────────────────┬─────────────┬────────────┬─────────────┬───────────┐
│ (index) │ Method │ Origin │ Path │ Status code │ Persistent │ Invocations │ Remaining │
├─────────┼────────┼──────────────────────────┼──────────────────────┼─────────────┼────────────┼─────────────┼───────────┤
│ 0 │ 'GET' │ 'https://example.com' │ '/' │ 200 │ '❌' │ 0 │ 1 │
│ 1 │ 'GET' │ 'https://localhost:9999' │ '/persistent/unused' │ 200 │ '✅' │ 0 │ Infinity │
│ 2 │ 'GET' │ 'https://localhost:9999' │ '/times/partial' │ 200 │ '❌' │ 1 │ 4 │
│ 3 │ 'GET' │ 'https://localhost:9999' │ '/times/unused' │ 200 │ '❌' │ 0 │ 2 │
└─────────┴────────┴──────────────────────────┴──────────────────────┴─────────────┴────────────┴─────────────┴───────────┘
`.trim()
: `
4 interceptors are pending:
┌─────────┬────────┬──────────────────────────┬──────────────────────┬─────────────┬────────────┬─────────────┬───────────┐
Expand Down Expand Up @@ -172,7 +211,17 @@ test('defaults to rendering output with terminal color when process.env.CI is un

const err = t.throws(
() => mockAgentWithOneInterceptor().assertNoPendingInterceptors())
t.same(err.message, `
t.same(err.message, tableRowsAlignedToLeft
? `
1 interceptor is pending:
┌─────────┬────────┬───────────────────────┬──────┬─────────────┬────────────┬─────────────┬───────────┐
│ (index) │ Method │ Origin │ Path │ Status code │ Persistent │ Invocations │ Remaining │
├─────────┼────────┼───────────────────────┼──────┼─────────────┼────────────┼─────────────┼───────────┤
│ 0 │ \u001b[32m'GET'\u001b[39m │ \u001b[32m'https://example.com'\u001b[39m │ \u001b[32m'/'\u001b[39m │ \u001b[33m200\u001b[39m │ \u001b[32m'❌'\u001b[39m │ \u001b[33m0\u001b[39m │ \u001b[33m1\u001b[39m │
└─────────┴────────┴───────────────────────┴──────┴─────────────┴────────────┴─────────────┴───────────┘
`.trim()
: `
1 interceptor is pending:
┌─────────┬────────┬───────────────────────┬──────┬─────────────┬────────────┬─────────────┬───────────┐
Expand Down
Loading