Skip to content

feat: add missing status assertions and .not negation support - #7660

Merged
bijin-bruno merged 9 commits into
usebruno:mainfrom
sanish-bruno:feat/status-assertions
May 19, 2026
Merged

bijin-bruno merged 9 commits into
usebruno:mainfrom
sanish-bruno:feat/status-assertions

Conversation

@sanish-bruno

@sanish-bruno sanish-bruno commented Apr 2, 2026 •

Copy link
Copy Markdown
Collaborator

Jira

Summary

  • 8 new status assertions for Postman-to-Bruno translation: info (1xx), accepted (202), badRequest (400), unauthorized (401), forbidden (403), notFound (404), rateLimited (429), withBody
  • .not negation support for all pm.response.to.be.* assertions (both to.not.be.X and to.be.not.X positions)
  • .not negation for to.have.* assertions: status, header, body (both to.not.have.X and to.have.not.X positions)
  • Refactored existing hand-coded to.be.* entries into a data-driven approach (postman-status-assertions.js) to reduce duplication
  • Consolidated to.have.* positive/negated pairs using .map() to eliminate near-duplicate transform blocks
  • Fixed withBody translation to use to.not.equal(undefined) instead of to.be.ok truthiness check, so falsy JSON bodies (false, 0, null) are handled correctly

New status assertions

Postman Bruno
pm.response.to.be.info; expect(res.getStatus()).to.be.within(100, 199);
pm.response.to.be.accepted; expect(res.getStatus()).to.equal(202);
pm.response.to.be.badRequest; expect(res.getStatus()).to.equal(400);
pm.response.to.be.unauthorized; expect(res.getStatus()).to.equal(401);
pm.response.to.be.forbidden; expect(res.getStatus()).to.equal(403);
pm.response.to.be.notFound; expect(res.getStatus()).to.equal(404);
pm.response.to.be.rateLimited; expect(res.getStatus()).to.equal(429);
pm.response.to.be.withBody; expect(res.getBody()).to.not.equal(undefined);

Negated to.be.* assertions

Postman Bruno
pm.response.to.not.be.ok; expect(res.getStatus()).to.not.be.within(200, 299);
pm.response.to.not.be.success; expect(res.getStatus()).to.not.be.within(200, 299);
pm.response.to.not.be.info; expect(res.getStatus()).to.not.be.within(100, 199);
pm.response.to.not.be.redirection; expect(res.getStatus()).to.not.be.within(300, 399);
pm.response.to.not.be.clientError; expect(res.getStatus()).to.not.be.within(400, 499);
pm.response.to.not.be.serverError; expect(res.getStatus()).to.not.be.within(500, 599);
pm.response.to.not.be.error; expect(res.getStatus()).to.not.be.at.least(400);
pm.response.to.not.be.accepted; expect(res.getStatus()).to.not.equal(202);
pm.response.to.not.be.badRequest; expect(res.getStatus()).to.not.equal(400);
pm.response.to.not.be.unauthorized; expect(res.getStatus()).to.not.equal(401);
pm.response.to.not.be.forbidden; expect(res.getStatus()).to.not.equal(403);
pm.response.to.not.be.notFound; expect(res.getStatus()).to.not.equal(404);
pm.response.to.not.be.rateLimited; expect(res.getStatus()).to.not.equal(429);
pm.response.to.not.be.withBody; expect(res.getBody()).to.equal(undefined);

Note: to.be.not.X (alternate .not position) is also supported for all of the above.

Negated to.have.* assertions

Postman Bruno
pm.response.to.not.have.status(404); expect(res.getStatus()).to.not.equal(404);
pm.response.to.not.have.header("X-Error"); expect(res.getHeaders()).to.not.have.property("X-Error".toLowerCase());
pm.response.to.not.have.header("Content-Type", "text/plain"); expect(res.getHeaders()).to.not.have.property("Content-Type".toLowerCase(), "text/plain");
pm.response.to.not.have.body("error"); expect(res.getBody()).to.not.equal("error");

Note: to.have.not.X (alternate .not position) is also supported for all of the above.

Architecture

  • postman-status-assertions.js — new data-driven module that generates status assertion entries (positive + both negated positions) from a declarative table
  • postman-to-bruno-translator.js — to.have.* pairs consolidated via .map(), withBody kept inline as body-content assertions (not status), status assertions spread at the bottom of complexTransformations

Contribution Checklist:

  • I've used AI significantly to create this pull request
  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.

Publishing to New Package Managers

Please see here for more information.

@coderabbitai

coderabbitai Bot commented Apr 2, 2026 •

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

This PR refactors Postman response assertion translation from hardcoded patterns to a data-driven approach. A new buildStatusAssertionEntries() module generates transformer functions for status assertions (positive and negated variants), while the translator is updated to use generators for have.* and be.* handlers, adding explicit withBody mappings and comprehensive negation support.

Changes

Response Assertion Translator Refactor

Layer / File(s) Summary
Status Assertion Builder
packages/bruno-converters/src/utils/postman-status-assertions.js
New module exports buildStatusAssertionEntries() to generate transformer functions for HTTP status assertions (ranges and specific codes) with positive, to.not, and to.be.not variants using jscodeshift AST generation.
Have Assertion Handlers
packages/bruno-converters/src/utils/postman-to-bruno-translator.js
Translator imports the status builder and replaces hardcoded handlers for pm.response.to.have.{status,header,body} with generators that emit negated variants; header names are lowercased before property checks.
WithBody & Status Integration
packages/bruno-converters/src/utils/postman-to-bruno-translator.js
Adds explicit mappings for pm.response.to.be.withBody to body truthiness checks, then uses buildStatusAssertionEntries() to replace all hardcoded status patterns (ok, success, redirection, clientError, serverError, error).
Test Coverage
packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/response.test.js
Comprehensive tests for positive pm.response.to.be.* status mappings, withBody, negated to.not.be.* and to.have.not.* variants, mixed assertions in pm.test() blocks, and alias-based access.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • usebruno/bruno#7052: Modifies pm.response.to.be.* and pm.response.to.have.* handlers in the same translator file.
  • usebruno/bruno#6761: Updates Postman↔Bruno translation tooling, AST helpers, and related tests.
  • usebruno/bruno#7301: Edits pm.response.to.have/* mappings in the same translator.

Suggested reviewers

  • helloanoop
  • naman-bruno
  • bijin-bruno
  • sid-bruno

Poem

📬 From hardcoded patterns to builders we go,
Status assertions now generative flow,
Negations gently layered, variants true,
Data-driven translators make testing anew. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: adding missing status assertions and implementing .not negation support across all pm.response assertions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sanish-bruno sanish-bruno changed the title feat: add new status assertions and negated variants for response checks feat: add missing status assertions and .not negation support Apr 2, 2026
@sanish-bruno
sanish-bruno force-pushed the feat/status-assertions branch from 5b3e0c3 to 0e23173 Compare May 6, 2026 09:01
@sanish-bruno
sanish-bruno requested a review from sid-bruno as a code owner May 6, 2026 09:01

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/response.test.js (1)

975-1097: ⚡ Quick win

Negation coverage is thorough; one alternate-position gap.

You've covered to.not.be.X for every status name and the alias path, but to.be.not.X (the alternate position the translator explicitly supports — see translator lines 505 and 525) is only exercised once for ok on line 981. Since the generator emits both forms uniformly, a regression in the alternate-position pattern would currently slip past tests for everything except ok.

A single combined test would close the gap cheaply:

🧪 Suggested addition
+  it('should translate pm.response.to.be.not.* (alternate position) for all status names', () => {
+    const code = `
+        pm.response.to.be.not.success;
+        pm.response.to.be.not.notFound;
+        pm.response.to.be.not.withoutBody;
+        `;
+    const translatedCode = translateCode(code);
+    expect(translatedCode).toContain('expect(res.getStatus()).to.not.be.within(200, 299)');
+    expect(translatedCode).toContain('expect(res.getStatus()).to.not.equal(404)');
+    expect(translatedCode).toContain('expect([204, 304]).to.not.include(res.getStatus())');
+  });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/response.test.js`
around lines 975 - 1097, Add a test that exercises the alternate negation
ordering "to.be.not.X" for multiple status types (not just ok) to mirror
existing "to.not.be.X" coverage; update the tests that call translateCode(...)
(see translateCode in this file) to include a pm.test block and/or standalone
lines using "pm.response.to.be.not.serverError",
"pm.response.to.be.not.clientError", and one alias form like
"resp.to.be.not.serverError" so the translator paths at the alternate-position
branches are exercised; ensure expectations assert the same translated strings
used elsewhere (e.g., expect(res.getStatus()).to.not.be.within(500, 599) etc.).
packages/bruno-converters/src/utils/postman-to-bruno-translator.js (1)

465-529: 💤 Low value

Nice data-driven refactor — one small fragility worth a comment.

The IIFE removes a lot of duplication and the positive/negated/alternate-position fan-out is tidy. One thing that may bite a future contributor: negateChain uses chain.replace('to.', 'to.not.'), which silently relies on every chain starting with to. and on the first match being the right one. For example, a future entry like 'is.true' or a chain starting with something else would yield is.true unchanged, and 'to.have.to.something' would only flip the first segment.

Today every entry starts with to. so the behavior is correct, but a tiny guard + comment would make the contract obvious:

♻️ Suggested clarification
-    const negateChain = (chain) => chain.replace('to.', 'to.not.');
+    // Inserts `.not` right after the leading `to.` (e.g. `to.be.within` -> `to.not.be.within`).
+    // All chains in `statusAssertions` are expected to start with `to.`.
+    const negateChain = (chain) => {
+      if (!chain.startsWith('to.')) {
+        throw new Error(`negateChain expects chain to start with "to.", got: ${chain}`);
+      }
+      return `to.not.${chain.slice(3)}`;
+    };
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/bruno-converters/src/utils/postman-to-bruno-translator.js` around
lines 465 - 529, negateChain currently does chain.replace('to.', 'to.not.')
which silently misbehaves for chains not beginning with "to."; update
negateChain to explicitly check that the incoming chain startsWith('to.') (or
use a /^to\./ regex) and replace only that prefix with 'to.not.' (or
throw/assert if the contract is violated), and add a short comment above
negateChain explaining the expected "to."-prefixed contract; reference
negateChain, buildStatusTransform and statusAssertions when making the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/bruno-converters/src/utils/postman-to-bruno-translator.js`:
- Around line 465-529: negateChain currently does chain.replace('to.',
'to.not.') which silently misbehaves for chains not beginning with "to."; update
negateChain to explicitly check that the incoming chain startsWith('to.') (or
use a /^to\./ regex) and replace only that prefix with 'to.not.' (or
throw/assert if the contract is violated), and add a short comment above
negateChain explaining the expected "to."-prefixed contract; reference
negateChain, buildStatusTransform and statusAssertions when making the change.

In
`@packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/response.test.js`:
- Around line 975-1097: Add a test that exercises the alternate negation
ordering "to.be.not.X" for multiple status types (not just ok) to mirror
existing "to.not.be.X" coverage; update the tests that call translateCode(...)
(see translateCode in this file) to include a pm.test block and/or standalone
lines using "pm.response.to.be.not.serverError",
"pm.response.to.be.not.clientError", and one alias form like
"resp.to.be.not.serverError" so the translator paths at the alternate-position
branches are exercised; ensure expectations assert the same translated strings
used elsewhere (e.g., expect(res.getStatus()).to.not.be.within(500, 599) etc.).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9dcf3752-ae95-41a3-8244-13f29368318e

📥 Commits

Reviewing files that changed from the base of the PR and between 5b3e0c3 and 0e23173.

📒 Files selected for processing (2)
  • packages/bruno-converters/src/utils/postman-to-bruno-translator.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/response.test.js

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/bruno-converters/src/utils/postman-to-bruno-translator.js`:
- Around line 510-526: The transform created by buildWithBodyTransform currently
wraps the member expression in a j.callExpression which emits
expect(res.getBody()).to.be.ok() and causes a TypeError because ok is a
chainable property, not a function; change buildWithBodyTransform (used by the
three entries with patterns 'pm.response.to.be.withBody',
'pm.response.to.not.be.withBody', 'pm.response.to.be.not.withBody') to return
the j.memberExpression directly (i.e., return
j.memberExpression(j.callExpression(j.identifier('expect'),
[j.callExpression(j.identifier('res.getBody'), [])]), j.identifier(chain)))
instead of wrapping it in j.callExpression so the output is
expect(res.getBody()).to.be.ok without calling it.

In
`@packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/response.test.js`:
- Around line 942-946: The test for "should translate
pm.response.to.be.withBody" currently uses toContain which masks whether the
translator produced `ok` vs `ok()`; update the assertion to use toBe with the
exact expected string "expect(res.getBody()).to.be.ok" (i.e., replace
expect(translatedCode).toContain(...) with expect(translatedCode).toBe(...)) and
apply the identical change to the corresponding "to.not.be.withBody" test so
both tests assert the exact expected output from translateCode.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ea5f4366-a49f-49ed-94e8-305a3d92063a

📥 Commits

Reviewing files that changed from the base of the PR and between 0e23173 and 2aa2c54.

📒 Files selected for processing (2)
  • packages/bruno-converters/src/utils/postman-to-bruno-translator.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/response.test.js

lohit-bruno
lohit-bruno previously approved these changes May 7, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/response.test.js (1)

954-958: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

toContain still masks the ok vs ok() regression — tighten to toBe.

Both withBody tests use toContain, which passes even if the translator emits ok() (broken) instead of ok (correct). Swap to toBe with the exact expected string so the assertion is precise.

🔧 Proposed fix
-    expect(translatedCode).toContain('expect(res.getBody()).to.be.ok');
+    expect(translatedCode).toBe('expect(res.getBody()).to.be.ok;');
-    expect(translatedCode).toContain('expect(res.getBody()).to.not.be.ok');
+    expect(translatedCode).toBe('expect(res.getBody()).to.not.be.ok;');

Also applies to: 1069-1073

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/response.test.js`
around lines 954 - 958, The tests for translating pm.response.to.be.withBody use
toContain which masks regressions between emitting "ok" vs "ok()"; update the
assertions in the test cases (e.g., the "should translate
pm.response.to.be.withBody" test and the other withBody test around the later
block) to use toBe with the exact expected string returned by translateCode
(e.g., expect(translatedCode).toBe('<exact expected string>')) so the assertion
fails if the translator emits ok() instead of ok; locate the tests by their
descriptions and the translateCode call to change the matcher and provide the
precise expected string.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/response.test.js`:
- Around line 909-981: Add tests for the new pm.response.to.be.withoutBody
assertion mirroring the other new assertions: create a standalone test that
calls translateCode('pm.response.to.be.withoutBody;') and expect the output
toContain a check that res.getStatus() matches 204 or 304 (e.g. expect([204,
304]).to.include(res.getStatus()) or equivalent project style), add a negated
variant if you follow the pattern elsewhere, and include the assertion inside a
pm.test(...) block test similar to the "should handle new status assertions
inside test blocks" case so the translator is exercised both standalone and
inside tests; locate tests near the other pm.response.* assertions and use
translateCode, expect(...).toContain with the unique symbol
pm.response.to.be.withoutBody and the corresponding expected translated status
check.

---

Duplicate comments:
In
`@packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/response.test.js`:
- Around line 954-958: The tests for translating pm.response.to.be.withBody use
toContain which masks regressions between emitting "ok" vs "ok()"; update the
assertions in the test cases (e.g., the "should translate
pm.response.to.be.withBody" test and the other withBody test around the later
block) to use toBe with the exact expected string returned by translateCode
(e.g., expect(translatedCode).toBe('<exact expected string>')) so the assertion
fails if the translator emits ok() instead of ok; locate the tests by their
descriptions and the translateCode call to change the matcher and provide the
precise expected string.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e6904d8d-fbe7-47a7-aa84-4c71bedfc3c0

📥 Commits

Reviewing files that changed from the base of the PR and between 2aa2c54 and 80c4879.

📒 Files selected for processing (2)
  • packages/bruno-converters/src/utils/postman-to-bruno-translator.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/response.test.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/bruno-converters/src/utils/postman-to-bruno-translator.js

@pull-request-size pull-request-size Bot added size/XL and removed size/L labels May 8, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
packages/bruno-converters/src/utils/postman-to-bruno-translator.js (1)

527-543: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

buildWithBodyTransform still emits ok() — TypeError at runtime in Chai.

ok is a chainable property (getter), not a callable method. The ability to use an assertion property as a function was removed in Chai 2.0.0 and is backwards-incompatible. The current j.callExpression(..., []) wrapper generates expect(res.getBody()).to.be.ok() and expect(res.getBody()).to.not.be.ok(), both of which throw TypeError when the translated script is executed. The fix already exists right above in this same file — see the single-arg header transform at line 254.

🐛 Fix — return `j.memberExpression` directly
-    const buildWithBodyTransform = (chain) => (path, j) => {
-      return j.callExpression(
-        j.memberExpression(
-          j.callExpression(j.identifier('expect'), [
-            j.callExpression(j.identifier('res.getBody'), [])
-          ]),
-          j.identifier(chain)
-        ),
-        []
-      );
-    };
+    const buildWithBodyTransform = (chain) => (_path, j) => {
+      return j.memberExpression(
+        j.callExpression(j.identifier('expect'), [
+          j.callExpression(j.identifier('res.getBody'), [])
+        ]),
+        j.identifier(chain)
+      );
+    };
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/bruno-converters/src/utils/postman-to-bruno-translator.js` around
lines 527 - 543, The transform currently wraps the chain (e.g., "to.be.ok" /
"to.not.be.ok") in a callExpression, producing expect(res.getBody()).to.be.ok(),
which throws because "ok" is a chainable property, not a function; update
buildWithBodyTransform to return the j.memberExpression for
expect(res.getBody()) and the identifier chain directly (i.e., do not wrap the
final memberExpression in j.callExpression), so the entries for
'pm.response.to.be.withBody', 'pm.response.to.not.be.withBody', and
'pm.response.to.be.not.withBody' produce expect(res.getBody()).to.be.ok and
expect(res.getBody()).to.not.be.ok (no parentheses).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@packages/bruno-converters/src/utils/postman-to-bruno-translator.js`:
- Around line 527-543: The transform currently wraps the chain (e.g., "to.be.ok"
/ "to.not.be.ok") in a callExpression, producing
expect(res.getBody()).to.be.ok(), which throws because "ok" is a chainable
property, not a function; update buildWithBodyTransform to return the
j.memberExpression for expect(res.getBody()) and the identifier chain directly
(i.e., do not wrap the final memberExpression in j.callExpression), so the
entries for 'pm.response.to.be.withBody', 'pm.response.to.not.be.withBody', and
'pm.response.to.be.not.withBody' produce expect(res.getBody()).to.be.ok and
expect(res.getBody()).to.not.be.ok (no parentheses).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: af6927be-70f0-4e6a-ba70-2feac125c67f

📥 Commits

Reviewing files that changed from the base of the PR and between 80c4879 and 3143f78.

📒 Files selected for processing (5)
  • packages/bruno-converters/src/utils/postman-to-bruno-translator.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/response.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/combined.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/multiline-syntax.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/response.test.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/response.test.js

@sanish-bruno

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/bruno-converters/src/utils/postman-to-bruno-translator.js`:
- Around line 550-577: The translation for pm.response.to.be.withBody (and its
negations pm.response.to.not.be.withBody and pm.response.to.be.not.withBody)
incorrectly maps to expect(res.getBody()).to.be.ok which fails for valid falsy
JSON bodies; change the transforms in postman-to-bruno-translator.js to use an
explicit presence check like expect(res.getBody()).to.notEqual(undefined) /
expect(res.getBody()).toEqual(undefined) (or expect(res.getBody() !== undefined)
as appropriate) instead of truthiness, update the three transform blocks that
build the memberExpression/callExpression for expect(res.getBody()) to use the
!== undefined comparisons for positive and negative cases, and add a regression
test that asserts translation handles falsy JSON bodies (false, 0, null) to
ensure behavior is correct.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5c30734a-4a5a-469c-baf6-a61c999dad6e

📥 Commits

Reviewing files that changed from the base of the PR and between 80c4879 and 778df6e.

📒 Files selected for processing (3)
  • packages/bruno-converters/src/utils/postman-status-assertions.js
  • packages/bruno-converters/src/utils/postman-to-bruno-translator.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/response.test.js

- Introduced new status assertions: `pm.response.to.be.info`, `pm.response.to.be.accepted`, `pm.response.to.be.badRequest`, `pm.response.to.be.unauthorized`, `pm.response.to.be.forbidden`, `pm.response.to.be.notFound`, `pm.response.to.be.rateLimited`, and `pm.response.to.be.withoutBody`.
- Implemented negated variants for existing assertions, allowing checks like `pm.response.to.not.be.ok` and `pm.response.to.not.be.success`.
- Enhanced test coverage to validate the translation of these new assertions and their negated forms in the Postman to Bruno conversion process.
- Changed the translation logic for `pm.response.to.be.withoutBody` to `pm.response.to.be.withBody`, reflecting the actual body content checks.
- Updated corresponding test cases to validate the new assertions and ensure correct translation behavior for body presence checks.
- Enhanced negated variants for body assertions to align with the updated logic.
- Introduced new transformations for `pm.request.headers.prepend`, `pm.request.headers.insert`, and `pm.request.headers.insertAfter` to map to `req.headerList.add`, enhancing header management during the conversion process.
- Updated the transformation logic to ensure only the first argument is retained for these methods, aligning with the intended behavior of the header list operations.
…version

- Simplified the transformation for `pm.response.to.have.header` and `pm.response.to.not.have.header` to use `res.getHeader` instead of `res.getHeaders`, improving clarity and consistency in the assertions.
- Adjusted related test cases to validate the new transformation logic, ensuring accurate translation of header checks in the conversion process.
…version

- Enhanced the transformation for `pm.response.to.have.header` and `pm.response.to.not.have.header` to utilize `res.getHeaders()` with lowercased header names, improving consistency and accuracy in header assertions.
- Updated related test cases to reflect the new transformation logic, ensuring correct translation of header checks in the conversion process.
- Introduced a new utility to generate data-driven status assertion entries for `pm.response.to.be.*` checks, including positive and negated variants.
- Integrated the new status assertions into the Postman to Bruno translation logic, enhancing the capability to handle various response status checks.
- Updated tests to validate the translation of new assertions, ensuring accurate conversion of status checks in the response handling process.
- Updated the transformation logic for `pm.response.to.have.*` assertions to include negated variants, allowing for patterns like `pm.response.to.have.not.status`, `pm.response.to.have.not.header`, and `pm.response.to.have.not.body`.
- Adjusted related test cases to validate the new translations, ensuring accurate conversion of negated assertions in the response handling process.
@sanish-bruno
sanish-bruno force-pushed the feat/status-assertions branch from 778df6e to d1fd653 Compare May 11, 2026 10:50
- Changed the export of `buildStatusAssertionEntries` to ES module syntax for better compatibility with modern JavaScript practices.
- Updated the import statement in the Postman to Bruno translator to reflect the new export format, ensuring seamless integration of the status assertion utility.
…ecks

- Modified the transformation logic for `pm.response.to.be.withBody`, `pm.response.to.not.be.withBody`, and `pm.response.to.be.not.withBody` to use an undefined check instead of truthiness, allowing for accurate handling of falsy body values.
- Updated related test cases to reflect these changes, ensuring correct translation of body presence assertions in the response handling process.
@bijin-bruno
bijin-bruno merged commit 8cc3a67 into usebruno:main May 19, 2026
10 checks passed
sid-bruno pushed a commit to sid-bruno/bruno that referenced this pull request May 19, 2026
…no#7660)

* feat: add new status assertions and negated variants for response checks

- Introduced new status assertions: `pm.response.to.be.info`, `pm.response.to.be.accepted`, `pm.response.to.be.badRequest`, `pm.response.to.be.unauthorized`, `pm.response.to.be.forbidden`, `pm.response.to.be.notFound`, `pm.response.to.be.rateLimited`, and `pm.response.to.be.withoutBody`.
- Implemented negated variants for existing assertions, allowing checks like `pm.response.to.not.be.ok` and `pm.response.to.not.be.success`.
- Enhanced test coverage to validate the translation of these new assertions and their negated forms in the Postman to Bruno conversion process.

* refactor: update response translation for body assertions

- Changed the translation logic for `pm.response.to.be.withoutBody` to `pm.response.to.be.withBody`, reflecting the actual body content checks.
- Updated corresponding test cases to validate the new assertions and ensure correct translation behavior for body presence checks.
- Enhanced negated variants for body assertions to align with the updated logic.

* feat: add header transformation methods for Postman to Bruno conversion

- Introduced new transformations for `pm.request.headers.prepend`, `pm.request.headers.insert`, and `pm.request.headers.insertAfter` to map to `req.headerList.add`, enhancing header management during the conversion process.
- Updated the transformation logic to ensure only the first argument is retained for these methods, aligning with the intended behavior of the header list operations.

* refactor: update header transformation logic for Postman to Bruno conversion

- Simplified the transformation for `pm.response.to.have.header` and `pm.response.to.not.have.header` to use `res.getHeader` instead of `res.getHeaders`, improving clarity and consistency in the assertions.
- Adjusted related test cases to validate the new transformation logic, ensuring accurate translation of header checks in the conversion process.

* refactor: update header transformation logic for Postman to Bruno conversion

- Enhanced the transformation for `pm.response.to.have.header` and `pm.response.to.not.have.header` to utilize `res.getHeaders()` with lowercased header names, improving consistency and accuracy in header assertions.
- Updated related test cases to reflect the new transformation logic, ensuring correct translation of header checks in the conversion process.

* feat: add data-driven status assertions for response checks

- Introduced a new utility to generate data-driven status assertion entries for `pm.response.to.be.*` checks, including positive and negated variants.
- Integrated the new status assertions into the Postman to Bruno translation logic, enhancing the capability to handle various response status checks.
- Updated tests to validate the translation of new assertions, ensuring accurate conversion of status checks in the response handling process.

* feat: enhance response assertion translations for negated variants

- Updated the transformation logic for `pm.response.to.have.*` assertions to include negated variants, allowing for patterns like `pm.response.to.have.not.status`, `pm.response.to.have.not.header`, and `pm.response.to.have.not.body`.
- Adjusted related test cases to validate the new translations, ensuring accurate conversion of negated assertions in the response handling process.

* refactor: convert status assertion utility to ES module syntax

- Changed the export of `buildStatusAssertionEntries` to ES module syntax for better compatibility with modern JavaScript practices.
- Updated the import statement in the Postman to Bruno translator to reflect the new export format, ensuring seamless integration of the status assertion utility.

* feat: update response body assertion translations to use undefined checks

- Modified the transformation logic for `pm.response.to.be.withBody`, `pm.response.to.not.be.withBody`, and `pm.response.to.be.not.withBody` to use an undefined check instead of truthiness, allowing for accurate handling of falsy body values.
- Updated related test cases to reflect these changes, ensuring correct translation of body presence assertions in the response handling process.
bijin-bruno pushed a commit that referenced this pull request May 19, 2026
…rialization addition (#8035)

* internal emit chain for clearance

* fix: crash ui

* fix(ErrorBoundary): ensure cache clearing is awaited before force quitting

* test(e2e): environment persistence across collections

* test: migration test

* Update environment.spec.ts

* feat: add missing status assertions and .not negation support (#7660)

* feat: add new status assertions and negated variants for response checks

- Introduced new status assertions: `pm.response.to.be.info`, `pm.response.to.be.accepted`, `pm.response.to.be.badRequest`, `pm.response.to.be.unauthorized`, `pm.response.to.be.forbidden`, `pm.response.to.be.notFound`, `pm.response.to.be.rateLimited`, and `pm.response.to.be.withoutBody`.
- Implemented negated variants for existing assertions, allowing checks like `pm.response.to.not.be.ok` and `pm.response.to.not.be.success`.
- Enhanced test coverage to validate the translation of these new assertions and their negated forms in the Postman to Bruno conversion process.

* refactor: update response translation for body assertions

- Changed the translation logic for `pm.response.to.be.withoutBody` to `pm.response.to.be.withBody`, reflecting the actual body content checks.
- Updated corresponding test cases to validate the new assertions and ensure correct translation behavior for body presence checks.
- Enhanced negated variants for body assertions to align with the updated logic.

* feat: add header transformation methods for Postman to Bruno conversion

- Introduced new transformations for `pm.request.headers.prepend`, `pm.request.headers.insert`, and `pm.request.headers.insertAfter` to map to `req.headerList.add`, enhancing header management during the conversion process.
- Updated the transformation logic to ensure only the first argument is retained for these methods, aligning with the intended behavior of the header list operations.

* refactor: update header transformation logic for Postman to Bruno conversion

- Simplified the transformation for `pm.response.to.have.header` and `pm.response.to.not.have.header` to use `res.getHeader` instead of `res.getHeaders`, improving clarity and consistency in the assertions.
- Adjusted related test cases to validate the new transformation logic, ensuring accurate translation of header checks in the conversion process.

* refactor: update header transformation logic for Postman to Bruno conversion

- Enhanced the transformation for `pm.response.to.have.header` and `pm.response.to.not.have.header` to utilize `res.getHeaders()` with lowercased header names, improving consistency and accuracy in header assertions.
- Updated related test cases to reflect the new transformation logic, ensuring correct translation of header checks in the conversion process.

* feat: add data-driven status assertions for response checks

- Introduced a new utility to generate data-driven status assertion entries for `pm.response.to.be.*` checks, including positive and negated variants.
- Integrated the new status assertions into the Postman to Bruno translation logic, enhancing the capability to handle various response status checks.
- Updated tests to validate the translation of new assertions, ensuring accurate conversion of status checks in the response handling process.

* feat: enhance response assertion translations for negated variants

- Updated the transformation logic for `pm.response.to.have.*` assertions to include negated variants, allowing for patterns like `pm.response.to.have.not.status`, `pm.response.to.have.not.header`, and `pm.response.to.have.not.body`.
- Adjusted related test cases to validate the new translations, ensuring accurate conversion of negated assertions in the response handling process.

* refactor: convert status assertion utility to ES module syntax

- Changed the export of `buildStatusAssertionEntries` to ES module syntax for better compatibility with modern JavaScript practices.
- Updated the import statement in the Postman to Bruno translator to reflect the new export format, ensuring seamless integration of the status assertion utility.

* feat: update response body assertion translations to use undefined checks

- Modified the transformation logic for `pm.response.to.be.withBody`, `pm.response.to.not.be.withBody`, and `pm.response.to.be.not.withBody` to use an undefined check instead of truthiness, allowing for accurate handling of falsy body values.
- Updated related test cases to reflect these changes, ensuring correct translation of body presence assertions in the response handling process.

* feat: support newer Postman export format with collection envelope (#8038)

- Updated the Postman collection importer to handle collections wrapped in a { collection: { ... } } format.
- Enhanced the parsing logic to extract collection info correctly from both legacy and newer formats.
- Added a new test case for importing a Postman v2.1 collection with the wrapped format to ensure compatibility.

* fix: reduce padding for dark mode app errors

---------

Co-authored-by: sanish chirayath <[email protected]>
lyh543 pushed a commit to lyh543/bruno that referenced this pull request May 22, 2026
…no#7660)

* feat: add new status assertions and negated variants for response checks

- Introduced new status assertions: `pm.response.to.be.info`, `pm.response.to.be.accepted`, `pm.response.to.be.badRequest`, `pm.response.to.be.unauthorized`, `pm.response.to.be.forbidden`, `pm.response.to.be.notFound`, `pm.response.to.be.rateLimited`, and `pm.response.to.be.withoutBody`.
- Implemented negated variants for existing assertions, allowing checks like `pm.response.to.not.be.ok` and `pm.response.to.not.be.success`.
- Enhanced test coverage to validate the translation of these new assertions and their negated forms in the Postman to Bruno conversion process.

* refactor: update response translation for body assertions

- Changed the translation logic for `pm.response.to.be.withoutBody` to `pm.response.to.be.withBody`, reflecting the actual body content checks.
- Updated corresponding test cases to validate the new assertions and ensure correct translation behavior for body presence checks.
- Enhanced negated variants for body assertions to align with the updated logic.

* feat: add header transformation methods for Postman to Bruno conversion

- Introduced new transformations for `pm.request.headers.prepend`, `pm.request.headers.insert`, and `pm.request.headers.insertAfter` to map to `req.headerList.add`, enhancing header management during the conversion process.
- Updated the transformation logic to ensure only the first argument is retained for these methods, aligning with the intended behavior of the header list operations.

* refactor: update header transformation logic for Postman to Bruno conversion

- Simplified the transformation for `pm.response.to.have.header` and `pm.response.to.not.have.header` to use `res.getHeader` instead of `res.getHeaders`, improving clarity and consistency in the assertions.
- Adjusted related test cases to validate the new transformation logic, ensuring accurate translation of header checks in the conversion process.

* refactor: update header transformation logic for Postman to Bruno conversion

- Enhanced the transformation for `pm.response.to.have.header` and `pm.response.to.not.have.header` to utilize `res.getHeaders()` with lowercased header names, improving consistency and accuracy in header assertions.
- Updated related test cases to reflect the new transformation logic, ensuring correct translation of header checks in the conversion process.

* feat: add data-driven status assertions for response checks

- Introduced a new utility to generate data-driven status assertion entries for `pm.response.to.be.*` checks, including positive and negated variants.
- Integrated the new status assertions into the Postman to Bruno translation logic, enhancing the capability to handle various response status checks.
- Updated tests to validate the translation of new assertions, ensuring accurate conversion of status checks in the response handling process.

* feat: enhance response assertion translations for negated variants

- Updated the transformation logic for `pm.response.to.have.*` assertions to include negated variants, allowing for patterns like `pm.response.to.have.not.status`, `pm.response.to.have.not.header`, and `pm.response.to.have.not.body`.
- Adjusted related test cases to validate the new translations, ensuring accurate conversion of negated assertions in the response handling process.

* refactor: convert status assertion utility to ES module syntax

- Changed the export of `buildStatusAssertionEntries` to ES module syntax for better compatibility with modern JavaScript practices.
- Updated the import statement in the Postman to Bruno translator to reflect the new export format, ensuring seamless integration of the status assertion utility.

* feat: update response body assertion translations to use undefined checks

- Modified the transformation logic for `pm.response.to.be.withBody`, `pm.response.to.not.be.withBody`, and `pm.response.to.be.not.withBody` to use an undefined check instead of truthiness, allowing for accurate handling of falsy body values.
- Updated related test cases to reflect these changes, ensuring correct translation of body presence assertions in the response handling process.
lyh543 pushed a commit to lyh543/bruno that referenced this pull request May 22, 2026
…rialization addition (usebruno#8035)

* internal emit chain for clearance

* fix: crash ui

* fix(ErrorBoundary): ensure cache clearing is awaited before force quitting

* test(e2e): environment persistence across collections

* test: migration test

* Update environment.spec.ts

* feat: add missing status assertions and .not negation support (usebruno#7660)

* feat: add new status assertions and negated variants for response checks

- Introduced new status assertions: `pm.response.to.be.info`, `pm.response.to.be.accepted`, `pm.response.to.be.badRequest`, `pm.response.to.be.unauthorized`, `pm.response.to.be.forbidden`, `pm.response.to.be.notFound`, `pm.response.to.be.rateLimited`, and `pm.response.to.be.withoutBody`.
- Implemented negated variants for existing assertions, allowing checks like `pm.response.to.not.be.ok` and `pm.response.to.not.be.success`.
- Enhanced test coverage to validate the translation of these new assertions and their negated forms in the Postman to Bruno conversion process.

* refactor: update response translation for body assertions

- Changed the translation logic for `pm.response.to.be.withoutBody` to `pm.response.to.be.withBody`, reflecting the actual body content checks.
- Updated corresponding test cases to validate the new assertions and ensure correct translation behavior for body presence checks.
- Enhanced negated variants for body assertions to align with the updated logic.

* feat: add header transformation methods for Postman to Bruno conversion

- Introduced new transformations for `pm.request.headers.prepend`, `pm.request.headers.insert`, and `pm.request.headers.insertAfter` to map to `req.headerList.add`, enhancing header management during the conversion process.
- Updated the transformation logic to ensure only the first argument is retained for these methods, aligning with the intended behavior of the header list operations.

* refactor: update header transformation logic for Postman to Bruno conversion

- Simplified the transformation for `pm.response.to.have.header` and `pm.response.to.not.have.header` to use `res.getHeader` instead of `res.getHeaders`, improving clarity and consistency in the assertions.
- Adjusted related test cases to validate the new transformation logic, ensuring accurate translation of header checks in the conversion process.

* refactor: update header transformation logic for Postman to Bruno conversion

- Enhanced the transformation for `pm.response.to.have.header` and `pm.response.to.not.have.header` to utilize `res.getHeaders()` with lowercased header names, improving consistency and accuracy in header assertions.
- Updated related test cases to reflect the new transformation logic, ensuring correct translation of header checks in the conversion process.

* feat: add data-driven status assertions for response checks

- Introduced a new utility to generate data-driven status assertion entries for `pm.response.to.be.*` checks, including positive and negated variants.
- Integrated the new status assertions into the Postman to Bruno translation logic, enhancing the capability to handle various response status checks.
- Updated tests to validate the translation of new assertions, ensuring accurate conversion of status checks in the response handling process.

* feat: enhance response assertion translations for negated variants

- Updated the transformation logic for `pm.response.to.have.*` assertions to include negated variants, allowing for patterns like `pm.response.to.have.not.status`, `pm.response.to.have.not.header`, and `pm.response.to.have.not.body`.
- Adjusted related test cases to validate the new translations, ensuring accurate conversion of negated assertions in the response handling process.

* refactor: convert status assertion utility to ES module syntax

- Changed the export of `buildStatusAssertionEntries` to ES module syntax for better compatibility with modern JavaScript practices.
- Updated the import statement in the Postman to Bruno translator to reflect the new export format, ensuring seamless integration of the status assertion utility.

* feat: update response body assertion translations to use undefined checks

- Modified the transformation logic for `pm.response.to.be.withBody`, `pm.response.to.not.be.withBody`, and `pm.response.to.be.not.withBody` to use an undefined check instead of truthiness, allowing for accurate handling of falsy body values.
- Updated related test cases to reflect these changes, ensuring correct translation of body presence assertions in the response handling process.

* feat: support newer Postman export format with collection envelope (usebruno#8038)

- Updated the Postman collection importer to handle collections wrapped in a { collection: { ... } } format.
- Enhanced the parsing logic to extract collection info correctly from both legacy and newer formats.
- Added a new test case for importing a Postman v2.1 collection with the wrapped format to ensure compatibility.

* fix: reduce padding for dark mode app errors

---------

Co-authored-by: sanish chirayath <[email protected]>
sharan-bruno pushed a commit to sharan-bruno/bruno that referenced this pull request Jun 4, 2026
…no#7660)

* feat: add new status assertions and negated variants for response checks

- Introduced new status assertions: `pm.response.to.be.info`, `pm.response.to.be.accepted`, `pm.response.to.be.badRequest`, `pm.response.to.be.unauthorized`, `pm.response.to.be.forbidden`, `pm.response.to.be.notFound`, `pm.response.to.be.rateLimited`, and `pm.response.to.be.withoutBody`.
- Implemented negated variants for existing assertions, allowing checks like `pm.response.to.not.be.ok` and `pm.response.to.not.be.success`.
- Enhanced test coverage to validate the translation of these new assertions and their negated forms in the Postman to Bruno conversion process.

* refactor: update response translation for body assertions

- Changed the translation logic for `pm.response.to.be.withoutBody` to `pm.response.to.be.withBody`, reflecting the actual body content checks.
- Updated corresponding test cases to validate the new assertions and ensure correct translation behavior for body presence checks.
- Enhanced negated variants for body assertions to align with the updated logic.

* feat: add header transformation methods for Postman to Bruno conversion

- Introduced new transformations for `pm.request.headers.prepend`, `pm.request.headers.insert`, and `pm.request.headers.insertAfter` to map to `req.headerList.add`, enhancing header management during the conversion process.
- Updated the transformation logic to ensure only the first argument is retained for these methods, aligning with the intended behavior of the header list operations.

* refactor: update header transformation logic for Postman to Bruno conversion

- Simplified the transformation for `pm.response.to.have.header` and `pm.response.to.not.have.header` to use `res.getHeader` instead of `res.getHeaders`, improving clarity and consistency in the assertions.
- Adjusted related test cases to validate the new transformation logic, ensuring accurate translation of header checks in the conversion process.

* refactor: update header transformation logic for Postman to Bruno conversion

- Enhanced the transformation for `pm.response.to.have.header` and `pm.response.to.not.have.header` to utilize `res.getHeaders()` with lowercased header names, improving consistency and accuracy in header assertions.
- Updated related test cases to reflect the new transformation logic, ensuring correct translation of header checks in the conversion process.

* feat: add data-driven status assertions for response checks

- Introduced a new utility to generate data-driven status assertion entries for `pm.response.to.be.*` checks, including positive and negated variants.
- Integrated the new status assertions into the Postman to Bruno translation logic, enhancing the capability to handle various response status checks.
- Updated tests to validate the translation of new assertions, ensuring accurate conversion of status checks in the response handling process.

* feat: enhance response assertion translations for negated variants

- Updated the transformation logic for `pm.response.to.have.*` assertions to include negated variants, allowing for patterns like `pm.response.to.have.not.status`, `pm.response.to.have.not.header`, and `pm.response.to.have.not.body`.
- Adjusted related test cases to validate the new translations, ensuring accurate conversion of negated assertions in the response handling process.

* refactor: convert status assertion utility to ES module syntax

- Changed the export of `buildStatusAssertionEntries` to ES module syntax for better compatibility with modern JavaScript practices.
- Updated the import statement in the Postman to Bruno translator to reflect the new export format, ensuring seamless integration of the status assertion utility.

* feat: update response body assertion translations to use undefined checks

- Modified the transformation logic for `pm.response.to.be.withBody`, `pm.response.to.not.be.withBody`, and `pm.response.to.be.not.withBody` to use an undefined check instead of truthiness, allowing for accurate handling of falsy body values.
- Updated related test cases to reflect these changes, ensuring correct translation of body presence assertions in the response handling process.
sharan-bruno pushed a commit to sharan-bruno/bruno that referenced this pull request Jun 4, 2026
…rialization addition (usebruno#8035)

* internal emit chain for clearance

* fix: crash ui

* fix(ErrorBoundary): ensure cache clearing is awaited before force quitting

* test(e2e): environment persistence across collections

* test: migration test

* Update environment.spec.ts

* feat: add missing status assertions and .not negation support (usebruno#7660)

* feat: add new status assertions and negated variants for response checks

- Introduced new status assertions: `pm.response.to.be.info`, `pm.response.to.be.accepted`, `pm.response.to.be.badRequest`, `pm.response.to.be.unauthorized`, `pm.response.to.be.forbidden`, `pm.response.to.be.notFound`, `pm.response.to.be.rateLimited`, and `pm.response.to.be.withoutBody`.
- Implemented negated variants for existing assertions, allowing checks like `pm.response.to.not.be.ok` and `pm.response.to.not.be.success`.
- Enhanced test coverage to validate the translation of these new assertions and their negated forms in the Postman to Bruno conversion process.

* refactor: update response translation for body assertions

- Changed the translation logic for `pm.response.to.be.withoutBody` to `pm.response.to.be.withBody`, reflecting the actual body content checks.
- Updated corresponding test cases to validate the new assertions and ensure correct translation behavior for body presence checks.
- Enhanced negated variants for body assertions to align with the updated logic.

* feat: add header transformation methods for Postman to Bruno conversion

- Introduced new transformations for `pm.request.headers.prepend`, `pm.request.headers.insert`, and `pm.request.headers.insertAfter` to map to `req.headerList.add`, enhancing header management during the conversion process.
- Updated the transformation logic to ensure only the first argument is retained for these methods, aligning with the intended behavior of the header list operations.

* refactor: update header transformation logic for Postman to Bruno conversion

- Simplified the transformation for `pm.response.to.have.header` and `pm.response.to.not.have.header` to use `res.getHeader` instead of `res.getHeaders`, improving clarity and consistency in the assertions.
- Adjusted related test cases to validate the new transformation logic, ensuring accurate translation of header checks in the conversion process.

* refactor: update header transformation logic for Postman to Bruno conversion

- Enhanced the transformation for `pm.response.to.have.header` and `pm.response.to.not.have.header` to utilize `res.getHeaders()` with lowercased header names, improving consistency and accuracy in header assertions.
- Updated related test cases to reflect the new transformation logic, ensuring correct translation of header checks in the conversion process.

* feat: add data-driven status assertions for response checks

- Introduced a new utility to generate data-driven status assertion entries for `pm.response.to.be.*` checks, including positive and negated variants.
- Integrated the new status assertions into the Postman to Bruno translation logic, enhancing the capability to handle various response status checks.
- Updated tests to validate the translation of new assertions, ensuring accurate conversion of status checks in the response handling process.

* feat: enhance response assertion translations for negated variants

- Updated the transformation logic for `pm.response.to.have.*` assertions to include negated variants, allowing for patterns like `pm.response.to.have.not.status`, `pm.response.to.have.not.header`, and `pm.response.to.have.not.body`.
- Adjusted related test cases to validate the new translations, ensuring accurate conversion of negated assertions in the response handling process.

* refactor: convert status assertion utility to ES module syntax

- Changed the export of `buildStatusAssertionEntries` to ES module syntax for better compatibility with modern JavaScript practices.
- Updated the import statement in the Postman to Bruno translator to reflect the new export format, ensuring seamless integration of the status assertion utility.

* feat: update response body assertion translations to use undefined checks

- Modified the transformation logic for `pm.response.to.be.withBody`, `pm.response.to.not.be.withBody`, and `pm.response.to.be.not.withBody` to use an undefined check instead of truthiness, allowing for accurate handling of falsy body values.
- Updated related test cases to reflect these changes, ensuring correct translation of body presence assertions in the response handling process.

* feat: support newer Postman export format with collection envelope (usebruno#8038)

- Updated the Postman collection importer to handle collections wrapped in a { collection: { ... } } format.
- Enhanced the parsing logic to extract collection info correctly from both legacy and newer formats.
- Added a new test case for importing a Postman v2.1 collection with the wrapped format to ensure compatibility.

* fix: reduce padding for dark mode app errors

---------

Co-authored-by: sanish chirayath <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants