Skip to content

feat: implement translation utilities for converting Bruno scripts pm format#6761

Merged
bijin-bruno merged 12 commits intousebruno:mainfrom
sanish-bruno:feat/bru-to-pm-translate
Jan 13, 2026
Merged

feat: implement translation utilities for converting Bruno scripts pm format#6761
bijin-bruno merged 12 commits intousebruno:mainfrom
sanish-bruno:feat/bru-to-pm-translate

Conversation

@sanish-bruno
Copy link
Collaborator

@sanish-bruno sanish-bruno commented Jan 9, 2026

Jira

  • Added bru-to-pm-translator for translating Bruno API calls to Postman equivalents.
  • Introduced pm-to-bru-translator for reverse translations from Postman to Bruno.
  • Created utility functions in ast-utils for efficient AST manipulations.
  • Enhanced bruno-to-postman.js to utilize the new translation functions for script handling.
  • Updated tests to cover various translation scenarios, ensuring accuracy and reliability.

Overview

The bru-to-pm-translator.js module transforms Bruno script syntax (used in pre-request and post-response scripts) to PM-compatible syntax. This enables seamless export of Bruno collections with scripts to PM.


Variable Translations

Global Variables

Bruno PM
bru.getGlobalEnvVar(name) pm.globals.get(name)
bru.setGlobalEnvVar(name, value) pm.globals.set(name, value)

Environment Variables

Bruno PM
bru.getEnvVar(name) pm.environment.get(name)
bru.setEnvVar(name, value) pm.environment.set(name, value)
bru.hasEnvVar(name) pm.environment.has(name)
bru.deleteEnvVar(name) pm.environment.unset(name)
bru.getEnvName() pm.environment.name

Runtime Variables

Bruno PM
bru.getVar(name) pm.variables.get(name)
bru.setVar(name, value) pm.variables.set(name, value)
bru.hasVar(name) pm.variables.has(name)
bru.deleteVar(name) pm.variables.unset(name)

Collection, Folder & Request Variables

Bruno PM
bru.getCollectionVar(name) pm.variables.get(name)
bru.getFolderVar(name) pm.variables.get(name)
bru.getRequestVar(name) pm.variables.get(name)

Note: Bruno's collection, folder, and request variable scopes all map to pm.variables.get() in PM.

Interpolation

Bruno PM
bru.interpolate(template) pm.variables.replaceIn(template)

Request Helpers

Bruno PM
req.getUrl() pm.request.url
req.getMethod() pm.request.method
req.getHeaders() pm.request.headers
req.getHeader(name) pm.request.headers.get(name)
req.setHeader(name, value) pm.request.headers.set(name, value)
req.getBody() pm.request.body
req.getName() pm.info.requestName

Response Helpers

Bruno PM
res.getStatus() pm.response.code
res.status pm.response.code
res.getStatusText() pm.response.status
res.statusText pm.response.status
res.getBody() pm.response.json()
res.body pm.response.body
res.getHeaders() pm.response.headers
res.getHeader(name) pm.response.headers.get(name)
res.getResponseTime() pm.response.responseTime
res.getSize() pm.response.size()
JSON.stringify(res.getBody()) pm.response.text()

Execution Control

Bruno PM
bru.setNextRequest(name) pm.execution.setNextRequest(name)
bru.runner.setNextRequest(name) pm.execution.setNextRequest(name)
bru.runner.skipRequest() pm.execution.skipRequest()
bru.runner.stopExecution() pm.execution.setNextRequest(null)

Testing Framework

Bruno PM
test(name, fn) pm.test(name, fn)
expect(value) pm.expect(value)
expect.fail(message) pm.expect.fail(message)

Cookie Jar Methods

Bruno PM
bru.cookies.jar() pm.cookies.jar()
jar.getCookie(url, name, callback?) jar.get(url, name, callback?)
jar.getCookies(url, callback?) jar.getAll(url, callback?)
jar.setCookie(url, name, value, callback?) jar.set(url, name, value, callback?)
jar.deleteCookie(url, name, callback?) jar.unset(url, name, callback?)
jar.deleteCookies(url, callback?) jar.clear(url, callback?)

Note: Bruno's setCookie with cookie object form is not supported. Use the (url, name, value, callback?) signature.


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.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added enhanced script translation between Bruno and Postman formats, supporting environment variables, request/response handling, execution control, cookies, and test assertions.
    • Implemented robust error handling for script conversions with fallback behavior.
  • Refactor

    • Updated translation utilities to use modular helper functions for improved maintainability.

✏️ Tip: You can customize this high-level summary in your review settings.

… Postman format

- Added `bru-to-pm-translator` for translating Bruno API calls to Postman equivalents.
- Introduced `pm-to-bru-translator` for reverse translations from Postman to Bruno.
- Created utility functions in `ast-utils` for efficient AST manipulations.
- Enhanced `bruno-to-postman.js` to utilize the new translation functions for script handling.
- Updated tests to cover various translation scenarios, ensuring accuracy and reliability.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 9, 2026

Warning

Rate limit exceeded

@sanish-bruno has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 10 minutes and 50 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 77df6f2 and e0505f4.

📒 Files selected for processing (1)
  • packages/bruno-converters/src/utils/bruno-to-postman-translator.js

Walkthrough

The pull request introduces a Bruno-to-Postman script translator with AST utilities and comprehensive test coverage. It adds safe translation wrappers to script processors, refactors existing imports to use the new translator, and standardizes module imports across test files from CommonJS to ES modules.

Changes

Cohort / File(s) Summary
Core Bruno-to-Postman Translation
packages/bruno-converters/src/utils/bruno-to-postman-translator.js
New module providing extensive AST-based translation of Bruno API calls (bru.\, req.\, res.\) to Postman equivalents (pm.\). Includes mappings for environment variables, execution control, cookies, request/response properties, and test framework calls with error handling and fallback logic.
AST Utility Functions
packages/bruno-converters/src/utils/ast-utils.js
New module exporting helper functions: getMemberExpressionString, buildMemberExpressionFromString, isIdentifierNamed, and isNullLiteral for AST node manipulation and analysis.
Script Translation Integration
packages/bruno-converters/src/postman/bruno-to-postman.js
Added safe translation wrapper (translateScriptSafely) that delegates to translateBruToPostman, logs warnings on error, and applies safe translations to prerequest, response, and test scripts.
Translator Module Updates
packages/bruno-converters/src/postman/postman-translations.js, packages/bruno-converters/src/utils/postman-to-bruno-translator.js
Updated imports from jscode-shift-translator to postman-to-bruno-translator; refactored postman-to-bruno-translator to import getMemberExpressionString from external ast-utils module.
Test Import Standardization
packages/bruno-converters/tests/postman/postman-translations/*.spec.js, packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/*.test.js, packages/bruno-converters/tests/utils/getMemberExpressionString.test.js
Updated 15+ test files: converted CommonJS require statements to ES module imports; updated translator imports from jscode-shift-translator to postman-to-bruno-translator.
Test Script Format Conversions
packages/bruno-converters/tests/bruno/bruno-to-postman-with-tests.spec.js
Updated test assertions from Mocha-style test() calls to Postman pm.test() framework style; changed response assertions from res.text/res.status to pm.response.body/pm.response.code.
New Bruno-to-Postman Translation Test Suites
packages/bruno-converters/tests/bruno/bruno-to-postman-translations/{cookies,environment,execution,request,response,testing-framework,variables}.test.js
Added 7 comprehensive test suites (~850 lines total) validating translation of Bruno API operations to Postman equivalents across environment variables, execution control, request/response properties, cookie handling, and testing framework calls.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • PR #6272: Modifies bruno-to-postman.js for Bruno→Postman script translation behavior changes.
  • PR #6117: Updates bruno-to-postman.js collection variable extraction and processing logic.

Suggested reviewers

  • lohit-bruno
  • bijin-bruno
  • helloanoop

Poem

🚀 From Bruno scripts to Postman's way,
AST helpers guide the translation play,
Safe wrappers catch what falls through cracks,
Environment, cookies, execution tracks,
Tests bloom to prove the journey's right. ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Title accurately describes the core change: implementing translation utilities for converting Bruno scripts to Postman format, which aligns with the PR's main deliverable.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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


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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
packages/bruno-converters/tests/bruno/bruno-to-postman-with-tests.spec.js (1)

202-213: Expected Postman scripts reference undefined res object; tests will fail at runtime.

The converter transforms test()pm.test() and expect()pm.expect(), but does not convert res.status and res.text because these are property accesses, not method calls. Postman has no global res variable. Use pm.response.code and pm.response.text() instead:

Fix
-      '    pm.expect(res.status).to.eql(200);',
+      '    pm.expect(pm.response.code).to.eql(200);',
       '});',
       'pm.test("Body is not empty", () => {',
-      '    pm.expect(res.text).not.to.eql("");',
+      '    pm.expect(pm.response.text()).not.to.eql("");',

Applies to all four test blocks: lines 202–213, 228–239, 255–266, 280–291.

packages/bruno-converters/src/utils/pm-to-bru-translator.js (1)

846-846: Remove unused re-export.

The re-export of getMemberExpressionString on line 846 is not imported by any code in the repository. Since consumers should import directly from ast-utils, this export can be safely removed.

🤖 Fix all issues with AI agents
In @packages/bruno-converters/src/utils/bru-to-pm-translator.js:
- Around line 92-99: The current transformer for pattern 'res.getSize'
incorrectly replaces only the callee and leaves a call expression
(res.getSize()) which yields pm.response.size(); change the transform for that
pattern to replace the entire CallExpression node with a MemberExpression for
the Postman property pm.response.responseSize (use
buildMemberExpressionFromString('pm.response.responseSize') on the path node
itself rather than path.get('callee')), and ensure you return the new node or
null per the transformer convention so the call is removed and replaced by a
property access instead of a method call.
🧹 Nitpick comments (7)
packages/bruno-converters/src/postman/bruno-to-postman.js (1)

171-178: Consider enhancing error handling.

The safe wrapper correctly prevents translation failures from breaking the export. However:

  • console.warn may be too verbose in production environments
  • The error object could potentially contain sensitive script content

Consider logging only a minimal error message or using a more appropriate logging mechanism.

♻️ Alternative approach
-  const translateScriptSafely = (script = '') => {
-    try {
-      return translateBruToPostman(script);
-    } catch (err) {
-      console.warn('Bru→Postman script translation failed, leaving script as-is', err);
-      return script;
-    }
-  };
+  const translateScriptSafely = (script = '') => {
+    try {
+      return translateBruToPostman(script);
+    } catch (err) {
+      console.warn('Bru→Postman script translation failed, leaving script as-is');
+      return script;
+    }
+  };
packages/bruno-converters/tests/bruno/bru-to-postman-translations/request.test.js (1)

1-1: Consider using ES module import for consistency.

While require works, other test files in the PR use ES module import syntax (e.g., postman-comments.spec.js). Consider updating for consistency:

import translateBruToPostman from '../../../src/utils/bru-to-pm-translator';
packages/bruno-converters/src/utils/ast-utils.js (2)

20-50: Consider adding null/undefined guards.

The function accesses node.type without checking if node is null/undefined, which could throw a TypeError. While this may be acceptable if callers are expected to validate inputs, the JSDoc doesn't document this requirement or specify @throws.

🛡️ Add defensive null check
 function getMemberExpressionString(node) {
+  if (!node) {
+    return '[invalid]';
+  }
+
   if (node.type === 'Identifier') {
     return node.name;
   }

Alternatively, document the requirement in JSDoc:

 /**
  * Efficiently builds a string representation of a member expression
  * without using toSource() for better performance.
  *
- * @param {Object} node - The member expression node from the AST
+ * @param {Object} node - The member expression node from the AST (must not be null/undefined)
  * @returns {string} - String representation of the member expression (e.g., "pm.environment.get")
+ * @throws {TypeError} If node is null or undefined

65-72: Consider adding null/undefined validation for str parameter.

Similar to getMemberExpressionString, this function calls str.split('.') without validating the input, which will throw if str is null/undefined.

🛡️ Add input validation or documentation

Option 1 - Add validation:

 function buildMemberExpressionFromString(str) {
+  if (!str || typeof str !== 'string') {
+    throw new Error('buildMemberExpressionFromString requires a non-empty string');
+  }
   const parts = str.split('.');

Option 2 - Document the requirement:

 /**
  * Builds a member expression AST node from a dotted string path.
  *
- * @param {string} str - Dotted path string (e.g., "pm.variables.get")
+ * @param {string} str - Dotted path string (e.g., "pm.variables.get") - must be non-empty
  * @returns {Object} - jscodeshift MemberExpression or Identifier node
+ * @throws {TypeError} If str is null, undefined, or not a string
packages/bruno-converters/src/utils/bru-to-pm-translator.js (3)

196-205: Cookie jar tracking assumes simple identifier assignment.

Line 200-202 only tracks variables when path.value.id.type === 'Identifier'. Destructuring patterns like const {jar} = bru.cookies won't be tracked. This is likely acceptable for typical usage patterns.


447-447: Consider logger abstraction instead of console.warn.

Using console.warn directly in library code makes it harder to control logging in different environments. Consider accepting a logger parameter or using a logging utility that consumers can configure.


424-437: Transformation order is critical but fragile.

The comments explain why order matters (lines 421-422), but the sequence is still vulnerable to accidental reordering. The five-step process must run in this exact order for correctness.

Consider:

  • Extracting to a TRANSFORMATION_PIPELINE constant array with explicit ordering metadata
  • Adding runtime assertions if transformations run out of order
  • Unit tests that verify order-dependent behavior
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 45264bf and 0484cca.

📒 Files selected for processing (31)
  • packages/bruno-converters/src/postman/bruno-to-postman.js
  • packages/bruno-converters/src/postman/postman-translations.js
  • packages/bruno-converters/src/utils/ast-utils.js
  • packages/bruno-converters/src/utils/bru-to-pm-translator.js
  • packages/bruno-converters/src/utils/pm-to-bru-translator.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/environment.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/request.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/response.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/testing-framework.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/variables.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-with-tests.spec.js
  • packages/bruno-converters/tests/postman/postman-translations/postman-comments.spec.js
  • packages/bruno-converters/tests/postman/postman-translations/postman-cookie-conversions.spec.js
  • packages/bruno-converters/tests/postman/postman-translations/postman-edge-cases.spec.js
  • packages/bruno-converters/tests/postman/postman-translations/postman-test-commands.spec.js
  • packages/bruno-converters/tests/postman/postman-translations/postman-variables.spec.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/combined.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/environment.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/exec-flow.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/legacy-global-apis.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/legacy-tests-syntax.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/multiline-syntax.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/postman-references.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/request.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/response.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/scoped-variables.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/testing-framework.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/transformers/send-request.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/variable-chaining.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/variables.test.js
  • packages/bruno-converters/tests/utils/getMemberExpressionString.test.js
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (CODING_STANDARDS.md)

**/*.{js,jsx,ts,tsx}: Use 2 spaces for indentation. No tabs, just spaces
Stick to single quotes for strings. For JSX/TSX attributes, use double quotes (e.g., )
Always add semicolons at the end of statements
No trailing commas
Always use parentheses around parameters in arrow functions, even for single params
For multiline constructs, put opening braces on the same line, and ensure consistency. Minimum 2 elements for multiline
No newlines inside function parentheses
Space before and after the arrow in arrow functions. () => {} is good
No space between function name and parentheses. func() not func ()
Semicolons go at the end of the line, not on a new line
Names for functions need to be concise and descriptive
Add in JSDoc comments to add more details to the abstractions if needed
Add in meaningful comments instead of obvious ones where complex code flow is explained properly

Files:

  • packages/bruno-converters/src/postman/postman-translations.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/environment.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/variables.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/request.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-with-tests.spec.js
  • packages/bruno-converters/tests/postman/postman-translations/postman-test-commands.spec.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/testing-framework.test.js
  • packages/bruno-converters/src/utils/pm-to-bru-translator.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/variables.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/combined.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/exec-flow.test.js
  • packages/bruno-converters/tests/postman/postman-translations/postman-comments.spec.js
  • packages/bruno-converters/src/utils/bru-to-pm-translator.js
  • packages/bruno-converters/src/utils/ast-utils.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/testing-framework.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/postman-references.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/transformers/send-request.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/response.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/environment.test.js
  • packages/bruno-converters/tests/postman/postman-translations/postman-edge-cases.spec.js
  • packages/bruno-converters/src/postman/bruno-to-postman.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/variable-chaining.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/legacy-tests-syntax.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/legacy-global-apis.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
  • packages/bruno-converters/tests/postman/postman-translations/postman-variables.spec.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/scoped-variables.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/request.test.js
  • packages/bruno-converters/tests/postman/postman-translations/postman-cookie-conversions.spec.js
  • packages/bruno-converters/tests/utils/getMemberExpressionString.test.js
**/*.test.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (CODING_STANDARDS.md)

Add tests for any new functionality or meaningful changes. If code is added, removed, or significantly modified, corresponding tests should be updated or created

Files:

  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/environment.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/variables.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/request.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/testing-framework.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/variables.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/combined.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/exec-flow.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/testing-framework.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/postman-references.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/transformers/send-request.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/response.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/environment.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/variable-chaining.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/legacy-tests-syntax.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/legacy-global-apis.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
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/scoped-variables.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/request.test.js
  • packages/bruno-converters/tests/utils/getMemberExpressionString.test.js
🧠 Learnings (6)
📚 Learning: 2025-12-17T21:41:24.730Z
Learnt from: naman-bruno
Repo: usebruno/bruno PR: 6407
File: packages/bruno-app/src/components/Environments/ConfirmCloseEnvironment/index.js:5-41
Timestamp: 2025-12-17T21:41:24.730Z
Learning: Do not suggest PropTypes validation for React components in the Bruno codebase. The project does not use PropTypes, so reviews should avoid proposing PropTypes and rely on the existing typing/validation approach (e.g., TypeScript or alternative runtime checks) if applicable. This guideline applies broadly to all JavaScript/JSX components in the repo.

Applied to files:

  • packages/bruno-converters/src/postman/postman-translations.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/environment.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/variables.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/request.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-with-tests.spec.js
  • packages/bruno-converters/tests/postman/postman-translations/postman-test-commands.spec.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/testing-framework.test.js
  • packages/bruno-converters/src/utils/pm-to-bru-translator.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/variables.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/combined.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/exec-flow.test.js
  • packages/bruno-converters/tests/postman/postman-translations/postman-comments.spec.js
  • packages/bruno-converters/src/utils/bru-to-pm-translator.js
  • packages/bruno-converters/src/utils/ast-utils.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/testing-framework.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/postman-references.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/transformers/send-request.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/response.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/environment.test.js
  • packages/bruno-converters/tests/postman/postman-translations/postman-edge-cases.spec.js
  • packages/bruno-converters/src/postman/bruno-to-postman.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/variable-chaining.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/legacy-tests-syntax.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/legacy-global-apis.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
  • packages/bruno-converters/tests/postman/postman-translations/postman-variables.spec.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/scoped-variables.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/request.test.js
  • packages/bruno-converters/tests/postman/postman-translations/postman-cookie-conversions.spec.js
  • packages/bruno-converters/tests/utils/getMemberExpressionString.test.js
📚 Learning: 2025-12-16T07:16:23.647Z
Learnt from: sanish-bruno
Repo: usebruno/bruno PR: 6090
File: tests/scripting/hooks/init-user-data/ui-state-snapshot.json:1-8
Timestamp: 2025-12-16T07:16:23.647Z
Learning: For e2e tests in the bruno repository: Collections that are shared between CLI and UI tests (comprehensive test suites testing core functionality) should be placed in `packages/bruno-tests/` to avoid duplication. The `tests/**/fixtures/collection` pattern should be used for test-specific collections that test particular UI behaviors or are specific to a single test file.

Applied to files:

  • packages/bruno-converters/tests/bruno/bruno-to-postman-with-tests.spec.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/testing-framework.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/variables.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/testing-framework.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/response.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/environment.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/request.test.js
📚 Learning: 2025-12-05T20:31:33.005Z
Learnt from: CR
Repo: usebruno/bruno PR: 0
File: CODING_STANDARDS.md:0-0
Timestamp: 2025-12-05T20:31:33.005Z
Learning: Applies to **/*.test.{js,jsx,ts,tsx} : Add tests for any new functionality or meaningful changes. If code is added, removed, or significantly modified, corresponding tests should be updated or created

Applied to files:

  • packages/bruno-converters/tests/bruno/bruno-to-postman-with-tests.spec.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/variables.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/testing-framework.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/response.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/environment.test.js
  • packages/bruno-converters/tests/postman/postman-translations/postman-edge-cases.spec.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/request.test.js
📚 Learning: 2025-12-05T20:31:33.005Z
Learnt from: CR
Repo: usebruno/bruno PR: 0
File: CODING_STANDARDS.md:0-0
Timestamp: 2025-12-05T20:31:33.005Z
Learning: Use consistent patterns and helper utilities where they improve clarity. Prefer shared test utilities over copy-pasted setup code, but only when it actually reduces complexity

Applied to files:

  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/testing-framework.test.js
📚 Learning: 2025-12-05T20:31:33.005Z
Learnt from: CR
Repo: usebruno/bruno PR: 0
File: CODING_STANDARDS.md:0-0
Timestamp: 2025-12-05T20:31:33.005Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : For multiline constructs, put opening braces on the same line, and ensure consistency. Minimum 2 elements for multiline

Applied to files:

  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/multiline-syntax.test.js
📚 Learning: 2025-12-05T20:31:33.005Z
Learnt from: CR
Repo: usebruno/bruno PR: 0
File: CODING_STANDARDS.md:0-0
Timestamp: 2025-12-05T20:31:33.005Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : No newlines inside function parentheses

Applied to files:

  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/multiline-syntax.test.js
🧬 Code graph analysis (5)
packages/bruno-converters/src/utils/pm-to-bru-translator.js (2)
packages/bruno-converters/src/utils/bru-to-pm-translator.js (1)
  • require (3-8)
packages/bruno-converters/tests/utils/getMemberExpressionString.test.js (2)
  • require (1-1)
  • require (2-2)
packages/bruno-converters/tests/bruno/bru-to-postman-translations/testing-framework.test.js (4)
packages/bruno-converters/tests/bruno/bru-to-postman-translations/environment.test.js (1)
  • translateBruToPostman (1-1)
packages/bruno-converters/src/utils/bru-to-pm-translator.js (1)
  • require (3-8)
packages/bruno-converters/tests/utils/getMemberExpressionString.test.js (2)
  • require (1-1)
  • require (2-2)
packages/bruno-converters/src/postman/postman-translations.js (1)
  • translatedCode (100-100)
packages/bruno-converters/src/postman/bruno-to-postman.js (6)
packages/bruno-converters/src/openapi/openapi-to-bruno.js (1)
  • script (537-537)
packages/bruno-converters/tests/bruno/bru-to-postman-translations/environment.test.js (1)
  • translateBruToPostman (1-1)
packages/bruno-converters/tests/bruno/bru-to-postman-translations/request.test.js (1)
  • translateBruToPostman (1-1)
packages/bruno-converters/tests/bruno/bru-to-postman-translations/response.test.js (1)
  • translateBruToPostman (1-1)
packages/bruno-converters/tests/bruno/bru-to-postman-translations/testing-framework.test.js (1)
  • translateBruToPostman (1-1)
packages/bruno-converters/tests/bruno/bru-to-postman-translations/variables.test.js (1)
  • translateBruToPostman (1-1)
packages/bruno-converters/tests/bruno/bru-to-postman-translations/request.test.js (3)
packages/bruno-converters/src/utils/bru-to-pm-translator.js (1)
  • require (3-8)
packages/bruno-converters/src/utils/pm-to-bru-translator.js (1)
  • require (4-4)
packages/bruno-converters/tests/utils/getMemberExpressionString.test.js (2)
  • require (1-1)
  • require (2-2)
packages/bruno-converters/tests/utils/getMemberExpressionString.test.js (2)
packages/bruno-converters/src/utils/bru-to-pm-translator.js (1)
  • require (3-8)
packages/bruno-converters/src/utils/pm-to-bru-translator.js (1)
  • require (4-4)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Unit Tests
  • GitHub Check: Playwright E2E Tests
  • GitHub Check: SSL Tests - Windows
🔇 Additional comments (38)
packages/bruno-converters/tests/utils/getMemberExpressionString.test.js (1)

1-2: LGTM: test now correctly targets src/utils/ast-utils after the refactor.

packages/bruno-converters/tests/postman/postman-translations/postman-edge-cases.spec.js (1)

1-1: No action required. The import pattern is correct. The source file uses ESM default export (export default postmanTranslation), the test correctly uses ESM default import, and Jest is configured with --experimental-vm-modules to support ESM. No interop issues.

packages/bruno-converters/tests/postman/postman-translations/postman-test-commands.spec.js (1)

1-1: No issues found. The import style matches the source file's export default pattern.

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

1-1: No action needed—module already uses ESM export default.

The pm-to-bru-translator.js file exports via export default translateCode; (ESM), not CommonJS. The default import pattern is correct across all 15+ test and source files. The mixed syntax (CJS requires internally with ESM export) is valid and handled by babel-jest.

Likely an incorrect or invalid review comment.

packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/exec-flow.test.js (1)

1-1: LGTM: Consistent translator module switch.

The import change aligns with the broader refactoring to use pm-to-bru-translator across the test suite.

packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/multiline-syntax.test.js (1)

1-1: LGTM: Import updated to new translator module.

The translator module switch maintains test compatibility with no changes to expectations.

packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/legacy-tests-syntax.test.js (1)

1-1: LGTM: Translator import updated consistently.

The switch to pm-to-bru-translator maintains backward compatibility with existing test expectations.

packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/transformers/send-request.test.js (1)

1-1: Import path is valid and tests follow all coding guidelines.

The import correctly references pm-to-bru-translator from the expected location. The test file uses consistent 2-space indentation, proper semicolons, single quotes, and well-structured test cases covering raw body modes, urlencoded, formdata, headers, response handling, async/await patterns, and requestConfig variables.

packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/request.test.js (1)

1-1: Import refactored to pm-to-bru-translator module.

The import path is correctly updated and the translator module exists at the expected location. Test cases for request property translations (url, method, headers, body) are intact.

packages/bruno-converters/src/postman/postman-translations.js (1)

1-1: LGTM: Translator module rename improves clarity.

The import update to pm-to-bru-translator makes the module's purpose explicit. The integration at line 100 maintains the same API contract with proper fallback handling.

packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/testing-framework.test.js (1)

1-1: LGTM: Consistent translator module update.

The import change aligns with the broader refactoring. Test expectations remain unchanged, confirming API compatibility.

packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/legacy-global-apis.test.js (1)

1-1: LGTM: Translator module update maintains legacy API support.

The import change is consistent with the refactoring. Since this test suite validates critical legacy API translation with conflict detection, unchanged expectations confirm the new module preserves this functionality.

packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/postman-references.test.js (1)

1-1: LGTM: Final piece of consistent translator refactoring.

The import update completes the module rename across all translation test files. Test expectations remain unchanged, confirming the new pm-to-bru-translator maintains full API compatibility with the previous implementation.

packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/environment.test.js (1)

1-1: LGTM: Clean refactoring to more descriptive translator module.

The import update from jscode-shift-translator to pm-to-bru-translator better reflects the module's purpose and maintains API compatibility. The new module exports translateCode as default, the old module has been removed, and no orphaned references remain.

packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/variable-chaining.test.js (1)

1-1: LGTM! Translator module switch is correct.

The import path change from jscode-shift-translator to pm-to-bru-translator aligns with the PR's introduction of the new translation utilities. The unchanged test logic confirms API compatibility.

packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/combined.test.js (1)

1-1: LGTM! Consistent translator switch.

The migration to pm-to-bru-translator follows the same pattern as other test files in this PR. The comprehensive test suite (493 lines) provides strong validation that the translator API remains compatible.

packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/variables.test.js (1)

1-1: LGTM! Import update is consistent.

The translator module switch follows the established pattern across the test suite. Unchanged assertions confirm the new translator maintains API compatibility.

packages/bruno-converters/tests/postman/postman-translations/postman-cookie-conversions.spec.js (1)

1-1: LGTM! ES module migration looks good.

The conversion from CommonJS to ES module import is clean and consistent with the migration pattern applied across the test suite.

packages/bruno-converters/tests/postman/postman-translations/postman-variables.spec.js (1)

1-1: LGTM! Clean migration to ES module import.

The CommonJS-to-ES-module conversion is syntactically correct. The postman-translations module properly exports a default export, ensuring the import will function as expected.

packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/scoped-variables.test.js (2)

1-1: LGTM - Import updated to new translator.

The import path correctly reflects the migration to pm-to-bru-translator.


4-26: Verify why tests are skipped.

Both scoped variable tests are marked with it.skip. Ensure these tests are either completed or tracked for future implementation before merging.

Do these tests pass when .skip is removed? If not, should this be tracked in a separate issue?

packages/bruno-converters/src/postman/bruno-to-postman.js (3)

3-3: LGTM - Translator import added.

The import correctly brings in the new Bruno-to-Postman translator.


187-198: LGTM - Prerequest script translation integrated.

The translation is correctly applied to prerequest scripts with proper fallback behavior.


200-227: LGTM - Response and test script translation integrated.

The translation is correctly applied to both response scripts and test blocks, with proper separation and the translated content split appropriately for the exec array.

packages/bruno-converters/tests/postman/postman-translations/postman-comments.spec.js (1)

1-1: LGTM - Import style updated to ES module.

The change from require with destructuring to ES module import is consistent with the broader migration in the codebase.

packages/bruno-converters/tests/bruno/bru-to-postman-translations/request.test.js (1)

3-79: Excellent test coverage for request translations.

The test suite comprehensively covers:

  • Individual request property translations
  • Combined property usage
  • Conditional flows
  • Logging scenarios

The assertions correctly verify the expected Postman API equivalents.

packages/bruno-converters/src/utils/pm-to-bru-translator.js (1)

4-4: LGTM - Refactored to use shared AST utility.

Good refactoring to eliminate code duplication by importing getMemberExpressionString from the shared ast-utils module.

packages/bruno-converters/tests/bruno/bru-to-postman-translations/variables.test.js (1)

1-82: Comprehensive test coverage for variable translations.

The test suite thoroughly validates Bruno-to-Postman variable operation translations, covering both simple and complex scenarios including conditionals, nested expressions, and mixed environment/variable usage. Test structure is clear and assertions are appropriate.

packages/bruno-converters/tests/bruno/bru-to-postman-translations/environment.test.js (1)

1-112: Excellent coverage of environment variable translations.

The test suite validates both syntactic and semantic translations (e.g., null/undefined checks to .has() pattern), includes edge cases like computed properties and error handling, and properly tests complex nested scenarios. Well-structured and thorough.

packages/bruno-converters/tests/bruno/bru-to-postman-translations/response.test.js (1)

1-177: Thorough response translation test suite.

Excellent coverage of response operations including property access, method calls, assertion transformations, and semantic optimizations (e.g., JSON.stringify optimization at Line 17-21). Complex real-world scenarios with destructuring, optional chaining, and nested conditionals are well-tested.

packages/bruno-converters/src/utils/ast-utils.js (1)

81-93: Good defensive coding with null checks.

Both isIdentifierNamed and isNullLiteral properly guard against null/undefined inputs using the node && pattern, preventing potential TypeErrors.

packages/bruno-converters/tests/bruno/bru-to-postman-translations/testing-framework.test.js (1)

1-232: Outstanding test coverage for testing framework translations.

This test suite is exceptionally thorough, covering basic translations, nested test structures, dynamic test names, conditional execution, logical operators, and complex assertion patterns. The tests validate that Bruno API calls within tests are properly translated (Lines 70-86), and nested test functions are handled correctly (Lines 88-112). Excellent work.

packages/bruno-converters/src/utils/bru-to-pm-translator.js (6)

148-182: Well-structured transformation logic.

The two-phase approach (complex CallExpressions first, then simple MemberExpressions) correctly prevents conflicts. The changeTracker pattern and in-place modification handling are sound.


248-256: Argument comparison uses source string matching.

This approach is pragmatic and sufficient for detecting duplicate bru.getEnvVar calls with identical arguments. It won't catch semantically equivalent but syntactically different expressions (e.g., 1 + 1 vs 2), but this is acceptable for the intended use case.


266-293: Pattern matching assumes specific ordering.

Lines 275-278 expect the pattern bru.getEnvVar(...) !== undefined && bru.getEnvVar(...) !== null in that exact order. If the conditions are reversed, the pattern won't match. This is acceptable if the pm-to-bru translator always generates this ordering.


306-363: Assertion transformation creates new terminal calls.

Lines 341-356 replace the entire expect chain with a new call (e.g., pm.response.to.have.status(X)). Any additional chaining beyond the matched pattern (like .and.someAssertion) would be lost. This is acceptable if the matched patterns are typically terminal assertions.


371-389: LGTM - Standalone test/expect transformation.

The pattern matching correctly identifies standalone test() and expect() calls and transforms them to pm.test() and pm.expect(). Running this last (line 437) ensures it catches calls not handled by more specific transformations.


452-453: LGTM - Standard CommonJS export pattern.

The dual export approach (module.exports and module.exports.default) supports both CommonJS and potential interop scenarios.

Comment on lines 92 to 99
{
pattern: 'res.getSize',
transform: (path) => {
// Just replace the callee, keep the call structure
path.get('callee').replace(buildMemberExpressionFromString('pm.response.size'));
return null; // Signal that we modified in place
}
},
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

Postman API pm.response.size property method documentation

💡 Result:

Short answer — two related APIs:

  • In Postman scripts use the sandbox property pm.response.responseSize (Number) to get the response size in bytes. [1]
  • In the Postman Collection SDK Response object there is a size() method (Response.size()) which returns the response size (computed from Content-Length or body). Use this when working with the SDK. [2]

Example (post-response script):
pm.test("response size is under 1MB", () => {
pm.expect(pm.response.responseSize).to.be.below(1024 * 1024);
}); [1]

Sources: Postman sandbox reference (pm.response docs) [1]; Postman Collection Response.size() method (SDK) [2].


Fix incorrect Postman API translation for res.getSize().

Line 96 incorrectly translates res.getSize() to pm.response.size(). The correct Postman sandbox API is pm.response.responseSize (a property, not a method). Update the pattern to replace the entire call expression with a property access: buildMemberExpressionFromString('pm.response.responseSize') and adjust the transformation to handle the difference between method calls and property access.

🤖 Prompt for AI Agents
In @packages/bruno-converters/src/utils/bru-to-pm-translator.js around lines 92
- 99, The current transformer for pattern 'res.getSize' incorrectly replaces
only the callee and leaves a call expression (res.getSize()) which yields
pm.response.size(); change the transform for that pattern to replace the entire
CallExpression node with a MemberExpression for the Postman property
pm.response.responseSize (use
buildMemberExpressionFromString('pm.response.responseSize') on the path node
itself rather than path.get('callee')), and ensure you return the new node or
null per the transformer convention so the call is removed and replaced by a
property access instead of a method call.

- Converted utility functions in `ast-utils.js` to named exports for better modularity.
- Updated import statements in `bru-to-pm-translator.js` and `pm-to-bru-translator.js` to use ES module syntax.
- Refactored test files to align with the new import structure, enhancing consistency across the codebase.
@sanish-bruno
Copy link
Collaborator Author

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 12, 2026

✅ 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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @packages/bruno-converters/src/utils/bru-to-pm-translator.js:
- Around line 169-173: The comment for the transform handling
"res.getStatusText" is incorrect: it mentions "pm.response.code" while the
transform returns buildMemberExpressionFromString('pm.response.status'); update
the comment near the pattern 'res.getStatusText' to state "pm.response.status"
(or otherwise reflect the actual mapping to pm.response.status) so the comment
matches the transform.
🧹 Nitpick comments (1)
packages/bruno-converters/src/utils/bru-to-pm-translator.js (1)

1-8: Mixed import styles (ESM + CJS).

You're using ESM import for ast-utils but CJS require for jscodeshift and lodash. Consider using consistent import syntax throughout the file for maintainability.

♻️ Suggested refactor for consistent ESM imports
 import {
   getMemberExpressionString,
   buildMemberExpressionFromString,
   isIdentifierNamed,
   isNullLiteral
 } from './ast-utils';
-const j = require('jscodeshift');
-const cloneDeep = require('lodash/cloneDeep');
+import j from 'jscodeshift';
+import cloneDeep from 'lodash/cloneDeep';
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0484cca and fae1cc2.

📒 Files selected for processing (11)
  • packages/bruno-converters/src/utils/ast-utils.js
  • packages/bruno-converters/src/utils/bru-to-pm-translator.js
  • packages/bruno-converters/src/utils/pm-to-bru-translator.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/cookies.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/environment.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/execution.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/request.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/response.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/testing-framework.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/variables.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-with-tests.spec.js
🚧 Files skipped from review as they are similar to previous changes (5)
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/testing-framework.test.js
  • packages/bruno-converters/src/utils/ast-utils.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/request.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/environment.test.js
  • packages/bruno-converters/src/utils/pm-to-bru-translator.js
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (CODING_STANDARDS.md)

**/*.{js,jsx,ts,tsx}: Use 2 spaces for indentation. No tabs, just spaces
Stick to single quotes for strings. For JSX/TSX attributes, use double quotes (e.g., )
Always add semicolons at the end of statements
No trailing commas
Always use parentheses around parameters in arrow functions, even for single params
For multiline constructs, put opening braces on the same line, and ensure consistency. Minimum 2 elements for multiline
No newlines inside function parentheses
Space before and after the arrow in arrow functions. () => {} is good
No space between function name and parentheses. func() not func ()
Semicolons go at the end of the line, not on a new line
Names for functions need to be concise and descriptive
Add in JSDoc comments to add more details to the abstractions if needed
Add in meaningful comments instead of obvious ones where complex code flow is explained properly

Files:

  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/variables.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/cookies.test.js
  • packages/bruno-converters/src/utils/bru-to-pm-translator.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-with-tests.spec.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/execution.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/response.test.js
**/*.test.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (CODING_STANDARDS.md)

Add tests for any new functionality or meaningful changes. If code is added, removed, or significantly modified, corresponding tests should be updated or created

Files:

  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/variables.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/cookies.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/execution.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/response.test.js
🧠 Learnings (3)
📚 Learning: 2025-12-16T07:16:23.647Z
Learnt from: sanish-bruno
Repo: usebruno/bruno PR: 6090
File: tests/scripting/hooks/init-user-data/ui-state-snapshot.json:1-8
Timestamp: 2025-12-16T07:16:23.647Z
Learning: For e2e tests in the bruno repository: Collections that are shared between CLI and UI tests (comprehensive test suites testing core functionality) should be placed in `packages/bruno-tests/` to avoid duplication. The `tests/**/fixtures/collection` pattern should be used for test-specific collections that test particular UI behaviors or are specific to a single test file.

Applied to files:

  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/variables.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/cookies.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-with-tests.spec.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/execution.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/response.test.js
📚 Learning: 2025-12-05T20:31:33.005Z
Learnt from: CR
Repo: usebruno/bruno PR: 0
File: CODING_STANDARDS.md:0-0
Timestamp: 2025-12-05T20:31:33.005Z
Learning: Applies to **/*.test.{js,jsx,ts,tsx} : Add tests for any new functionality or meaningful changes. If code is added, removed, or significantly modified, corresponding tests should be updated or created

Applied to files:

  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/variables.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/cookies.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-with-tests.spec.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/execution.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/response.test.js
📚 Learning: 2025-12-17T21:41:24.730Z
Learnt from: naman-bruno
Repo: usebruno/bruno PR: 6407
File: packages/bruno-app/src/components/Environments/ConfirmCloseEnvironment/index.js:5-41
Timestamp: 2025-12-17T21:41:24.730Z
Learning: Do not suggest PropTypes validation for React components in the Bruno codebase. The project does not use PropTypes, so reviews should avoid proposing PropTypes and rely on the existing typing/validation approach (e.g., TypeScript or alternative runtime checks) if applicable. This guideline applies broadly to all JavaScript/JSX components in the repo.

Applied to files:

  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/variables.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/cookies.test.js
  • packages/bruno-converters/src/utils/bru-to-pm-translator.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-with-tests.spec.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/execution.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/response.test.js
🧬 Code graph analysis (5)
packages/bruno-converters/tests/bruno/bru-to-postman-translations/variables.test.js (1)
packages/bruno-converters/src/postman/postman-translations.js (1)
  • translatedCode (100-100)
packages/bruno-converters/tests/bruno/bru-to-postman-translations/cookies.test.js (1)
packages/bruno-converters/src/postman/postman-translations.js (1)
  • translatedCode (100-100)
packages/bruno-converters/src/utils/bru-to-pm-translator.js (1)
packages/bruno-converters/src/utils/ast-utils.js (6)
  • j (1-1)
  • buildMemberExpressionFromString (65-72)
  • getMemberExpressionString (20-50)
  • i (68-68)
  • isIdentifierNamed (81-83)
  • isNullLiteral (91-93)
packages/bruno-converters/tests/bruno/bru-to-postman-translations/execution.test.js (1)
packages/bruno-converters/src/postman/postman-translations.js (1)
  • translatedCode (100-100)
packages/bruno-converters/tests/bruno/bru-to-postman-translations/response.test.js (1)
packages/bruno-converters/src/postman/postman-translations.js (1)
  • translatedCode (100-100)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Playwright E2E Tests
  • GitHub Check: SSL Tests - Windows
🔇 Additional comments (13)
packages/bruno-converters/tests/bruno/bruno-to-postman-with-tests.spec.js (2)

37-37: Test input data correctly reflects Bruno test syntax.

The input tests fields use Bruno syntax (test(...), expect(res.status), expect(res.body)), which aligns with the translator's expected input format.

Also applies to: 59-59, 96-96, 118-118, 155-155, 174-174


202-213: Expected Postman event script assertions are correct.

The expected output properly reflects the translation from Bruno's test/expect/res.* to Postman's pm.test/pm.expect/pm.response.* patterns. The same pattern is consistent across all test blocks (root, folder, inner folder, collection).

packages/bruno-converters/tests/bruno/bru-to-postman-translations/variables.test.js (1)

1-96: Comprehensive variable translation test coverage.

Tests cover all variable-related translations including regular, global, collection, and request variables, plus complex scenarios with conditionals and nested expressions. The expected translations align with the simpleTranslations mapping in the translator module.

packages/bruno-converters/tests/bruno/bru-to-postman-translations/cookies.test.js (1)

1-147: Thorough cookie translation test coverage.

Tests cover both direct jar call chaining and jar variable usage patterns. The method mappings (getCookie→get, getCookies→getAll, setCookie→set, deleteCookie→unset, deleteCookies→clear) are correctly tested, including complex scenarios with environment variables and conditional logic.

packages/bruno-converters/tests/bruno/bru-to-postman-translations/response.test.js (1)

1-189: Excellent response translation test coverage.

The tests comprehensively cover both simple translations (res.status, res.body, res.getHeader) and complex transformations (function-to-property conversions like res.getStatus→pm.response.code, JSON.stringify(res.getBody())→pm.response.text()). Complex scenarios with destructuring, optional chaining, and conditionals are well tested.

packages/bruno-converters/tests/bruno/bru-to-postman-translations/execution.test.js (1)

1-109: Solid execution control translation test coverage.

Tests properly verify the translation of all execution control methods, including the special case where bru.runner.stopExecution() maps to pm.execution.setNextRequest(null). Conditional scenarios and dynamic request name handling are well covered.

packages/bruno-converters/src/utils/bru-to-pm-translator.js (7)

18-73: Well-organized simple translations mapping.

The simpleTranslations object is logically grouped and documented. Good practice noting which methods are handled in complexTransformations rather than here.


212-246: Transformation order is correct.

Processing complex transformations before simple translations is the right approach—it allows detecting compound patterns (like JSON.stringify(res.getBody())) before their components get individually transformed.


255-291: Cookie jar method transformation handles both patterns correctly.

The function properly tracks variables assigned to cookie jars and transforms methods for both direct bru.cookies.jar().method() calls and jarVar.method() patterns.


330-357: Clever pattern detection for environment variable existence check.

Good use of cloneDeep to avoid AST node reuse issues when creating the replacement. The pattern matching correctly validates both sides of the logical expression.


365-383: Test/expect transformation is safely scoped.

Targeting only Identifier callees ensures already-namespaced calls like pm.test() or pm.expect() won't be double-transformed.


436-440: Error handling logs warning on translation failure.

The fallback to original code is sensible. Consider whether console.warn is appropriate for production or if it should be conditional/removable.


443-443: Default export is consistent with test imports.

The ESM default export matches how the function is imported in all test files.

@sanish-bruno sanish-bruno marked this pull request as ready for review January 12, 2026 13:07
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In @packages/bruno-converters/src/utils/bru-to-pm-translator.js:
- Around line 166-170: The inline comment for the transformer mapping of
'res.getStatusText' is incorrect: it says "res.getStatusText() ->
pm.response.code" but the transform uses
buildMemberExpressionFromString('pm.response.status'); update the comment to
reflect "res.getStatusText() -> pm.response.status" (locate the mapping with
pattern: 'res.getStatusText' and the transform call to
buildMemberExpressionFromString).
- Around line 340-343: The JSDoc for translateBruToPostman declares "@returns
{string}" but the function returns the original code when it's falsy, which can
be null/undefined; fix by ensuring a string is always returned from
translateBruToPostman (e.g., coerce falsy inputs to an empty string or
String(code) before returning) and, if you prefer to allow non-string returns,
update the JSDoc to reflect the actual return type; locate the
translateBruToPostman function and either change the early return to a string
(empty string or String(code)) or adjust the @returns annotation to include
null/undefined.
🧹 Nitpick comments (1)
packages/bruno-converters/src/utils/bru-to-pm-translator.js (1)

1-5: Mixed module systems: ES6 import + CommonJS require.

The file uses ES6 import for ast-utils but CommonJS require for jscodeshift. This works but is inconsistent. Consider unifying to ES6 imports for consistency:

-const j = require('jscodeshift');
+import j from 'jscodeshift';
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fae1cc2 and a459bcd.

📒 Files selected for processing (3)
  • packages/bruno-converters/src/utils/bru-to-pm-translator.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/cookies.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/environment.test.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/environment.test.js
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (CODING_STANDARDS.md)

**/*.{js,jsx,ts,tsx}: Use 2 spaces for indentation. No tabs, just spaces
Stick to single quotes for strings. For JSX/TSX attributes, use double quotes (e.g., )
Always add semicolons at the end of statements
No trailing commas
Always use parentheses around parameters in arrow functions, even for single params
For multiline constructs, put opening braces on the same line, and ensure consistency. Minimum 2 elements for multiline
No newlines inside function parentheses
Space before and after the arrow in arrow functions. () => {} is good
No space between function name and parentheses. func() not func ()
Semicolons go at the end of the line, not on a new line
Names for functions need to be concise and descriptive
Add in JSDoc comments to add more details to the abstractions if needed
Add in meaningful comments instead of obvious ones where complex code flow is explained properly

Files:

  • packages/bruno-converters/src/utils/bru-to-pm-translator.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/cookies.test.js
**/*.test.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (CODING_STANDARDS.md)

Add tests for any new functionality or meaningful changes. If code is added, removed, or significantly modified, corresponding tests should be updated or created

Files:

  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/cookies.test.js
🧠 Learnings (4)
📚 Learning: 2025-12-05T20:31:33.005Z
Learnt from: CR
Repo: usebruno/bruno PR: 0
File: CODING_STANDARDS.md:0-0
Timestamp: 2025-12-05T20:31:33.005Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : Add in meaningful comments instead of obvious ones where complex code flow is explained properly

Applied to files:

  • packages/bruno-converters/src/utils/bru-to-pm-translator.js
📚 Learning: 2025-12-17T21:41:24.730Z
Learnt from: naman-bruno
Repo: usebruno/bruno PR: 6407
File: packages/bruno-app/src/components/Environments/ConfirmCloseEnvironment/index.js:5-41
Timestamp: 2025-12-17T21:41:24.730Z
Learning: Do not suggest PropTypes validation for React components in the Bruno codebase. The project does not use PropTypes, so reviews should avoid proposing PropTypes and rely on the existing typing/validation approach (e.g., TypeScript or alternative runtime checks) if applicable. This guideline applies broadly to all JavaScript/JSX components in the repo.

Applied to files:

  • packages/bruno-converters/src/utils/bru-to-pm-translator.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/cookies.test.js
📚 Learning: 2025-12-16T07:16:23.647Z
Learnt from: sanish-bruno
Repo: usebruno/bruno PR: 6090
File: tests/scripting/hooks/init-user-data/ui-state-snapshot.json:1-8
Timestamp: 2025-12-16T07:16:23.647Z
Learning: For e2e tests in the bruno repository: Collections that are shared between CLI and UI tests (comprehensive test suites testing core functionality) should be placed in `packages/bruno-tests/` to avoid duplication. The `tests/**/fixtures/collection` pattern should be used for test-specific collections that test particular UI behaviors or are specific to a single test file.

Applied to files:

  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/cookies.test.js
📚 Learning: 2025-12-05T20:31:33.005Z
Learnt from: CR
Repo: usebruno/bruno PR: 0
File: CODING_STANDARDS.md:0-0
Timestamp: 2025-12-05T20:31:33.005Z
Learning: Applies to **/*.test.{js,jsx,ts,tsx} : Add tests for any new functionality or meaningful changes. If code is added, removed, or significantly modified, corresponding tests should be updated or created

Applied to files:

  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/cookies.test.js
🧬 Code graph analysis (2)
packages/bruno-converters/src/utils/bru-to-pm-translator.js (2)
packages/bruno-converters/src/utils/ast-utils.js (4)
  • j (1-1)
  • buildMemberExpressionFromString (65-72)
  • getMemberExpressionString (20-50)
  • calleeStr (26-26)
packages/bruno-converters/src/utils/pm-to-bru-translator.js (3)
  • j (3-3)
  • simpleTranslations (7-80)
  • ast (304-304)
packages/bruno-converters/tests/bruno/bru-to-postman-translations/cookies.test.js (1)
packages/bruno-converters/src/postman/postman-translations.js (1)
  • translatedCode (100-100)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: SSL Tests - macOS
  • GitHub Check: SSL Tests - Windows
  • GitHub Check: CLI Tests
  • GitHub Check: SSL Tests - Linux
  • GitHub Check: Playwright E2E Tests
  • GitHub Check: Unit Tests
🔇 Additional comments (8)
packages/bruno-converters/tests/bruno/bru-to-postman-translations/cookies.test.js (1)

1-147: LGTM! Comprehensive test coverage for cookie translation scenarios.

The test suite thoroughly covers:

  • Basic jar translation (bru.cookies.jarpm.cookies.jar)
  • Direct chaining method translations (getCookie→get, getCookies→getAll, etc.)
  • Jar variable scenarios
  • Complex multi-operation workflows including env var access and conditionals

Test structure is clean, follows Jest conventions, and assertions are appropriate for validating the translator behavior.

packages/bruno-converters/src/utils/bru-to-pm-translator.js (7)

15-70: Solid translation mappings with appropriate documentation.

The simple translations are well-documented with comments explaining what's handled elsewhere and noting limitations. The mappings align with Postman's scripting API patterns.


189-199: Well-documented cookie method mappings.

Clear and accurate mappings with helpful comments explaining the parameter signatures.


212-246: Clean two-pass transformation logic.

The order (complex transforms first, then simple) prevents simpler patterns from interfering with more complex ones. The hasOwnProperty check is appropriately defensive.


255-291: Robust cookie jar method transformation.

Good approach: tracking jar variables and handling both pre- and post-translation patterns (bru.cookies.jar and pm.cookies.jar). Direct property mutation is efficient for this use case.


299-317: Correct targeting of standalone test/expect calls.

The filter ensures only bare test() and expect() identifiers are transformed, not already-namespaced calls like pm.test or expect.fail (handled separately).


364-368: Graceful error handling.

Returning the original code on parsing failures ensures the converter doesn't break on edge cases. The console.warn provides visibility without crashing.


371-371: Clean default export.

Single ES6 default export is appropriate for the module's public API.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In @packages/bruno-converters/src/utils/bru-to-pm-translator.js:
- Around line 50-52: The mapping is asymmetric: in bru-to-pm translator both
'bru.setNextRequest' and 'bru.runner.setNextRequest' map to
'pm.execution.setNextRequest', but the inverse (pm-to-bru translator) maps
'pm.execution.setNextRequest' back to 'bru.runner.setNextRequest' while
'pm.setNextRequest' maps to 'bru.setNextRequest', causing a round-trip change
from 'bru.setNextRequest' to 'bru.runner.setNextRequest'. Fix by aligning the
inverse mapping in the pm-to-bru translator so that
'pm.execution.setNextRequest' maps back to the original 'bru.setNextRequest' (or
preserve the original variant via metadata) or, if 'pm.setNextRequest' is
deprecated, add a clarifying comment and intentionally map
'pm.execution.setNextRequest' to 'bru.runner.setNextRequest' with that
justification.
🧹 Nitpick comments (2)
packages/bruno-converters/src/utils/bru-to-pm-translator.js (2)

1-5: Mixed module systems detected.

ES module import is used for ast-utils, while CommonJS require is used for jscodeshift. This is likely intentional for jscodeshift compatibility, but worth noting for consistency. If the project supports ES modules throughout, consider aligning.


86-185: Complex transformations are well-structured.

The pattern-based approach with optional conditions is clean. Order-dependent processing is documented. One minor nit: several transform functions receive a path parameter that's unused—consider prefixing with _ to signal intent.

🔧 Suggested fix for unused parameters
   // bru.getEnvName() -> pm.environment.name (function to property)
   {
     pattern: 'bru.getEnvName',
-    transform: () => {
+    transform: (_path) => {
       // Replace the entire call expression with just the member expression (property access)
       return buildMemberExpressionFromString('pm.environment.name');
     }
   },

Alternatively, if linting doesn't require it, the current form is acceptable.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a459bcd and b55045f.

📒 Files selected for processing (2)
  • packages/bruno-converters/src/utils/bru-to-pm-translator.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/variables.test.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/variables.test.js
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (CODING_STANDARDS.md)

**/*.{js,jsx,ts,tsx}: Use 2 spaces for indentation. No tabs, just spaces
Stick to single quotes for strings. For JSX/TSX attributes, use double quotes (e.g., )
Always add semicolons at the end of statements
No trailing commas
Always use parentheses around parameters in arrow functions, even for single params
For multiline constructs, put opening braces on the same line, and ensure consistency. Minimum 2 elements for multiline
No newlines inside function parentheses
Space before and after the arrow in arrow functions. () => {} is good
No space between function name and parentheses. func() not func ()
Semicolons go at the end of the line, not on a new line
Names for functions need to be concise and descriptive
Add in JSDoc comments to add more details to the abstractions if needed
Add in meaningful comments instead of obvious ones where complex code flow is explained properly

Files:

  • packages/bruno-converters/src/utils/bru-to-pm-translator.js
🧠 Learnings (2)
📚 Learning: 2025-12-05T20:31:33.005Z
Learnt from: CR
Repo: usebruno/bruno PR: 0
File: CODING_STANDARDS.md:0-0
Timestamp: 2025-12-05T20:31:33.005Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : Add in meaningful comments instead of obvious ones where complex code flow is explained properly

Applied to files:

  • packages/bruno-converters/src/utils/bru-to-pm-translator.js
📚 Learning: 2025-12-17T21:41:24.730Z
Learnt from: naman-bruno
Repo: usebruno/bruno PR: 6407
File: packages/bruno-app/src/components/Environments/ConfirmCloseEnvironment/index.js:5-41
Timestamp: 2025-12-17T21:41:24.730Z
Learning: Do not suggest PropTypes validation for React components in the Bruno codebase. The project does not use PropTypes, so reviews should avoid proposing PropTypes and rely on the existing typing/validation approach (e.g., TypeScript or alternative runtime checks) if applicable. This guideline applies broadly to all JavaScript/JSX components in the repo.

Applied to files:

  • packages/bruno-converters/src/utils/bru-to-pm-translator.js
🧬 Code graph analysis (1)
packages/bruno-converters/src/utils/bru-to-pm-translator.js (3)
packages/bruno-converters/src/utils/ast-utils.js (4)
  • j (1-1)
  • buildMemberExpressionFromString (65-72)
  • getMemberExpressionString (20-50)
  • calleeStr (26-26)
packages/bruno-converters/src/utils/pm-to-bru-translator.js (10)
  • j (3-3)
  • simpleTranslations (7-80)
  • complexTransformations (89-240)
  • args (102-102)
  • args (139-139)
  • args (166-166)
  • args (203-203)
  • args (221-221)
  • cookieMethodMapping (596-602)
  • ast (304-304)
packages/bruno-converters/tests/utils/getMemberExpressionString.test.js (3)
  • j (3-3)
  • require (1-1)
  • require (2-2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: SSL Tests - Windows
  • GitHub Check: Unit Tests
  • GitHub Check: SSL Tests - macOS
  • GitHub Check: SSL Tests - Linux
  • GitHub Check: Playwright E2E Tests
  • GitHub Check: CLI Tests
🔇 Additional comments (5)
packages/bruno-converters/src/utils/bru-to-pm-translator.js (5)

15-74: Simple translations mapping looks correct.

The 1:1 mappings are well-documented and align with the inverse translator's structure. The comments explaining omissions (e.g., Postman lacking deleteAllVars) are helpful.


187-191: Map creation for O(1) lookups is a good optimization.


215-244: Processing order is correct: complex before simple.

Complex transformations may replace entire call expressions, so handling them first prevents simple translations from partially matching and corrupting the AST. The use of Object.prototype.hasOwnProperty.call is a good defensive practice.


252-287: Cookie jar tracking and method remapping looks solid.

Tracking variables assigned to bru.cookies.jar() or pm.cookies.jar() and then remapping method calls handles both direct and indirect usage patterns correctly.


333-350: Main export handles edge cases appropriately.

Input validation for falsy/non-string values returns ''. The try-catch returns original code on failure—a safe fallback. The JSDoc examples are helpful.

One consideration: console.warn on line 347 may be noisy in production. If a logger is available, consider using it; otherwise, this is acceptable for a utility module.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In
@packages/bruno-converters/tests/bruno/bruno-to-postman-translations/execution.test.js:
- Line 1: The import in the test uses the wrong module name; update the import
of translateBruToPostman in execution.test.js to pull from
'bruno-to-postman-translator' (matching other tests) instead of
'bru-to-pm-translator' so the translateBruToPostman symbol resolves correctly
and the test can run.

In
@packages/bruno-converters/tests/bruno/bruno-to-postman-translations/send-request.test.js:
- Around line 584-612: The test fails because the translator drops the async
modifier when converting an async arrow callback to a regular function, leaving
an `await` inside a non-async function; update the translator (the logic in
translateBruToPostman that converts bru.sendRequest callbacks to pm.sendRequest
callbacks) to preserve `async`: if the original callback is `async` or its body
contains `await`, emit `async function(error, response) { ... }` instead of
`function(error, response) { ... }` so the generated pm.sendRequest callback
remains valid JavaScript.
🧹 Nitpick comments (1)
packages/bruno-converters/src/postman/bruno-to-postman.js (1)

171-178: Redundant try-catch, but harmless.

The translateBruToPostman function already has internal try-catch that returns the original code on error. This wrapper adds another layer but doesn't hurt - just adds a slightly different warning message. Could simplify by removing the wrapper and using translateBruToPostman directly, but current approach is defensive and works.

♻️ Optional simplification
-  const translateScriptSafely = (script = '') => {
-    try {
-      return translateBruToPostman(script);
-    } catch (err) {
-      console.warn('Bru→Postman script translation failed, leaving script as-is', err);
-      return script;
-    }
-  };
+  // translateBruToPostman already handles errors internally and returns original code on failure
+  const translateScriptSafely = translateBruToPostman;
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b55045f and 682f820.

📒 Files selected for processing (11)
  • packages/bruno-converters/src/postman/bruno-to-postman.js
  • packages/bruno-converters/src/utils/bruno-to-postman-translator.js
  • packages/bruno-converters/src/utils/postman-to-bruno-translator.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/cookies.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/environment.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/execution.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/request.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/response.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/send-request.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/testing-framework.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/variables.test.js
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (CODING_STANDARDS.md)

**/*.{js,jsx,ts,tsx}: Use 2 spaces for indentation. No tabs, just spaces
Stick to single quotes for strings. For JSX/TSX attributes, use double quotes (e.g., )
Always add semicolons at the end of statements
No trailing commas
Always use parentheses around parameters in arrow functions, even for single params
For multiline constructs, put opening braces on the same line, and ensure consistency. Minimum 2 elements for multiline
No newlines inside function parentheses
Space before and after the arrow in arrow functions. () => {} is good
No space between function name and parentheses. func() not func ()
Semicolons go at the end of the line, not on a new line
Names for functions need to be concise and descriptive
Add in JSDoc comments to add more details to the abstractions if needed
Add in meaningful comments instead of obvious ones where complex code flow is explained properly

Files:

  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/testing-framework.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/request.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/cookies.test.js
  • packages/bruno-converters/src/utils/postman-to-bruno-translator.js
  • packages/bruno-converters/src/utils/bruno-to-postman-translator.js
  • packages/bruno-converters/src/postman/bruno-to-postman.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/response.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/send-request.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/environment.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/variables.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/execution.test.js
**/*.test.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (CODING_STANDARDS.md)

Add tests for any new functionality or meaningful changes. If code is added, removed, or significantly modified, corresponding tests should be updated or created

Files:

  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/testing-framework.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/request.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/cookies.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/response.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/send-request.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/environment.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/variables.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/execution.test.js
🧠 Learnings (7)
📓 Common learnings
Learnt from: sanish-bruno
Repo: usebruno/bruno PR: 6761
File: packages/bruno-converters/src/utils/bru-to-pm-translator.js:50-52
Timestamp: 2026-01-12T17:42:17.662Z
Learning: In the Bruno converters package (packages/bruno-converters), when translating Bruno execution control APIs to Postman: both `bru.setNextRequest` and `bru.runner.setNextRequest` should map to `pm.execution.setNextRequest` because `pm.setNextRequest` is deprecated in Postman's API. The asymmetric round-trip behavior is intentional.
Learnt from: sanish-bruno
Repo: usebruno/bruno PR: 6761
File: packages/bruno-converters/src/utils/bru-to-pm-translator.js:294-310
Timestamp: 2026-01-12T17:43:53.540Z
Learning: In the Bruno converters package (packages/bruno-converters), specifically in the bru-to-pm translator: transforming bare `test()` and `expect()` calls to `pm.test()` and `pm.expect()` is acceptable even if it could cause false positives in rare cases where user scripts define their own unrelated `test` or `expect` functions. The common case outweighs the edge case.
📚 Learning: 2026-01-12T17:43:53.540Z
Learnt from: sanish-bruno
Repo: usebruno/bruno PR: 6761
File: packages/bruno-converters/src/utils/bru-to-pm-translator.js:294-310
Timestamp: 2026-01-12T17:43:53.540Z
Learning: In the Bruno converters package (packages/bruno-converters), specifically in the bru-to-pm translator: transforming bare `test()` and `expect()` calls to `pm.test()` and `pm.expect()` is acceptable even if it could cause false positives in rare cases where user scripts define their own unrelated `test` or `expect` functions. The common case outweighs the edge case.

Applied to files:

  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/testing-framework.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/request.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/cookies.test.js
  • packages/bruno-converters/src/utils/postman-to-bruno-translator.js
  • packages/bruno-converters/src/utils/bruno-to-postman-translator.js
  • packages/bruno-converters/src/postman/bruno-to-postman.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/response.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/send-request.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/environment.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/variables.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/execution.test.js
📚 Learning: 2026-01-12T17:42:17.662Z
Learnt from: sanish-bruno
Repo: usebruno/bruno PR: 6761
File: packages/bruno-converters/src/utils/bru-to-pm-translator.js:50-52
Timestamp: 2026-01-12T17:42:17.662Z
Learning: In the Bruno converters package (packages/bruno-converters), when translating Bruno execution control APIs to Postman: both `bru.setNextRequest` and `bru.runner.setNextRequest` should map to `pm.execution.setNextRequest` because `pm.setNextRequest` is deprecated in Postman's API. The asymmetric round-trip behavior is intentional.

Applied to files:

  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/testing-framework.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/request.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/cookies.test.js
  • packages/bruno-converters/src/utils/postman-to-bruno-translator.js
  • packages/bruno-converters/src/utils/bruno-to-postman-translator.js
  • packages/bruno-converters/src/postman/bruno-to-postman.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/response.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/send-request.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/environment.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/variables.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/execution.test.js
📚 Learning: 2025-12-16T07:16:23.647Z
Learnt from: sanish-bruno
Repo: usebruno/bruno PR: 6090
File: tests/scripting/hooks/init-user-data/ui-state-snapshot.json:1-8
Timestamp: 2025-12-16T07:16:23.647Z
Learning: For e2e tests in the bruno repository: Collections that are shared between CLI and UI tests (comprehensive test suites testing core functionality) should be placed in `packages/bruno-tests/` to avoid duplication. The `tests/**/fixtures/collection` pattern should be used for test-specific collections that test particular UI behaviors or are specific to a single test file.

Applied to files:

  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/testing-framework.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/request.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/cookies.test.js
  • packages/bruno-converters/src/utils/bruno-to-postman-translator.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/response.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/send-request.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/environment.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/variables.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/execution.test.js
📚 Learning: 2025-12-05T20:31:33.005Z
Learnt from: CR
Repo: usebruno/bruno PR: 0
File: CODING_STANDARDS.md:0-0
Timestamp: 2025-12-05T20:31:33.005Z
Learning: Applies to **/*.test.{js,jsx,ts,tsx} : Add tests for any new functionality or meaningful changes. If code is added, removed, or significantly modified, corresponding tests should be updated or created

Applied to files:

  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/testing-framework.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/request.test.js
  • packages/bruno-converters/src/utils/bruno-to-postman-translator.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/response.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/send-request.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/environment.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/execution.test.js
📚 Learning: 2025-12-05T20:31:33.005Z
Learnt from: CR
Repo: usebruno/bruno PR: 0
File: CODING_STANDARDS.md:0-0
Timestamp: 2025-12-05T20:31:33.005Z
Learning: Use consistent patterns and helper utilities where they improve clarity. Prefer shared test utilities over copy-pasted setup code, but only when it actually reduces complexity

Applied to files:

  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/testing-framework.test.js
📚 Learning: 2025-12-17T21:41:24.730Z
Learnt from: naman-bruno
Repo: usebruno/bruno PR: 6407
File: packages/bruno-app/src/components/Environments/ConfirmCloseEnvironment/index.js:5-41
Timestamp: 2025-12-17T21:41:24.730Z
Learning: Do not suggest PropTypes validation for React components in the Bruno codebase. The project does not use PropTypes, so reviews should avoid proposing PropTypes and rely on the existing typing/validation approach (e.g., TypeScript or alternative runtime checks) if applicable. This guideline applies broadly to all JavaScript/JSX components in the repo.

Applied to files:

  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/testing-framework.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/request.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/cookies.test.js
  • packages/bruno-converters/src/utils/postman-to-bruno-translator.js
  • packages/bruno-converters/src/utils/bruno-to-postman-translator.js
  • packages/bruno-converters/src/postman/bruno-to-postman.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/response.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/send-request.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/environment.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/variables.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/execution.test.js
🧬 Code graph analysis (9)
packages/bruno-converters/tests/bruno/bruno-to-postman-translations/testing-framework.test.js (1)
packages/bruno-converters/src/postman/postman-translations.js (1)
  • translatedCode (100-100)
packages/bruno-converters/tests/bruno/bruno-to-postman-translations/request.test.js (1)
packages/bruno-converters/src/postman/postman-translations.js (1)
  • translatedCode (100-100)
packages/bruno-converters/tests/bruno/bruno-to-postman-translations/cookies.test.js (1)
packages/bruno-converters/src/postman/postman-translations.js (1)
  • translatedCode (100-100)
packages/bruno-converters/src/utils/bruno-to-postman-translator.js (2)
packages/bruno-converters/src/utils/postman-to-bruno-translator.js (3)
  • j (3-3)
  • cookieMethodMapping (596-602)
  • ast (304-304)
packages/bruno-converters/src/utils/ast-utils.js (2)
  • buildMemberExpressionFromString (65-72)
  • getMemberExpressionString (20-50)
packages/bruno-converters/tests/bruno/bruno-to-postman-translations/response.test.js (1)
packages/bruno-converters/src/postman/postman-translations.js (1)
  • translatedCode (100-100)
packages/bruno-converters/tests/bruno/bruno-to-postman-translations/send-request.test.js (1)
packages/bruno-converters/src/postman/postman-translations.js (1)
  • translatedCode (100-100)
packages/bruno-converters/tests/bruno/bruno-to-postman-translations/environment.test.js (1)
packages/bruno-converters/src/postman/postman-translations.js (1)
  • translatedCode (100-100)
packages/bruno-converters/tests/bruno/bruno-to-postman-translations/variables.test.js (1)
packages/bruno-converters/src/postman/postman-translations.js (1)
  • translatedCode (100-100)
packages/bruno-converters/tests/bruno/bruno-to-postman-translations/execution.test.js (1)
packages/bruno-converters/src/postman/postman-translations.js (1)
  • translatedCode (100-100)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: SSL Tests - macOS
  • GitHub Check: Playwright E2E Tests
  • GitHub Check: SSL Tests - Windows
🔇 Additional comments (31)
packages/bruno-converters/src/utils/postman-to-bruno-translator.js (1)

1-4: LGTM! Clean refactor to centralize AST utilities.

The import from ./ast-utils and the re-export on line 846 maintain backward compatibility while consolidating shared logic. This aligns well with the new bruno-to-postman-translator.js that also imports from the same utility module.

packages/bruno-converters/src/utils/bruno-to-postman-translator.js (7)

1-5: LGTM! Clean imports and setup.

Proper ES module import syntax for ast-utils and CommonJS require for jscodeshift. Consistent with coding guidelines.


15-74: LGTM! Well-documented translation mappings.

The simple translations cover the full Bruno API surface with helpful inline comments explaining Postman limitations. The execution control mappings correctly use pm.execution.setNextRequest as per the intended asymmetric round-trip behavior.


98-106: In-place modification pattern is unusual but functional.

The res.getSize transformation modifies the AST node directly and returns null to signal that no replacement is needed. This is correctly handled by the null check on line 229. Just ensure this pattern is documented if others add similar transformations.


215-244: LGTM! Correct transformation order.

Processing CallExpression nodes before MemberExpression nodes ensures complex patterns (like JSON.stringify(res.getBody())) are handled before their inner member expressions get transformed. The Object.prototype.hasOwnProperty.call usage is a safe pattern for property lookup.


252-287: LGTM! Robust cookie jar handling.

Correctly tracks jar variables and transforms both direct chaining (bru.cookies.jar().getCookie(...)) and variable-based (jar.getCookie(...)) patterns. The method mapping is the inverse of the PM->Bruno translator.


294-310: LGTM! Test/expect transformation is intentional.

Per retrieved learnings, transforming bare test() and expect() to pm.test() and pm.expect() is the accepted approach, even if it could theoretically collide with user-defined functions of the same name.


333-350: LGTM! Solid error handling with safe fallback.

The try-catch ensures translation failures don't break the export flow, and returning the original code is the correct fallback behavior. The console.warn provides debugging visibility without disrupting the user experience.

packages/bruno-converters/src/postman/bruno-to-postman.js (1)

187-213: LGTM! Clean integration of translation into export flow.

Translation is correctly applied at each script integration point:

  • Prerequest scripts (line 188)
  • Response scripts (line 203)
  • Tests scripts (line 207)

The pattern of translating first, then splitting by newline for the Postman exec array format is correct.

packages/bruno-converters/tests/bruno/bruno-to-postman-translations/cookies.test.js (1)

1-147: LGTM! Comprehensive cookie translation test coverage.

Tests cover:

  • Basic jar creation
  • All 5 cookie methods (get, getAll, set, unset, clear) with both direct chaining and variable patterns
  • Complex scenarios with conditionals, environment variables, and combined operations

This validates the transformCookieJarMethods function in the translator thoroughly.

packages/bruno-converters/tests/bruno/bruno-to-postman-translations/variables.test.js (1)

1-103: LGTM! Solid variable translation test coverage.

Tests verify all variable-related translations:

  • Runtime variables (get/set/has/delete)
  • Global environment variables
  • Collection/folder/request variables (all map to pm.variables.get)
  • Interpolation with simple and complex templates
  • Combined scenarios with conditionals and nested expressions
packages/bruno-converters/tests/bruno/bruno-to-postman-translations/request.test.js (1)

1-91: LGTM! Good request translation test coverage.

Tests validate:

  • All function-to-property conversions (req.getUrl() → pm.request.url, etc.)
  • Header access and mutation methods
  • Combined usage in conditionals and logging scenarios
packages/bruno-converters/tests/bruno/bruno-to-postman-translations/execution.test.js (1)

3-109: Test cases are well-designed (once import is fixed).

The tests correctly verify:

  • Both bru.setNextRequest and bru.runner.setNextRequest map to pm.execution.setNextRequest (per retrieved learnings about intentional asymmetric round-trip)
  • bru.runner.stopExecution()pm.execution.setNextRequest(null)
  • Conditional and combined control flow scenarios
packages/bruno-converters/tests/bruno/bruno-to-postman-translations/testing-framework.test.js (4)

1-9: LGTM!

Import and initial test cases are well-structured. The basic test()pm.test() translation test correctly validates the combined transformation of test, expect, and res.getStatus()pm.response.code.


38-49: LGTM!

Arrow function test correctly validates that the translator preserves arrow syntax while transforming testpm.test and nested Bruno APIs. Good use of .toContain() for flexible multi-line matching.


114-129: LGTM!

Good coverage of dynamic test names using template literals. This validates that the translator correctly handles bru.getVar()pm.variables.get() within template literal contexts and preserves the interpolated test name.


177-203: LGTM!

Solid coverage of array and object assertion patterns including .lengthOf.at.least(), .have.property(), .have.all.keys(), and .include(). Comments within the test code are correctly preserved, validating that the translator doesn't strip them.

packages/bruno-converters/tests/bruno/bruno-to-postman-translations/environment.test.js (3)

1-32: LGTM!

Covers all core environment variable API translations. The function-to-property mapping for bru.getEnvName()pm.environment.name is correctly validated.


34-50: LGTM!

Good coverage of nested API calls and JSON operations. The test at line 35-37 correctly validates that bru.getVar("base") inside bru.setEnvVar() translates to pm.variables.get("base") within pm.environment.set().


78-94: LGTM!

Excellent coverage of environment variables within complex object structures including nested properties, string concatenation, and fallback expressions (|| "default-key"). This validates real-world usage patterns.

packages/bruno-converters/tests/bruno/bruno-to-postman-translations/response.test.js (4)

1-57: LGTM!

Thorough coverage of all response property translations including function-to-property mappings (res.getStatus()pm.response.code, res.getResponseTime()pm.response.responseTime) and the special JSON.stringify(res.getBody())pm.response.text() pattern.


59-76: LGTM!

Response assertion translations correctly combine expect()pm.expect() with the response API mappings. Good coverage of status, headers, and body assertions.


78-101: LGTM!

Complete coverage of res.getSize() translations including the .body, .header, and .total property access patterns.


117-126: LGTM!

Good coverage of optional chaining (?.) and nullish coalescing (??, ||) patterns with pm.response.json(). This validates modern JavaScript syntax preservation during translation.

packages/bruno-converters/tests/bruno/bruno-to-postman-translations/send-request.test.js (7)

38-44: Verify the blank line in expected output.

There's a blank line between mode: "raw", and raw: JSON.stringify(...) (line 40). This appears intentional based on the pattern repeating across tests, but verify this matches the actual translator output. If it's an artifact, the tests will fail.


145-234: LGTM!

URL-encoded body mode tests correctly validate the transformation of data objects to urlencoded arrays with {key, value} structure, and the fallback to raw mode when Content-Type is missing or incorrect.


301-343: LGTM!

Multi-part form data tests follow the same robust pattern as URL-encoded tests, validating Content-Type-based mode detection and proper transformation to formdata arrays.


507-541: LGTM!

Response handling test correctly validates the callback response property mappings: response.statusresponse.code, response.statusTextresponse.status, and response.dataresponse.json().


662-697: LGTM!

Good coverage of multi-level variable reference tracing. The translator correctly identifies the original object definition through the chain requestConfigrequestConfig1requestConfig2 and applies transformations to the source.


724-733: LGTM!

Simple URL string argument test validates the minimal pm.sendRequest('url') pattern without options object.


771-799: LGTM!

Complex conditional logic in callback test correctly validates combined translations of response.statusresponse.code, response.dataresponse.json(), and response.statusTextresponse.status within if/else branches.

Comment on lines 584 to 612
it('should handle async arrow function callbacks', () => {
const code = `
bru.sendRequest({
url: 'https://echo.usebruno.com',
method: 'GET'
}, async (error, response) => {
await new Promise(resolve => {
setTimeout(() => {
resolve();
}, 1000)
});
console.log(response.data);
});
`;
const translatedCode = translateBruToPostman(code);
expect(translatedCode).toBe(`
pm.sendRequest({
url: 'https://echo.usebruno.com',
method: 'GET'
}, function(error, response) {
await new Promise(resolve => {
setTimeout(() => {
resolve();
}, 1000)
});
console.log(response.json());
});
`);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

Postman pm.sendRequest callback async await support documentation

💡 Result:

Short answer

  • pm.sendRequest historically used a callback and did not return a native Promise; the official docs describe it as asynchronous with a callback. [1][2]
  • You can wrap pm.sendRequest in a Promise yourself (or use the callback) to use async/await patterns. Many community examples show promisifying pm.sendRequest. [2][3]
  • Postman has added support for top-level await in sandbox scripts, so await pm.sendRequest(...) works at top level in recent Postman versions; inside functions you still need async/await rules (await only valid in async functions). If you place awaits inside pm.test or non-async functions, you’ll see "await is only valid in async functions" unless using top-level await. [4][5]

Useful links

  1. Postman docs — pm.sendRequest (official description, callback-based). [1]
  2. Postman Blog / examples about asynchronous pm.sendRequest usage. [4]
  3. Community examples showing how to wrap pm.sendRequest in Promises and use async/await. [2][3]
  4. Recent community threads confirming top-level await support for pm.sendRequest. [5]

If you want, I can paste a small promisified wrapper + example showing await pm.sendRequest(...) in a Pre-request or Tests script.


🏁 Script executed:

# Find and inspect the translator implementation to see how it handles arrow functions and async
fd "bru-to-pm-translator" --type f -x cat -n {} \; | head -100

Repository: usebruno/bruno

Length of output: 40


🏁 Script executed:

# Look for async handling patterns in the translator
rg "async\s*\(" packages/bruno-converters/src/utils/bru-to-pm-translator.js -A 5 -B 2

Repository: usebruno/bruno

Length of output: 157


🏁 Script executed:

# Check if there are other async function tests in the test files
rg "async\s*\(" packages/bruno-converters/tests/ -l

Repository: usebruno/bruno

Length of output: 1173


🏁 Script executed:

git ls-files | grep "bru-to-pm-translator"

Repository: usebruno/bruno

Length of output: 40


🏁 Script executed:

# Also check the test file structure
head -50 packages/bruno-converters/tests/bruno/bruno-to-postman-translations/send-request.test.js

Repository: usebruno/bruno

Length of output: 1707


🏁 Script executed:

# Search for how arrow functions are converted in the translator
rg "ArrowFunctionExpression\|async.*function\|FunctionExpression" packages/bruno-converters/ -t js --type-add "js:!node_modules" -B 2 -A 3

Repository: usebruno/bruno

Length of output: 40


🏁 Script executed:

# Look for any other async tests in send-request.test.js
rg "async\s+\(" packages/bruno-converters/tests/bruno/bruno-to-postman-translations/send-request.test.js -B 3 -A 10

Repository: usebruno/bruno

Length of output: 500


🏁 Script executed:

# Try to find the translator with different approach
fd "bruno-to-postman-translator" packages/bruno-converters/src/

Repository: usebruno/bruno

Length of output: 124


🏁 Script executed:

# Also look for where the translateBruToPostman function is defined
rg "export.*translateBruToPostman\|function translateBruToPostman" packages/bruno-converters/src/ -t js

Repository: usebruno/bruno

Length of output: 40


🏁 Script executed:

# Check the actual structure of the src directory
find packages/bruno-converters/src -type f -name "*.js" | head -20

Repository: usebruno/bruno

Length of output: 1142


🏁 Script executed:

# Inspect the bruno-to-postman-translator.js to see how it converts arrow functions and async
wc -l packages/bruno-converters/src/utils/bruno-to-postman-translator.js

Repository: usebruno/bruno

Length of output: 128


🏁 Script executed:

# Get the first part to understand the structure
head -100 packages/bruno-converters/src/utils/bruno-to-postman-translator.js

Repository: usebruno/bruno

Length of output: 3531


🏁 Script executed:

# Search for arrow function handling and async function logic
rg "ArrowFunctionExpression\|async|arrow|Arrow" packages/bruno-converters/src/utils/bruno-to-postman-translator.js -B 3 -A 5

Repository: usebruno/bruno

Length of output: 40


🏁 Script executed:

# Search for where callbacks or function expressions are transformed
rg "function\|FunctionExpression\|callback" packages/bruno-converters/src/utils/bruno-to-postman-translator.js -B 2 -A 5 | head -80

Repository: usebruno/bruno

Length of output: 40


🏁 Script executed:

# Look at the entire file to understand the structure - read middle section
sed -n '100,200p' packages/bruno-converters/src/utils/bruno-to-postman-translator.js

Repository: usebruno/bruno

Length of output: 3528


🏁 Script executed:

# Search for sendRequest handling specifically
rg "sendRequest" packages/bruno-converters/src/utils/bruno-to-postman-translator.js -B 5 -A 10

Repository: usebruno/bruno

Length of output: 40


🏁 Script executed:

# Search for where callbacks or arrow functions specifically are handled
rg "callback\|Callback\|params\|arguments" packages/bruno-converters/src/utils/bruno-to-postman-translator.js -B 2 -A 5 | head -100

Repository: usebruno/bruno

Length of output: 40


🏁 Script executed:

# Let me read the end of the file to see if there's a main export or processing function
tail -150 packages/bruno-converters/src/utils/bruno-to-postman-translator.js

Repository: usebruno/bruno

Length of output: 4989


🏁 Script executed:

# Check the send-request-transformer.js file since it might handle the callback transformation
cat packages/bruno-converters/src/utils/send-request-transformer.js

Repository: usebruno/bruno

Length of output: 11353


🏁 Script executed:

# Search for how the translator handles arrow functions or callbacks in sendRequest
rg "sendRequest\|callback\|CallExpression" packages/bruno-converters/src/utils/bruno-to-postman-translator.js -B 3 -A 10

Repository: usebruno/bruno

Length of output: 40


🏁 Script executed:

# Let me check if jscodeshift is transforming arrow functions automatically
# by looking at the imports and how the code is processed
head -20 packages/bruno-converters/src/utils/bruno-to-postman-translator.js && tail -20 packages/bruno-converters/src/utils/bruno-to-postman-translator.js

Repository: usebruno/bruno

Length of output: 1074


🏁 Script executed:

# Check if there's any arrow function handling in the test file itself or setup
rg "async.*=>|ArrowFunction" packages/bruno-converters/tests/bruno/bruno-to-postman-translations/send-request.test.js -B 5 -A 10

Repository: usebruno/bruno

Length of output: 657


🏁 Script executed:

# Let's look for jscodeshift documentation or any arrow function transformation logic
# Check if there's any use of replaceWith or similar for arrow functions
rg "arrow\|Arrow\|=>.*function" packages/bruno-converters/src/utils/ -i

Repository: usebruno/bruno

Length of output: 40


🏁 Script executed:

# Let's look at the actual test more carefully to understand the full context
sed -n '550,620p' packages/bruno-converters/tests/bruno/bruno-to-postman-translations/send-request.test.js

Repository: usebruno/bruno

Length of output: 2131


🏁 Script executed:

# Check if there's a transformation from arrow to function in bru-to-pm-translator
rg "FunctionExpression\|ArrowFunctionExpression" packages/bruno-converters/src/utils/bruno-to-postman-translator.js -i

Repository: usebruno/bruno

Length of output: 40


🏁 Script executed:

# Let's search the entire project for any arrow-to-function transformations
rg "ArrowFunctionExpression.*FunctionExpression|arrow.*function" packages/bruno-converters/ -i

Repository: usebruno/bruno

Length of output: 2009


🏁 Script executed:

# Let me check if there's any arrow-to-function conversion happening in the bruno-to-postman.js file
cat packages/bruno-converters/src/postman/bruno-to-postman.js | head -100

Repository: usebruno/bruno

Length of output: 3449


🏁 Script executed:

# Let's check if jscodeshift itself is converting the arrow function
# by looking at how the translator is imported and used in the test
grep -B 10 "translateBruToPostman" packages/bruno-converters/tests/bruno/bruno-to-postman-translations/send-request.test.js | head -30

Repository: usebruno/bruno

Length of output: 1022


🏁 Script executed:

# Let me look for any explicit arrow function handling in the translator or related files
find packages/bruno-converters/src -name "*.js" -type f -exec grep -l "async\|await\|arrow" {} \;

Repository: usebruno/bruno

Length of output: 298


🏁 Script executed:

# Check if there's something in the processor that converts arrow functions
rg "ArrowFunctionExpression" packages/bruno-converters/src/ -B 5 -A 5

Repository: usebruno/bruno

Length of output: 2444


🏁 Script executed:

# The key issue: look for where bru.sendRequest is being transformed in bruno-to-postman-translator
rg "bru\.sendRequest\|sendRequest" packages/bruno-converters/src/utils/bruno-to-postman-translator.js -B 3 -A 10

Repository: usebruno/bruno

Length of output: 40


🏁 Script executed:

# Let's check if there's a separate module for sendRequest handling
rg "sendRequest" packages/bruno-converters/src/postman/bruno-to-postman.js -B 5 -A 10

Repository: usebruno/bruno

Length of output: 40


🏁 Script executed:

# Check what the actual bruno-to-postman-translator does with pm.sendRequest transformation
rg "pm\.sendRequest" packages/bruno-converters/src/utils/bruno-to-postman-translator.js -B 5 -A 10

Repository: usebruno/bruno

Length of output: 40


🏁 Script executed:

# Let me check the full bruno-to-postman-translator to see if there's something I missed
cat packages/bruno-converters/src/utils/bruno-to-postman-translator.js

Repository: usebruno/bruno

Length of output: 12048


🏁 Script executed:

# Let's check if sendRequest transformation is done as part of the postman translations
rg "sendRequest" packages/bruno-converters/src/postman/ -B 3 -A 8

Repository: usebruno/bruno

Length of output: 40


🏁 Script executed:

# Check the postman-translations file to see if bru.sendRequest is handled there
cat packages/bruno-converters/src/postman/postman-translations.js | head -200

Repository: usebruno/bruno

Length of output: 5209


🏁 Script executed:

# Also check if there's any complex transformation for sendRequest elsewhere
rg "bru\.sendRequest\|pm\.sendRequest" packages/bruno-converters/src/ -r

Repository: usebruno/bruno

Length of output: 471


🏁 Script executed:

# Look at the bruno-to-postman.js to see if it uses the translator
grep -A 30 "translateBruToPostman" packages/bruno-converters/src/postman/bruno-to-postman.js | head -50

Repository: usebruno/bruno

Length of output: 1908


🏁 Script executed:

# Let me check if jscodeshift has any special handling for arrow functions or if there's a transformation I'm missing
rg "\.toSource\|arrow\|ArrowFunction" packages/bruno-converters/src/utils/ --type js -i | head -30

Repository: usebruno/bruno

Length of output: 40


🏁 Script executed:

# Let me also check if there's an npm package or configuration that handles arrow-to-function conversion
cat packages/bruno-converters/package.json | grep -A 5 -B 5 "jscodeshift\|babel"

Repository: usebruno/bruno

Length of output: 872


🏁 Script executed:

# Let me check if jscodeshift automatically converts arrow functions when using toSource()
# First, let me create a simple test
python3 << 'EOF'
# Check jscodeshift documentation behavior
# The issue might be that jscodeshift's toSource() has a config that converts arrow functions
print("Checking if this is a known jscodeshift behavior...")
print("When jscodeshift parses ArrowFunctionExpression and converts to FunctionExpression,")
print("the async keyword from the arrow function may not be automatically transferred.")
EOF

Repository: usebruno/bruno

Length of output: 144


🏁 Script executed:

# Let me look at what the test is EXPECTING - does it expect the broken output?
sed -n '584,612p' packages/bruno-converters/tests/bruno/bruno-to-postman-translations/send-request.test.js

Repository: usebruno/bruno

Length of output: 942


Async keyword dropped but await preserved — generates invalid JavaScript.

The async arrow function callback is converted to a regular function, but the await expression inside is preserved. This creates a syntax error: await is only valid inside async functions (standard JavaScript rule).

Postman's pm.sendRequest callback must follow standard JavaScript semantics — if the callback body uses await, the function must be declared async. Either preserve async function or remove/transform the await statements.

🤖 Prompt for AI Agents
In
@packages/bruno-converters/tests/bruno/bruno-to-postman-translations/send-request.test.js
around lines 584 - 612, The test fails because the translator drops the async
modifier when converting an async arrow callback to a regular function, leaving
an `await` inside a non-async function; update the translator (the logic in
translateBruToPostman that converts bru.sendRequest callbacks to pm.sendRequest
callbacks) to preserve `async`: if the original callback is `async` or its body
contains `await`, emit `async function(error, response) { ... }` instead of
`function(error, response) { ... }` so the generated pm.sendRequest callback
remains valid JavaScript.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/bruno-converters/src/postman/postman-translations.js (1)

84-94: Global regex test() can skip matches on repeated calls.

The compiled regexes use the 'g' flag and persist at module level. Calling regex.test(code) advances lastIndex, so if processRegexReplacement is invoked multiple times, subsequent calls may miss matches at the start of the string because lastIndex wasn't reset.

🐛 Proposed fix: reset lastIndex or remove the test() guard

Option 1: Reset lastIndex before testing:

 const processRegexReplacement = (code) => {
   for (const { regex, replacement } of compiledReplacements) {
+    regex.lastIndex = 0;
     if (regex.test(code)) {
+      regex.lastIndex = 0;
       code = code.replace(regex, replacement);
     }
   }

Option 2: Drop the test() check entirely (replace is a no-op if no match):

 const processRegexReplacement = (code) => {
   for (const { regex, replacement } of compiledReplacements) {
-    if (regex.test(code)) {
-      code = code.replace(regex, replacement);
-    }
+    code = code.replace(regex, replacement);
   }
🧹 Nitpick comments (2)
packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/legacy-global-apis.test.js (1)

192-209: Skipped test detected — consider tracking this edge case.

The test.skip indicates the function parameter shadowing scenario isn't handled yet. If this is a known limitation, consider adding a brief inline comment explaining why, or create a follow-up issue to track it.

Would you like me to open an issue to track this edge case for function parameter shadowing with legacy API names?

packages/bruno-converters/src/postman/postman-translations.js (1)

105-114: Shadowed exception variable.

The inner catch (e) at line 110 shadows the outer e from line 105, making it harder to distinguish errors during debugging.

✏️ Suggested fix
   } catch (e) {
     console.warn('Error in postman translation:', e);

     try {
       return processRegexReplacement(modifiedScript);
-    } catch (e) {
-      console.warn('Error in postman translation:', e);
+    } catch (regexError) {
+      console.warn('Error in regex fallback translation:', regexError);
       return modifiedScript;
     }
   }
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 682f820 and eb15399.

📒 Files selected for processing (15)
  • packages/bruno-converters/src/postman/postman-translations.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/combined.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/environment.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/exec-flow.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/legacy-global-apis.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/legacy-tests-syntax.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/multiline-syntax.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/postman-references.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/request.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/response.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/scoped-variables.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/testing-framework.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/transformers/send-request.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/variable-chaining.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/variables.test.js
✅ Files skipped from review due to trivial changes (1)
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/environment.test.js
🚧 Files skipped from review as they are similar to previous changes (11)
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/exec-flow.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/request.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/variable-chaining.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/legacy-tests-syntax.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/combined.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/scoped-variables.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/transformers/send-request.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
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/variables.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/postman-references.test.js
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (CODING_STANDARDS.md)

**/*.{js,jsx,ts,tsx}: Use 2 spaces for indentation. No tabs, just spaces
Stick to single quotes for strings. For JSX/TSX attributes, use double quotes (e.g., )
Always add semicolons at the end of statements
No trailing commas
Always use parentheses around parameters in arrow functions, even for single params
For multiline constructs, put opening braces on the same line, and ensure consistency. Minimum 2 elements for multiline
No newlines inside function parentheses
Space before and after the arrow in arrow functions. () => {} is good
No space between function name and parentheses. func() not func ()
Semicolons go at the end of the line, not on a new line
Names for functions need to be concise and descriptive
Add in JSDoc comments to add more details to the abstractions if needed
Add in meaningful comments instead of obvious ones where complex code flow is explained properly

Files:

  • packages/bruno-converters/src/postman/postman-translations.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/legacy-global-apis.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/testing-framework.test.js
**/*.test.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (CODING_STANDARDS.md)

Add tests for any new functionality or meaningful changes. If code is added, removed, or significantly modified, corresponding tests should be updated or created

Files:

  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/legacy-global-apis.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/testing-framework.test.js
🧠 Learnings (6)
📓 Common learnings
Learnt from: sanish-bruno
Repo: usebruno/bruno PR: 6761
File: packages/bruno-converters/src/utils/bru-to-pm-translator.js:50-52
Timestamp: 2026-01-12T17:42:17.662Z
Learning: In the Bruno converters package (packages/bruno-converters), when translating Bruno execution control APIs to Postman: both `bru.setNextRequest` and `bru.runner.setNextRequest` should map to `pm.execution.setNextRequest` because `pm.setNextRequest` is deprecated in Postman's API. The asymmetric round-trip behavior is intentional.
Learnt from: sanish-bruno
Repo: usebruno/bruno PR: 6761
File: packages/bruno-converters/src/utils/bru-to-pm-translator.js:294-310
Timestamp: 2026-01-12T17:43:53.540Z
Learning: In the Bruno converters package (packages/bruno-converters), specifically in the bru-to-pm translator: transforming bare `test()` and `expect()` calls to `pm.test()` and `pm.expect()` is acceptable even if it could cause false positives in rare cases where user scripts define their own unrelated `test` or `expect` functions. The common case outweighs the edge case.
📚 Learning: 2026-01-12T17:42:17.662Z
Learnt from: sanish-bruno
Repo: usebruno/bruno PR: 6761
File: packages/bruno-converters/src/utils/bru-to-pm-translator.js:50-52
Timestamp: 2026-01-12T17:42:17.662Z
Learning: In the Bruno converters package (packages/bruno-converters), when translating Bruno execution control APIs to Postman: both `bru.setNextRequest` and `bru.runner.setNextRequest` should map to `pm.execution.setNextRequest` because `pm.setNextRequest` is deprecated in Postman's API. The asymmetric round-trip behavior is intentional.

Applied to files:

  • packages/bruno-converters/src/postman/postman-translations.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/legacy-global-apis.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/testing-framework.test.js
📚 Learning: 2026-01-12T17:43:53.540Z
Learnt from: sanish-bruno
Repo: usebruno/bruno PR: 6761
File: packages/bruno-converters/src/utils/bru-to-pm-translator.js:294-310
Timestamp: 2026-01-12T17:43:53.540Z
Learning: In the Bruno converters package (packages/bruno-converters), specifically in the bru-to-pm translator: transforming bare `test()` and `expect()` calls to `pm.test()` and `pm.expect()` is acceptable even if it could cause false positives in rare cases where user scripts define their own unrelated `test` or `expect` functions. The common case outweighs the edge case.

Applied to files:

  • packages/bruno-converters/src/postman/postman-translations.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/legacy-global-apis.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/testing-framework.test.js
📚 Learning: 2025-12-17T21:41:24.730Z
Learnt from: naman-bruno
Repo: usebruno/bruno PR: 6407
File: packages/bruno-app/src/components/Environments/ConfirmCloseEnvironment/index.js:5-41
Timestamp: 2025-12-17T21:41:24.730Z
Learning: Do not suggest PropTypes validation for React components in the Bruno codebase. The project does not use PropTypes, so reviews should avoid proposing PropTypes and rely on the existing typing/validation approach (e.g., TypeScript or alternative runtime checks) if applicable. This guideline applies broadly to all JavaScript/JSX components in the repo.

Applied to files:

  • packages/bruno-converters/src/postman/postman-translations.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/legacy-global-apis.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/testing-framework.test.js
📚 Learning: 2025-12-16T07:16:23.647Z
Learnt from: sanish-bruno
Repo: usebruno/bruno PR: 6090
File: tests/scripting/hooks/init-user-data/ui-state-snapshot.json:1-8
Timestamp: 2025-12-16T07:16:23.647Z
Learning: For e2e tests in the bruno repository: Collections that are shared between CLI and UI tests (comprehensive test suites testing core functionality) should be placed in `packages/bruno-tests/` to avoid duplication. The `tests/**/fixtures/collection` pattern should be used for test-specific collections that test particular UI behaviors or are specific to a single test file.

Applied to files:

  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/testing-framework.test.js
📚 Learning: 2025-12-05T20:31:33.005Z
Learnt from: CR
Repo: usebruno/bruno PR: 0
File: CODING_STANDARDS.md:0-0
Timestamp: 2025-12-05T20:31:33.005Z
Learning: Applies to **/*.test.{js,jsx,ts,tsx} : Add tests for any new functionality or meaningful changes. If code is added, removed, or significantly modified, corresponding tests should be updated or created

Applied to files:

  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/testing-framework.test.js
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Playwright E2E Tests
  • GitHub Check: CLI Tests
  • GitHub Check: Unit Tests
  • GitHub Check: SSL Tests - macOS
  • GitHub Check: SSL Tests - Windows
  • GitHub Check: SSL Tests - Linux
🔇 Additional comments (3)
packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/testing-framework.test.js (1)

1-1: LGTM!

Import path correctly updated to the new postman-to-bruno-translator module. The comprehensive test coverage for pm.test, pm.expect, aliases, nested tests, and various assertion patterns is solid.

packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/legacy-global-apis.test.js (1)

1-1: LGTM!

Import path correctly updated to the new postman-to-bruno-translator module.

packages/bruno-converters/src/postman/postman-translations.js (1)

1-1: LGTM on the import update.

The import path change to use postman-to-bruno-translator aligns with the new translator module structure introduced in this PR.

@bijin-bruno bijin-bruno merged commit 36d10ab into usebruno:main Jan 13, 2026
8 checks passed
FraCata00 pushed a commit to FraCata00/bruno that referenced this pull request Feb 9, 2026
… format (usebruno#6761)

* feat: implement translation utilities for converting Bruno scripts to Postman format

- Added `bru-to-pm-translator` for translating Bruno API calls to Postman equivalents.
- Introduced `pm-to-bru-translator` for reverse translations from Postman to Bruno.
- Created utility functions in `ast-utils` for efficient AST manipulations.
- Enhanced `bruno-to-postman.js` to utilize the new translation functions for script handling.
- Updated tests to cover various translation scenarios, ensuring accuracy and reliability.

* empry commint

* refactor: migrate utility functions to ES module syntax

- Converted utility functions in `ast-utils.js` to named exports for better modularity.
- Updated import statements in `bru-to-pm-translator.js` and `pm-to-bru-translator.js` to use ES module syntax.
- Refactored test files to align with the new import structure, enhancing consistency across the codebase.

* fix: translations

* fix: add info regarding cookie apis

* simplify translations removing legacy inverse translation

* fix: add translation for getFolderVAr

* refactor: simplify transformation functions by removing change tracker

* fix: renamed files and folders

* fix: import statements

* rm : file

* simplify getSize translation
@coderabbitai coderabbitai bot mentioned this pull request Feb 10, 2026
6 tasks
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.

2 participants