Skip to content

Feature: send request translation - #6792

Merged
bijin-bruno merged 19 commits into
usebruno:mainfrom
sanish-bruno:feat/send-req-translation
Jan 21, 2026
Merged

bijin-bruno merged 19 commits into
usebruno:mainfrom
sanish-bruno:feat/send-req-translation

Conversation

@sanish-bruno

@sanish-bruno sanish-bruno commented Jan 13, 2026 •

Copy link
Copy Markdown
Collaborator

PR: Add bru.sendRequest to pm.sendRequest Transformer

Merge this after PR #6761

Summary

This PR introduces a new AST transformer (bru-send-request-transformer.js) that converts Bruno's bru.sendRequest() API calls to Postman's pm.sendRequest() format. This enables seamless export of Bruno collections containing send request scripts to Postman format.

Motivation

When exporting Bruno collections to Postman, scripts containing bru.sendRequest() calls need to be translated to the equivalent pm.sendRequest() syntax. While both APIs serve the same purpose (making HTTP requests within scripts), they have different:

  • Property naming conventions (headers vs header)
  • Body structure formats (flat data vs nested body with mode)
  • Response property access patterns (response.data vs response.json())

This transformer bridges these differences automatically.

Changes

New File

  • packages/bruno-converters/src/utils/bru-send-request-transformer.js

Key Transformations

1. Request Options

Bruno Property Postman Property
headers: {} header: {}
data: value body: { mode: 'raw', raw: value }

2. Body Mode Detection (based on Content-Type)

Content-Type Body Mode
application/json, text/plain, or unspecified raw
application/x-www-form-urlencoded urlencoded (converts object to [{key, value}] array)
multipart/form-data formdata (converts object to [{key, value}] array)

3. Callback Response Properties

Bruno Postman
response.data response.json()
response.status response.code
response.statusText response.status

Example Transformation

Before (Bruno):

bru.sendRequest({
    url: 'https://api.example.com/data',
    method: 'POST',
    headers: {
        'Content-Type': 'application/json'
    },
    data: JSON.stringify({ key: 'value' })
}, function(error, response) {
    if (response.status === 200) {
        const body = response.data;
        console.log(body);
    }
});

After (Postman):

pm.sendRequest({
    url: 'https://api.example.com/data',
    method: 'POST',
    header: {
        'Content-Type': 'application/json'
    },
    body: {
        mode: 'raw',
        raw: JSON.stringify({ key: 'value' })
    }
}, function(error, response) {
    if (response.code === 200) {
        const body = response.json();
        console.log(body);
    }
});

Implementation Details

The transformer uses jscodeshift for AST manipulation and includes:

  1. convertObjectToArray() - Converts Bruno's object format { key: value } to Postman's array format [{ key: 'key', value: value }] for form data bodies

  2. getContentType() - Extracts Content-Type from headers to determine appropriate body mode

  3. transformHeaders() - Renames headers property to header

  4. transformBody() - Converts data to Postman's body structure with appropriate mode

  5. transformCallback() - Processes callback functions to update response property access patterns

  6. findAndTransformVariableDeclaration() - Handles cases where request config is stored in a variable (including multi-level variable references with circular reference protection)

  7. bruSendRequestTransformer() - Main transformer function that orchestrates all transformations

Edge Cases Handled

  • ✅ Request config passed as inline object
  • ✅ Request config passed as variable reference
  • ✅ Multi-level variable references (e.g., config1 = config, config2 = config1)
  • ✅ Circular reference protection
  • ✅ Arrow function callbacks (converted to regular functions for Postman compatibility)
  • ✅ Async arrow function callbacks
  • ✅ Requests without callbacks
  • ✅ Simple string URL arguments
  • ✅ Nested contexts (try-catch blocks, conditionals)

Testing

Comprehensive test coverage added in:

  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/send-request.test.js

Tests cover:

  • Raw body mode (JSON, text, objects)
  • URL-encoded body mode
  • Multi-part form data body mode
  • Headers handling
  • Response property transformations
  • Callback handling (regular functions, arrow functions, async)
  • Variable reference scenarios
  • Edge cases (no callback, simple URL, try-catch blocks)

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

  • New Features

    • Bruno→Postman translation applied across pre-request, response, and test scripts; improved handling for cookies, variables, requests/responses, execution control, and sendRequest flows.
    • Shared AST-backed translation utilities added to improve accuracy and consistency.
  • Bug Fixes

    • Translation failures now log a warning and safely fall back to the original script to preserve behavior.
  • Tests

    • Extensive new and updated test suites validating variable, cookie, request/response, execution, sendRequest, and test-assertion translations.

✏️ 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.
- 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.
@coderabbitai

coderabbitai Bot commented Jan 13, 2026 •

Copy link
Copy Markdown
Contributor

Walkthrough

Adds a Bruno→Postman translator and send-request transformer, new AST helpers, integrates a safe per-script translation wrapper into the Postman conversion pipeline, swaps translator imports in tests, and adds many Bruno→Postman unit tests.

Changes

Cohort / File(s) Summary
Converter integration
packages/bruno-converters/src/postman/bruno-to-postman.js, packages/bruno-converters/src/postman/postman-translations.js
Introduce translateScriptSafely to run Bruno→Postman translation per script block with fallback on error; switch translator import to the new Bruno→Postman translator module.
Bruno→Postman translator
packages/bruno-converters/src/utils/bruno-to-postman-translator.js
New default-export translateBruToPostman(code) implementing simple and complex member-expression mappings, cookie-jar handling, test/expect rewrites, and an overall AST-based transformation pipeline.
Send-request transformer
packages/bruno-converters/src/utils/bruno-send-request-transformer.js
New AST transformer converting bru.sendRequest to pm.sendRequest, handling headers/body modes, Content-Type inference, callbacks, and identifier/object request configs.
AST helpers
packages/bruno-converters/src/utils/ast-utils.js
New utilities: getMemberExpressionString, buildMemberExpressionFromString, isIdentifierNamed, isNullLiteral.
Postman→Bruno translator refactor
packages/bruno-converters/src/utils/postman-to-bruno-translator.js
Replace in-file getMemberExpressionString with import from ast-utils.
Tests — Bruno→Postman
packages/bruno-converters/tests/bruno/bruno-to-postman-translations/*, packages/bruno-converters/tests/bruno/bruno-to-postman-with-tests.spec.js
Large set of new tests validating variables, env, request, response, cookies, execution, send-request, and testing-framework translations; update test assertions to Postman pm.* style.
Tests — Postman translator imports
packages/bruno-converters/tests/postman/postman-translations/*, packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/*, packages/bruno-converters/tests/utils/getMemberExpressionString.test.js
Normalize import styles (ES modules/CommonJS swaps) and switch translator test imports to postman-to-bruno-translator or ast-utils.
Metadata
manifest_file, package.json
Minor manifest/package metadata edits.

Sequence Diagram(s)

sequenceDiagram
    participant Converter as Postman Converter
    participant ScriptBlock as Script Block
    participant SafeWrap as translateScriptSafely
    participant Translator as translateBruToPostman
    participant Logger as Console/Logger

    Converter->>ScriptBlock: iterate script blocks
    ScriptBlock->>SafeWrap: request translation(code)
    SafeWrap->>Translator: translateBruToPostman(code)
    alt translation succeeds
        Translator-->>SafeWrap: translatedCode
        SafeWrap-->>Converter: translatedCode
    else translation fails
        Translator-->>SafeWrap: throws/error
        SafeWrap->>Logger: console.warn(...)
        SafeWrap-->>Converter: originalCode (fallback)
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • fix:match to full string #6272: Modifies the same packages/bruno-converters/src/postman/bruno-to-postman.js area and overlaps script translation/variable extraction changes.

Suggested reviewers

  • lohit-bruno
  • bijin-bruno
  • naman-bruno
  • helloanoop

Poem

🐇 Bruno whispers through AST stream,
pm replies in a tidy dream,
Safe-wrap guards each fragile line,
Tests bloom bright in transformation time,
Converters hum — translations gleam ✨

🚥 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 The title 'Feature: send request translation' accurately reflects the main change—adding translation support for bru.sendRequest() to pm.sendRequest(), though it is somewhat generic and doesn't convey specifics.
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.

✨ Finishing touches
  • 📝 Generate docstrings

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Fix all issues with AI agents
In @packages/bruno-converters/src/utils/bru-send-request-transformer.js:
- Around line 129-196: The transformed callback loses the async modifier; update
transformCallback so the produced FunctionExpression preserves callback.async —
when creating the function via j.functionExpression (the return at the end of
transformCallback) set the async flag to callback.async (or set the resulting
node.async = true when callback.async is true) so async arrow functions remain
async regular functions while keeping the same params (errorVarName,
responseVarName) and bodyStatements.
- Around line 8-25: In convertObjectToArray, guard against SpreadElement and
computed property keys: skip any prop where prop.type === 'SpreadElement' (do
not try to access prop.key), and compute keyValue defensively—if prop.key is
present and prop.key.type === 'Literal' use prop.key.value, else if
prop.key.name use prop.key.name, else for computed/other expressions generate a
string representation (e.g., using the AST printer/generator on prop.key) or
fall back to null/placeholder; update the arr.elements push logic to use that
safe keyValue.

In
@packages/bruno-converters/tests/bruno/bru-to-postman-translations/send-request.test.js:
- Around line 584-612: The transformer is dropping the async flag when
converting async arrow callbacks to a regular functionExpression, causing await
to be invalid; update the bru-send-request-transformer (the code path that
handles the callback arrow function, e.g., where you create a functionExpression
for the callback) to copy the arrow function's async property onto the new
functionExpression (ensure node.async = true when the original arrow had async),
and preserve any generator/params/body so await inside the transformed function
remains valid.

In
@packages/bruno-converters/tests/bruno/bru-to-postman-translations/variables.test.js:
- Around line 54-73: The test for bru.getCollectionVar is asserting the wrong
Postman API: update the expectation in variables.test.js to expect
pm.collectionVariables.get("baseUrl") instead of pm.variables.get("baseUrl");
also review the translateBruToPostman implementation for the mapping of
getCollectionVar to ensure it emits pm.collectionVariables.get(...). For
getFolderVar and getRequestVar, confirm whether translateBruToPostman should
keep using pm.variables.get(...) as a fallback or map to a different scoped API,
and update the tests and translateBruToPostman mapping for getFolderVar and
getRequestVar (or leave them as pm.variables.get) to reflect the chosen
behavior.
🧹 Nitpick comments (6)
packages/bruno-converters/src/utils/bru-send-request-transformer.js (1)

1-1: Mixed module syntax: CommonJS require with ES module export.

Line 1 uses require() while line 302 uses export default. Consider using ES module import for consistency:

-const j = require('jscodeshift');
+import j from 'jscodeshift';
packages/bruno-converters/tests/utils/getMemberExpressionString.test.js (1)

1-2: Consider using ES module imports for consistency.

Other test files in this PR use ES module syntax (import ... from ...), while this file uses CommonJS require. Aligning the import style would improve consistency across the test suite.

♻️ Suggested change
-const { describe, it, expect } = require('@jest/globals');
-const { getMemberExpressionString } = require('../../src/utils/ast-utils');
+import { getMemberExpressionString } from '../../src/utils/ast-utils';

Note: Jest globals (describe, it, expect) are typically available globally and don't need explicit imports in most Jest configurations.

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

84-94: Potential regex state issue with global flag.

Using regex.test() followed by regex.replace() on the same global regex can cause unexpected behavior due to lastIndex state. After test() finds a match, lastIndex advances, so the subsequent replace() may skip early matches.

Consider removing the test() guard or resetting lastIndex:

♻️ Suggested fix
 const processRegexReplacement = (code) => {
   for (const { regex, replacement } of compiledReplacements) {
-    if (regex.test(code)) {
-      code = code.replace(regex, replacement);
-    }
+    code = code.replace(regex, replacement);
   }
   if ((code.includes('pm.') || code.includes('postman.'))) {
     code = code.replace(/^(.*(pm\.|postman\.).*)$/gm, '// $1');
   }
   return code;
 };

100-103: Consider extracting duplicate commenting logic.

Lines 101-103 and 90-92 contain identical logic for commenting out remaining pm./postman. references. Consider extracting to a helper for DRY compliance.

♻️ Optional refactor
+const commentOutRemainingPmReferences = (code) => {
+  if (code.includes('pm.') || code.includes('postman.')) {
+    return code.replace(/^(.*(pm\.|postman\.).*)$/gm, '// $1');
+  }
+  return code;
+};
+
 const processRegexReplacement = (code) => {
   for (const { regex, replacement } of compiledReplacements) {
     code = code.replace(regex, replacement);
   }
-  if ((code.includes('pm.') || code.includes('postman.'))) {
-    code = code.replace(/^(.*(pm\.|postman\.).*)$/gm, '// $1');
-  }
-  return code;
+  return commentOutRemainingPmReferences(code);
 };

 const postmanTranslation = (script, options = {}) => {
   let modifiedScript = Array.isArray(script) ? script.join('\n') : script;

   try {
     let translatedCode = translateCode(modifiedScript);
-    if ((translatedCode.includes('pm.') || translatedCode.includes('postman.'))) {
-      translatedCode = translatedCode.replace(/^(.*(pm\.|postman\.).*)$/gm, '// $1');
-    }
-    return translatedCode;
+    return commentOutRemainingPmReferences(translatedCode);
   } catch (e) {

96-96: Unused options parameter.

The options parameter is declared but never used in the function body.

♻️ Remove or document for future use
-const postmanTranslation = (script, options = {}) => {
+const postmanTranslation = (script) => {

Or add a JSDoc comment if it's reserved for future expansion.

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

65-72: Consider edge case handling for empty or malformed paths.

buildMemberExpressionFromString('') would create an identifier with empty string name. While unlikely in practice given controlled usage, a guard could prevent subtle bugs.

♻️ Optional defensive check
 export function buildMemberExpressionFromString(str) {
+  if (!str || typeof str !== 'string') {
+    throw new Error('buildMemberExpressionFromString requires a non-empty string');
+  }
   const parts = str.split('.');
   let expr = j.identifier(parts[0]);
📜 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 ebc105d and 559cc0d.

📒 Files selected for processing (35)
  • 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-send-request-transformer.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/send-request.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/tests/postman/postman-translations/postman-cookie-conversions.spec.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/legacy-tests-syntax.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/variable-chaining.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/testing-framework.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/combined.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/send-request.test.js
  • packages/bruno-converters/src/utils/ast-utils.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/response.test.js
  • packages/bruno-converters/src/postman/postman-translations.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/environment.test.js
  • packages/bruno-converters/src/postman/bruno-to-postman.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/scoped-variables.test.js
  • 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-send-request-transformer.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/request.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/environment.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
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/postman-references.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/multiline-syntax.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/testing-framework.test.js
  • packages/bruno-converters/tests/postman/postman-translations/postman-test-commands.spec.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/variables.test.js
  • packages/bruno-converters/tests/utils/getMemberExpressionString.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/tests/postman/postman-translations/transpiler-tests/request.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/legacy-global-apis.test.js
  • packages/bruno-converters/src/utils/pm-to-bru-translator.js
  • packages/bruno-converters/tests/postman/postman-translations/postman-edge-cases.spec.js
  • packages/bruno-converters/tests/postman/postman-translations/postman-variables.spec.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-tests-syntax.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/variable-chaining.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/testing-framework.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/combined.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/send-request.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/response.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/environment.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/scoped-variables.test.js
  • 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/request.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/environment.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
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/postman-references.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/multiline-syntax.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/testing-framework.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/variables.test.js
  • packages/bruno-converters/tests/utils/getMemberExpressionString.test.js
  • 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/legacy-global-apis.test.js
🧠 Learnings (9)
📓 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/postman/postman-translations/postman-cookie-conversions.spec.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/legacy-tests-syntax.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/variable-chaining.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/testing-framework.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/combined.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/send-request.test.js
  • packages/bruno-converters/src/utils/ast-utils.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/response.test.js
  • packages/bruno-converters/src/postman/postman-translations.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/environment.test.js
  • packages/bruno-converters/src/postman/bruno-to-postman.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/scoped-variables.test.js
  • 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-send-request-transformer.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/request.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/environment.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
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/postman-references.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/multiline-syntax.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/testing-framework.test.js
  • packages/bruno-converters/tests/postman/postman-translations/postman-test-commands.spec.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/variables.test.js
  • packages/bruno-converters/tests/utils/getMemberExpressionString.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/tests/postman/postman-translations/transpiler-tests/request.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/legacy-global-apis.test.js
  • packages/bruno-converters/src/utils/pm-to-bru-translator.js
  • packages/bruno-converters/tests/postman/postman-translations/postman-edge-cases.spec.js
  • packages/bruno-converters/tests/postman/postman-translations/postman-variables.spec.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/postman/postman-translations/postman-cookie-conversions.spec.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/legacy-tests-syntax.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/variable-chaining.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/testing-framework.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/combined.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/send-request.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/response.test.js
  • packages/bruno-converters/src/postman/postman-translations.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/environment.test.js
  • packages/bruno-converters/src/postman/bruno-to-postman.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/scoped-variables.test.js
  • 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-send-request-transformer.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/request.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/environment.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
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/postman-references.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/multiline-syntax.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/testing-framework.test.js
  • packages/bruno-converters/tests/postman/postman-translations/postman-test-commands.spec.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/variables.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/tests/postman/postman-translations/transpiler-tests/request.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/legacy-global-apis.test.js
  • packages/bruno-converters/src/utils/pm-to-bru-translator.js
  • packages/bruno-converters/tests/postman/postman-translations/postman-edge-cases.spec.js
  • packages/bruno-converters/tests/postman/postman-translations/postman-variables.spec.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/postman/postman-translations/postman-cookie-conversions.spec.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/legacy-tests-syntax.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/variable-chaining.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/testing-framework.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/combined.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/send-request.test.js
  • packages/bruno-converters/src/utils/ast-utils.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/response.test.js
  • packages/bruno-converters/src/postman/postman-translations.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/environment.test.js
  • packages/bruno-converters/src/postman/bruno-to-postman.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/scoped-variables.test.js
  • 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-send-request-transformer.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/request.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/environment.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
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/postman-references.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/multiline-syntax.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/testing-framework.test.js
  • packages/bruno-converters/tests/postman/postman-translations/postman-test-commands.spec.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/variables.test.js
  • packages/bruno-converters/tests/utils/getMemberExpressionString.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/tests/postman/postman-translations/transpiler-tests/request.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/legacy-global-apis.test.js
  • packages/bruno-converters/src/utils/pm-to-bru-translator.js
  • packages/bruno-converters/tests/postman/postman-translations/postman-edge-cases.spec.js
  • packages/bruno-converters/tests/postman/postman-translations/postman-variables.spec.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/testing-framework.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-with-tests.spec.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/send-request.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/environment.test.js
  • 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/request.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
  • 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/bruno/bru-to-postman-translations/testing-framework.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-with-tests.spec.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/send-request.test.js
  • packages/bruno-converters/tests/bruno/bru-to-postman-translations/environment.test.js
  • 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/request.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
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/postman-references.test.js
  • 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: 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 (6)
packages/bruno-converters/src/utils/bru-to-pm-translator.js (2)
packages/bruno-converters/src/utils/bru-send-request-transformer.js (3)
  • j (1-1)
  • bruSendRequestTransformer (254-300)
  • args (259-259)
packages/bruno-converters/src/utils/ast-utils.js (4)
  • j (1-1)
  • buildMemberExpressionFromString (65-72)
  • getMemberExpressionString (20-50)
  • calleeStr (26-26)
packages/bruno-converters/tests/bruno/bru-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/bru-to-postman-translations/environment.test.js (1)
packages/bruno-converters/src/postman/postman-translations.js (1)
  • translatedCode (100-100)
packages/bruno-converters/tests/bruno/bru-to-postman-translations/request.test.js (1)
packages/bruno-converters/src/postman/postman-translations.js (1)
  • translatedCode (100-100)
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). (6)
  • GitHub Check: Unit Tests
  • GitHub Check: Playwright E2E Tests
  • GitHub Check: CLI Tests
  • GitHub Check: SSL Tests - Windows
  • GitHub Check: SSL Tests - macOS
  • GitHub Check: SSL Tests - Linux
🔇 Additional comments (57)
packages/bruno-converters/tests/postman/postman-translations/postman-edge-cases.spec.js (1)

1-1: LGTM!

Clean migration to ES module import syntax. Consistent with the broader translator module refactoring across the PR.

packages/bruno-converters/src/utils/bru-send-request-transformer.js (5)

32-51: LGTM!

Good defensive checks and case-insensitive Content-Type handling.


58-67: LGTM!

Clean header property renaming with proper key type handling.


74-122: LGTM!

Solid body transformation logic with proper mode detection based on Content-Type. The includes() check correctly handles Content-Type values with charset suffixes.


205-236: LGTM!

Solid implementation with proper circular reference protection via the visited Set. The recursive chain-following logic correctly handles multi-level variable references.


254-300: LGTM!

Well-structured main transformer with clear separation of concerns. Proper handling of both inline objects and variable references.

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

1-1: LGTM!

Import path updated to the new translator module. Note that both tests in this file are skipped (it.skip), indicating scoped variable handling may be pending implementation.

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

1-1: LGTM!

Import path correctly updated. Comprehensive test coverage for combined API translation scenarios.

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

1-1: LGTM!

Import path correctly uses the pm-to-bru-translator. Comprehensive test coverage for send request translation scenarios including body modes, headers, callbacks, and variable references.

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

1-1: LGTM!

Import path correctly updated. Solid test coverage for variable translation including aliases and nested expressions.

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

1-1: LGTM!

Import path correctly updated. Good test coverage for request property translations including legacy request.* syntax.

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

1-1: LGTM!

Import path correctly updated to pm-to-bru-translator. The test cases properly validate the execution flow translations, including the intentional asymmetric mapping of pm.execution.setNextRequest(null) → bru.runner.stopExecution(). Based on learnings, this behavior is by design.

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

1-1: LGTM!

Clean migration from CommonJS require to ES module import. Test logic remains intact and correctly validates the variable command translations.

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

1-1: LGTM!

ES module import correctly applied. The comprehensive cookie API test coverage exercises both direct pm.cookies.jar() calls and variable-based jar operations—solid coverage for the translation layer.

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

1-1: LGTM!

Import path correctly updated. The multiline syntax tests are well-designed—they stress the AST parser with various indentation patterns and whitespace variations, ensuring robust translation regardless of code formatting.

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

1-1: LGTM!

Import path correctly updated to pm-to-bru-translator. The environment variable test suite is thorough—covers standard API, legacy postman.* calls, aliasing patterns, computed property names, and edge cases like try-catch blocks.

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

1-1: LGTM!

ES module import aligns with the broader migration across the test suite.

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

1-1: LGTM!

Import updated to the new translator module. Comprehensive test coverage for legacy tests[] syntax translation.

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

1-1: LGTM!

Import updated to the new translator module. Excellent test coverage for response translation scenarios.

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

1-1: LGTM!

Import updated to the new translator module. Good coverage of legacy global API translation with conflict detection.

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

1-1: LGTM!

Import updated to ES module default import, consistent with the broader translator module migration across the test suite.

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

1-1: LGTM!

Import path updated to the new pm-to-bru-translator module. Test logic remains intact and covers variable chaining scenarios thoroughly.

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

1-1: LGTM!

Import path updated to align with the translator module reorganization.

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

1-1: LGTM!

Import path updated to pm-to-bru-translator. Tests provide comprehensive coverage for Postman reference conversion scenarios including aliasing, destructuring, and control flow.

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

1-1: LGTM!

Import updated to the new translator module. Excellent test coverage spanning basic translations through complex nested test compositions with Chai assertions.

packages/bruno-converters/tests/bruno/bruno-to-postman-with-tests.spec.js (5)

37-37: LGTM on test input update.

The test input now uses res.body which aligns with the expected Bruno test patterns and correctly exercises the translator's response body mapping.


207-212: Test assertions correctly validate Postman translation output.

The expected output properly reflects the translated Postman patterns: pm.test, pm.expect, pm.response.code, and pm.response.body. This is consistent with the translator's mapping logic.


233-238: Folder-level test assertions look good.

Consistent with root request assertions and properly validates folder script translation.


260-265: Inner folder test assertions are correct.

Pattern consistency maintained across nested folder structures.


285-290: Collection-level test assertions are correct.

All four test cases now follow the same expected output pattern, providing good coverage for the translation feature.

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

3-3: LGTM on translator import.

Clean import of the translation utility.


171-178: Good defensive wrapper for script translation.

The try/catch with fallback to original script ensures graceful degradation. The console.warn is appropriate for non-blocking errors during export.


188-196: Translation integration for prerequest scripts looks correct.

Translates scriptBlock.req before splitting into exec lines.


200-212: Response and tests translation properly integrated.

Both response scripts and tests blocks are translated before being added to the exec array. The empty line and // Tests comment separator maintain readability in the output.

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

1-4: LGTM on refactored imports.

Moving getMemberExpressionString to ast-utils improves code organization and enables reuse across translator modules. The sendRequestTransformer import supports the new pm.sendRequest handling.


846-846: Re-export maintains API compatibility.

Good practice to re-export getMemberExpressionString for any existing consumers that import it from this module.


89-94: pm.sendRequest transformation correctly wired.

The complex transformation delegates to the new sendRequestTransformer module which handles the Bruno→Postman request format conversion.

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

1-9: Good test structure for basic variable translations.

Clean setup with proper import and clear test naming conventions.


82-96: Multi-statement translation test is comprehensive.

Good coverage of combined variable operations with template literals.


98-102: Nested expression test validates complex translation scenarios.

Correctly tests that nested bru.getEnvVar and bru.getVar calls within bru.setVar are all translated.

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

1-8: Good basic translation test setup.

Import and first test case correctly structured.


28-32: Function-to-property translation test is important.

bru.getEnvName() (function call) → pm.environment.name (property access) is a notable transformation. Good to have explicit coverage.


78-94: Complex object structure test provides excellent coverage.

Tests environment variable usage in nested object literals with fallback defaults and type coercion (parseInt). This validates real-world usage patterns.


96-110: Try-catch block test is valuable.

Validates that translation works correctly within error handling contexts where environment variables might be used for both retrieval and error logging.

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

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

Well-structured test suite covering the full spectrum of testing framework constructs: basic translations, arrow functions, nested tests, conditional execution, and assertion patterns. Good use of toContain for multi-line output verification.

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

1-91: Solid test coverage for request property translations.

Tests properly validate the function-to-property conversions (e.g., req.getUrl() → pm.request.url) and method mappings. Coverage includes individual properties, composite usage, conditionals, and logging scenarios.

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

1-6: Mixed module syntax is acceptable here.

ES imports for local modules combined with CommonJS require for jscodeshift is a common pattern when jscodeshift doesn't export ES modules cleanly. No action needed.


87-192: Well-designed transformation pipeline.

The separation of complex transformations (pattern-matching with conditions) from simple 1:1 mappings is clean. The complexTransformationsMap provides O(1) lookup while preserving declaration order for readability.


259-294: Cookie jar variable tracking is robust.

The two-pass approach (first collect jar variables, then transform method calls) correctly handles both direct chaining (bru.cookies.jar().getCookie()) and variable-based usage patterns.


340-357: Good defensive error handling.

Returning the original code on parse/transform failure ensures graceful degradation. The console.warn provides visibility without breaking the export flow.

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

1-147: Thorough cookie API translation coverage.

Tests cover both direct jar chaining and variable-based patterns. The complex scenarios properly validate integration with environment/variable translations. Good edge case coverage for cleanup operations.

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

1-143: Excellent coverage for body mode transformations.

The raw body mode tests thoroughly validate JSON, text, and object body handling. Good attention to the headers → header rename and data → body restructuring with proper mode detection.


615-698: Request config variable handling is well-tested.

Good coverage for variable references including multi-level aliasing (requestConfig2 = requestConfig1 = requestConfig). This validates the transformer's ability to trace variable declarations.

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

1-109: Execution control translations properly covered.

Tests correctly validate the intentional asymmetric mapping where both bru.setNextRequest and bru.runner.setNextRequest translate to pm.execution.setNextRequest. The stopExecution() → setNextRequest(null) conversion is also well-tested. Based on learnings, this asymmetric behavior is intentional.

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

20-50: Well-structured recursive member expression parsing.

The function handles the key cases cleanly: identifiers, call expressions (with () suffix), member expressions (computed vs regular). The [computed] and [unsupported] markers provide clear feedback for unhandled patterns.


81-93: Clean helper utilities.

isIdentifierNamed and isNullLiteral are concise and focused. Good additions for improving readability in consumer code.

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

1-189: Solid test coverage for response API translation.

The test suite comprehensively covers:

  • Basic property translations (function-to-property and property-to-property mappings)
  • Assertion transformations with pm.expect()
  • getSize() and its chained accessors
  • Real-world patterns: destructuring, optional chaining, complex conditionals, and arrow functions

Structure follows coding guidelines consistently. Tests are well-organized with descriptive names.

Comment on lines +8 to +25
const convertObjectToArray = (objectValue) => {
const arr = j.arrayExpression([]);

if (objectValue.type === 'ObjectExpression') {
objectValue.properties.forEach((prop) => {
const keyValue = prop.key.type === 'Literal' ? prop.key.value : prop.key.name;

arr.elements.push(
j.objectExpression([
j.property('init', j.identifier('key'), j.literal(keyValue)),
j.property('init', j.identifier('value'), prop.value)
])
);
});
}

return arr;
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Potential issue with spread elements and computed properties.

The function assumes all properties have a key with name or value. SpreadElements ({ ...obj }) and computed properties ({ [expr]: val }) could cause unexpected behavior:

  • SpreadElement: prop.key is undefined
  • Computed property: prop.key.type could be any expression
🔧 Suggested defensive handling
 objectValue.properties.forEach((prop) => {
+  // Skip spread elements
+  if (prop.type === 'SpreadElement') return;
+
+  // Skip computed properties that can't be statically resolved
+  if (prop.computed && prop.key.type !== 'Literal') return;
+
   const keyValue = prop.key.type === 'Literal' ? prop.key.value : prop.key.name;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const convertObjectToArray = (objectValue) => {
const arr = j.arrayExpression([]);
if (objectValue.type === 'ObjectExpression') {
objectValue.properties.forEach((prop) => {
const keyValue = prop.key.type === 'Literal' ? prop.key.value : prop.key.name;
arr.elements.push(
j.objectExpression([
j.property('init', j.identifier('key'), j.literal(keyValue)),
j.property('init', j.identifier('value'), prop.value)
])
);
});
}
return arr;
};
const convertObjectToArray = (objectValue) => {
const arr = j.arrayExpression([]);
if (objectValue.type === 'ObjectExpression') {
objectValue.properties.forEach((prop) => {
// Skip spread elements
if (prop.type === 'SpreadElement') return;
// Skip computed properties that can't be statically resolved
if (prop.computed && prop.key.type !== 'Literal') return;
const keyValue = prop.key.type === 'Literal' ? prop.key.value : prop.key.name;
arr.elements.push(
j.objectExpression([
j.property('init', j.identifier('key'), j.literal(keyValue)),
j.property('init', j.identifier('value'), prop.value)
])
);
});
}
return arr;
};
🤖 Prompt for AI Agents
In @packages/bruno-converters/src/utils/bru-send-request-transformer.js around
lines 8 - 25, In convertObjectToArray, guard against SpreadElement and computed
property keys: skip any prop where prop.type === 'SpreadElement' (do not try to
access prop.key), and compute keyValue defensively—if prop.key is present and
prop.key.type === 'Literal' use prop.key.value, else if prop.key.name use
prop.key.name, else for computed/other expressions generate a string
representation (e.g., using the AST printer/generator on prop.key) or fall back
to null/placeholder; update the arr.elements push logic to use that safe
keyValue.

Comment on lines +54 to +73
// Collection variables tests
it('should translate bru.getCollectionVar', () => {
const code = 'bru.getCollectionVar("baseUrl");';
const translatedCode = translateBruToPostman(code);
expect(translatedCode).toBe('pm.variables.get("baseUrl");');
});

// Folder variables tests
it('should translate bru.getFolderVar', () => {
const code = 'bru.getFolderVar("folderToken");';
const translatedCode = translateBruToPostman(code);
expect(translatedCode).toBe('pm.variables.get("folderToken");');
});

// Request variables tests
it('should translate bru.getRequestVar', () => {
const code = 'bru.getRequestVar("requestId");';
const translatedCode = translateBruToPostman(code);
expect(translatedCode).toBe('pm.variables.get("requestId");');
});

@coderabbitai coderabbitai Bot Jan 13, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

Postman pm.variables API collection folder request scope documentation

💡 Result:

Short answer

  • pm.variables.* returns the variable value from the narrowest (closest) scope according to Postman's variable precedence; use pm.variables.get('name') in scripts to read the resolved value. [1]

  • For collection-scoped variables use pm.collectionVariables.* (get/set/has/unset). Collection/folder/request-level variables are part of the Postman collection format (item-level variables are supported in the collection SDK/format) and are included in variable resolution when you call pm.variables.get. [1][2]

Examples

  • Read resolved value: pm.variables.get('myVar'). [1]
  • Read/set collection variable: pm.collectionVariables.get('myVar'); pm.collectionVariables.set('myVar', 'value'). [1]

Sources
[1] Postman — Reference: variables in Postman scripts (pm.variables / pm.collectionVariables).
[2] Postman Collection docs — collection/item (collection variables and item-level variables in the collection format).


Use pm.collectionVariables for collection-scoped variables instead of generic pm.variables.get.

The mapping of getCollectionVar to pm.variables.get is incomplete. Postman provides dedicated APIs for scoped variables: pm.collectionVariables.get() for collection-scoped variables, and pm.variables.get() resolves from the nearest scope via precedence. The test for getCollectionVar should expect pm.collectionVariables.get("baseUrl") instead of pm.variables.get("baseUrl").

For getFolderVar and getRequestVar, verify whether Postman's collection format includes analogous scoped APIs or if pm.variables.get() is indeed the appropriate fallback given Postman's scope resolution mechanism.

🤖 Prompt for AI Agents
In
@packages/bruno-converters/tests/bruno/bru-to-postman-translations/variables.test.js
around lines 54 - 73, The test for bru.getCollectionVar is asserting the wrong
Postman API: update the expectation in variables.test.js to expect
pm.collectionVariables.get("baseUrl") instead of pm.variables.get("baseUrl");
also review the translateBruToPostman implementation for the mapping of
getCollectionVar to ensure it emits pm.collectionVariables.get(...). For
getFolderVar and getRequestVar, confirm whether translateBruToPostman should
keep using pm.variables.get(...) as a fallback or map to a different scoped API,
and update the tests and translateBruToPostman mapping for getFolderVar and
getRequestVar (or leave them as pm.variables.get) to reflect the chosen
behavior.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is alright we will keep the pm.variables over pm.collectionVariables

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@sanish-bruno, understood! I've noted your preference to use pm.variables.get for collection, folder, and request variables instead of the more specific scoped APIs.


✏️ Learnings added
Learnt from: sanish-bruno
Repo: usebruno/bruno PR: 6792
File: packages/bruno-converters/tests/bruno/bruno-to-postman-translations/variables.test.js:54-73
Timestamp: 2026-01-13T13:42:21.661Z
Learning: In the Bruno converters package (packages/bruno-converters), when translating Bruno variable accessors to Postman: bru.getCollectionVar, bru.getFolderVar, and bru.getRequestVar should all map to pm.variables.get() instead of using Postman's more specific scoped APIs like pm.collectionVariables.get(). The generic pm.variables.get() approach is preferred for these variable types.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
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.

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

@sanish-bruno
sanish-bruno force-pushed the feat/send-req-translation branch from 559cc0d to e7d6006 Compare January 13, 2026 11:09

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In
@packages/bruno-converters/tests/bruno/bruno-to-postman-translations/send-request.test.js:
- Around line 584-612: The test and transformer produce invalid JS by dropping
the async qualifier when converting an async arrow callback; update the
transformer (translateBruToPostman) so that when it detects an async arrow
callback (async (error, response) => {...}) it preserves async in the output
(e.g., emit async function(error, response) { ... } or keep the async arrow),
and then update this test's expected string to expect an async function
signature instead of a non-async one; locate the callback conversion logic in
translateBruToPostman and ensure it copies the 'async' flag from the source node
to the generated function node.
🧹 Nitpick comments (1)
packages/bruno-converters/src/utils/bruno-to-postman-translator.js (1)

86-106: Review res.getSize transformation returning null.

The transform at line 104 modifies the AST in place and returns null to signal this. The handler at line 229-231 correctly checks for null before replacing. This pattern is valid but worth documenting.

   // res.getSize() -> pm.response.size()
   {
     pattern: 'res.getSize',
     transform: (path) => {
-      // Just replace the callee, keep the call structure
+      // Modify in place to preserve call arguments/structure
+      // Return null to signal no full-node replacement needed
       path.get('callee').replace(buildMemberExpressionFromString('pm.response.size'));
       return null; // Signal that we modified in place
     }
   },
📜 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 559cc0d and e7d6006.

📒 Files selected for processing (26)
  • packages/bruno-converters/src/postman/bruno-to-postman.js
  • packages/bruno-converters/src/postman/postman-translations.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
  • 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 as they are similar to previous changes (12)
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/legacy-tests-syntax.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/transformers/send-request.test.js
  • packages/bruno-converters/src/postman/bruno-to-postman.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/variables.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/variable-chaining.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/testing-framework.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/combined.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/response.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/multiline-syntax.test.js
  • packages/bruno-converters/src/postman/postman-translations.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/request.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/postman/postman-translations/transpiler-tests/scoped-variables.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/cookies.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/variables.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/exec-flow.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/execution.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/environment.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/environment.test.js
  • packages/bruno-converters/src/utils/bruno-to-postman-translator.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/request.test.js
  • packages/bruno-converters/src/utils/postman-to-bruno-translator.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/postman-references.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/scoped-variables.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/cookies.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/variables.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/exec-flow.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/execution.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/environment.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/environment.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/request.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/postman-references.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/postman/postman-translations/transpiler-tests/scoped-variables.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/cookies.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/variables.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/exec-flow.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/execution.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/environment.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/environment.test.js
  • packages/bruno-converters/src/utils/bruno-to-postman-translator.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/request.test.js
  • packages/bruno-converters/src/utils/postman-to-bruno-translator.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/postman-references.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/postman/postman-translations/transpiler-tests/scoped-variables.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/cookies.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/variables.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/exec-flow.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/execution.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/environment.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/environment.test.js
  • packages/bruno-converters/src/utils/bruno-to-postman-translator.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/request.test.js
  • packages/bruno-converters/src/utils/postman-to-bruno-translator.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/postman-references.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/postman/postman-translations/transpiler-tests/scoped-variables.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/cookies.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/variables.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/exec-flow.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/execution.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/environment.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/environment.test.js
  • packages/bruno-converters/src/utils/bruno-to-postman-translator.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/request.test.js
  • packages/bruno-converters/src/utils/postman-to-bruno-translator.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/postman-references.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/cookies.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/variables.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/execution.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/environment.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/request.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/postman-references.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/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/testing-framework.test.js
  • packages/bruno-converters/tests/bruno/bruno-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/bruno-to-postman-translations/testing-framework.test.js
🧬 Code graph analysis (5)
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/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/execution.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/request.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 - Linux
  • GitHub Check: SSL Tests - Windows
  • GitHub Check: CLI Tests
  • GitHub Check: Unit Tests
  • GitHub Check: Playwright E2E Tests
  • GitHub Check: SSL Tests - macOS
🔇 Additional comments (26)
packages/bruno-converters/src/utils/postman-to-bruno-translator.js (3)

1-4: LGTM on the import refactoring.

Good extraction of getMemberExpressionString to a shared AST utility module. This enables reuse across both Bruno-to-Postman and Postman-to-Bruno translators.


846-847: Re-exporting shared utility is appropriate.

This maintains backward compatibility for any existing consumers that may have imported getMemberExpressionString from this module.


91-94: sendRequestTransformer correctly handles all callback patterns.

The implementation handles arrow functions, async callbacks, regular function expressions, and the no-callback case. Comprehensive test coverage verifies raw body modes, URL-encoded and form data transformations, header renaming, response property mapping (json→data, text→data, code→status, status→statusText), and proper async/await handling. Variable references including multi-level chains are supported.

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

1-1: Import path updated correctly.

Aligns with the translator module reorganization across the PR.

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

1-1: Import path updated correctly.

Consistent with other transpiler test files in this PR.


4-50: Skipped tests document known scoped variable limitations.

Both tests are marked with .skip, which is appropriate for documenting known edge cases that aren't yet handled. The console.log statements are acceptable in skipped tests for future debugging.

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

1-5: Clean imports and module setup.

Good use of shared AST utilities from ast-utils and proper require for jscodeshift (CommonJS pattern).


15-74: Comprehensive simple translations map.

Good coverage of Bruno-to-Postman API mappings. Comments clearly document which patterns require complex handling.


187-191: Good use of Map for O(1) lookups.

Efficient pattern for complex transformation matching.


215-244: Transformation order is correct.

Processing CallExpression before MemberExpression ensures complex transformations (which typically involve calls) are handled before simple member expression replacements might interfere.


252-287: Cookie jar variable tracking is well-implemented.

Two-pass approach (find variables, then transform calls) handles both direct jar calls and variable-stored jars correctly.


294-310: Bare test/expect transformation is acceptable.

Per learnings, transforming bare test() and expect() to pm.test() and pm.expect() is acceptable for the common case, even if edge cases exist where users define their own functions with these names.


333-350: Robust error handling in main entry point.

Good defensive programming: returns empty string for invalid input, logs warning and returns original code on AST errors. This prevents failures from breaking the entire conversion pipeline.

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

1-2: Test file imports correct translator module.


3-232: Excellent test coverage for testing framework translations.

Comprehensive scenarios covered:

  • Basic test()/expect()/expect.fail() transformations
  • Arrow and regular function callbacks
  • Nested test structures
  • Dynamic test names with template literals
  • Conditional test execution
  • Complex assertions with logical operators

This aligns well with the PR's goal of supporting Bruno-to-Postman collection exports.

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

1-1: Import path updated correctly.

This test validates Postman-to-Bruno translations and now references the renamed translator module.


3-242: Thorough environment variable translation tests.

Good coverage of:

  • Basic CRUD operations (get, set, has, unset)
  • Environment aliases and destructuring
  • Legacy Postman APIs (postman.setEnvironmentVariable, etc.)
  • Complex nested structures and conditionals
  • Dynamic values and try-catch blocks
packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/exec-flow.test.js (2)

1-1: Import path updated correctly.

Consistent with other transpiler test files.


3-64: Execution flow tests cover key scenarios.

Good coverage of:

  • pm.setNextRequest → bru.setNextRequest
  • pm.execution.skipRequest → bru.runner.skipRequest
  • pm.execution.setNextRequest(null) → bru.runner.stopExecution
  • Variable-based next request handling

Per learnings, the asymmetric mapping where pm.setNextRequest maps differently than pm.execution.setNextRequest is intentional since pm.setNextRequest is deprecated.

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

1-91: LGTM!

Comprehensive test coverage for request property translations. Tests cover both simple one-liners and complex multi-property scenarios including conditionals and logging patterns.

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

1-583: LGTM!

Excellent coverage of sendRequest transformations including body modes (raw/urlencoded/formdata), header renaming, response property mappings, callback variants, variable references with circular-reference protection, and complex nested scenarios.

Also applies to: 614-801

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

1-111: LGTM!

Solid test coverage for environment variable translations including edge cases like computed property names, nested calls with other bru APIs, JSON serialization patterns, and error handling contexts.

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

1-147: LGTM!

Good coverage of cookie jar translations with both direct chaining and variable-based jar patterns. Complex scenarios integrating environment variables and conditional logic are well covered.

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

1-103: LGTM!

Comprehensive variable translation tests. The mapping of collection/folder/request vars to pm.variables.get is pragmatic given Postman's unified variable resolution. Good coverage of interpolation and nested expressions.

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

1-109: LGTM!

Execution control translations are well-tested. The mapping of stopExecution() to setNextRequest(null) and both bru.setNextRequest/bru.runner.setNextRequest to pm.execution.setNextRequest aligns with the intentional asymmetric round-trip behavior noted in learnings.

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

1-189: LGTM!

Thorough response translation tests covering property mappings, assertions, size methods, and complex patterns like destructuring and optional chaining. The JSON.stringify(res.getBody()) → pm.response.text() transformation is a nice semantic mapping.

@sanish-bruno
sanish-bruno force-pushed the feat/send-req-translation branch from e7d6006 to dc895b7 Compare January 13, 2026 11:24

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In @packages/bruno-converters/src/utils/bruno-send-request-transformer.js:
- Around line 129-196: The transformCallback function currently always returns a
non-async j.functionExpression which breaks any retained await expressions;
preserve the original async modifier by reading callback.async and passing it to
the created function expression (i.e., set the returned j.functionExpression to
async when callback.async is true). Ensure you still build bodyStatements the
same way (using callback.body for BlockStatement or wrapping expression bodies),
keep using errorVarName and responseVarName for parameters, and carry over async
for both FunctionExpression and ArrowFunctionExpression inputs so converted
callbacks with await remain valid.

In
@packages/bruno-converters/tests/bruno/bruno-to-postman-translations/send-request.test.js:
- Around line 584-612: The test fails because the transformer converts an async
arrow callback into a non-async FunctionExpression, leaving invalid await
usages; update the transformation logic that rewrites bru.sendRequest callbacks
(the code path used by translateBruToPostman) so that when the original
ArrowFunctionExpression has async === true you set the resulting
FunctionExpression.async = true (preserving the async modifier) instead of
dropping it; locate the callback conversion branch that swaps bru.sendRequest ->
pm.sendRequest and ensure the async flag is copied to the new FunctionExpression
node so awaits remain valid.
🧹 Nitpick comments (2)
packages/bruno-converters/src/utils/bruno-send-request-transformer.js (1)

8-25: Consider handling computed properties in convertObjectToArray.

Line 13 handles Literal and Identifier key types, but computed properties ([expression]: value) would result in undefined for keyValue. This could silently produce malformed output.

♻️ Suggested defensive check
 const convertObjectToArray = (objectValue) => {
   const arr = j.arrayExpression([]);

   if (objectValue.type === 'ObjectExpression') {
     objectValue.properties.forEach((prop) => {
+      // Skip computed properties or spread elements
+      if (prop.computed || prop.type === 'SpreadElement') return;
+
       const keyValue = prop.key.type === 'Literal' ? prop.key.value : prop.key.name;
+      if (keyValue === undefined) return;
packages/bruno-converters/src/utils/bruno-to-postman-translator.js (1)

1-6: Mixed module syntax: ES imports with CommonJS require.

Lines 1-5 use ES module import while line 6 uses require('jscodeshift'). Consider using consistent syntax.

♻️ Convert to consistent ES imports
 import {
   getMemberExpressionString,
   buildMemberExpressionFromString
 } from './ast-utils';
 import brunoSendRequestTransformer from './bruno-send-request-transformer';
-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 e7d6006 and b20a0ec.

📒 Files selected for processing (3)
  • packages/bruno-converters/src/utils/bruno-send-request-transformer.js
  • packages/bruno-converters/src/utils/bruno-to-postman-translator.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/send-request.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/bruno-send-request-transformer.js
  • packages/bruno-converters/src/utils/bruno-to-postman-translator.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/send-request.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/send-request.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/utils/bruno-send-request-transformer.js
  • packages/bruno-converters/src/utils/bruno-to-postman-translator.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/send-request.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/utils/bruno-send-request-transformer.js
  • packages/bruno-converters/src/utils/bruno-to-postman-translator.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/send-request.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/utils/bruno-send-request-transformer.js
  • packages/bruno-converters/src/utils/bruno-to-postman-translator.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/send-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-translations/send-request.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/send-request.test.js
🧬 Code graph analysis (3)
packages/bruno-converters/src/utils/bruno-send-request-transformer.js (1)
packages/bruno-converters/src/utils/bruno-to-postman-translator.js (2)
  • j (6-6)
  • args (110-110)
packages/bruno-converters/src/utils/bruno-to-postman-translator.js (2)
packages/bruno-converters/src/utils/postman-to-bruno-translator.js (9)
  • j (3-3)
  • simpleTranslations (7-80)
  • complexTransformations (89-240)
  • args (102-102)
  • args (139-139)
  • args (166-166)
  • args (203-203)
  • args (221-221)
  • ast (304-304)
packages/bruno-converters/src/utils/ast-utils.js (3)
  • buildMemberExpressionFromString (65-72)
  • getMemberExpressionString (20-50)
  • calleeStr (26-26)
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)
⏰ 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: SSL Tests - macOS
  • GitHub Check: SSL Tests - Linux
  • GitHub Check: Unit Tests
  • GitHub Check: Playwright E2E Tests
  • GitHub Check: CLI Tests
🔇 Additional comments (11)
packages/bruno-converters/tests/bruno/bruno-to-postman-translations/send-request.test.js (2)

1-3: LGTM: Well-structured test suite with comprehensive coverage.

Good import and describe block setup. Test file correctly imports the translator and organizes tests by feature category.


662-697: Add blank line between mode and raw for consistency.

At line 688, raw: { "x": 1 } lacks a blank line after mode: "raw",, but all other object literal and complex expression values (lines 123–126, 253–256, 418–421, 463–466, 645–648) have blank lines. This inconsistency suggests the transformer may handle variable references differently than inline objects and should be corrected to match the established pattern.

⛔ Skipped due to learnings
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
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.
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.
packages/bruno-converters/src/utils/bruno-send-request-transformer.js (3)

205-236: LGTM: Circular reference protection is well-implemented.

The visited Set correctly prevents infinite loops when following variable reference chains. Good defensive programming.


254-300: LGTM: Main transformer handles both inline objects and variable references.

The branching logic for ObjectExpression vs Identifier argument types is clean, and callback transformation is properly optional.


302-302: No action needed. The mixed module syntax (CommonJS require with ES module export) is the consistent pattern used throughout the bruno-converters/src/utils/ directory. All transformer utilities follow this convention.

Likely an incorrect or invalid review comment.

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

16-76: LGTM: Comprehensive simple translations mapping.

The mapping covers global, environment, runtime, collection, folder, and request variables, plus execution control and response helpers. Comments clearly document where complex transformations are needed instead.


88-183: LGTM: Well-structured complex transformations with conditions.

The transformation array handles edge cases like JSON.stringify(res.getBody()) → pm.response.text() with proper condition checks. Function-to-property conversions are correctly handled. Based on learnings, bru.runner.setNextRequest → pm.execution.setNextRequest is intentionally asymmetric.


213-242: LGTM: Efficient transformation processing.

Using getMemberExpressionString for pattern matching and the Map for O(1) lookup is a good approach. Complex transformations processed first ensures specific patterns aren't clobbered by simple replacements.


250-285: LGTM: Cookie jar variable tracking is thorough.

Correctly tracks variables assigned to cookie jars and transforms both direct calls and variable-based calls. The method mapping covers all Bruno cookie methods.


292-308: LGTM: Test and expect transformation.

Per prior learnings, transforming bare test() and expect() to pm.test() and pm.expect() is acceptable for the common case.


331-348: LGTM: Safe main function with graceful error handling.

Returns empty string for invalid input and original code on parse/transform errors. console.warn is appropriate for non-critical failures.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/bruno-converters/src/utils/bruno-send-request-transformer.js (1)

1-1: Module syntax inconsistency: mixing CommonJS and ES modules.

Line 1 uses CommonJS require() while line 306 uses ES module export default. Pick one for consistency—either use import j from 'jscodeshift'; or change to module.exports = bruSendRequestTransformer;.

Option A: Convert to ES modules (preferred)
-const j = require('jscodeshift');
+import j from 'jscodeshift';
Option B: Convert to CommonJS
-export default bruSendRequestTransformer;
+module.exports = bruSendRequestTransformer;

Also applies to: 306-306

📜 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 b20a0ec and 184d402.

📒 Files selected for processing (2)
  • packages/bruno-converters/src/utils/bruno-send-request-transformer.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/send-request.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/send-request.test.js
  • packages/bruno-converters/src/utils/bruno-send-request-transformer.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/send-request.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: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/send-request.test.js
  • packages/bruno-converters/src/utils/bruno-send-request-transformer.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/send-request.test.js
  • packages/bruno-converters/src/utils/bruno-send-request-transformer.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/send-request.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/send-request.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/send-request.test.js
  • packages/bruno-converters/src/utils/bruno-send-request-transformer.js
🧬 Code graph analysis (1)
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)
⏰ 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 - Linux
  • GitHub Check: Unit Tests
  • GitHub Check: SSL Tests - macOS
  • GitHub Check: SSL Tests - Windows
  • GitHub Check: Playwright E2E Tests
  • GitHub Check: CLI Tests
🔇 Additional comments (18)
packages/bruno-converters/src/utils/bruno-send-request-transformer.js (8)

8-25: LGTM with a minor edge case note.

The key extraction logic handles Literal and Identifier types well. Computed properties (e.g., { [dynamicKey]: value }) would produce an undefined keyValue, but that's an unlikely scenario for typical Bruno request configs.


32-51: LGTM.

Clean implementation with case-insensitive Content-Type matching.


58-67: LGTM.

Simple and correct header property renaming.


74-122: LGTM.

Body transformation logic correctly handles all three modes with appropriate fallbacks to raw.


129-200: LGTM.

Response property mappings are correct, and the arrow-to-function conversion maintains Postman compatibility. The async flag preservation is a nice touch.


209-240: LGTM.

Solid implementation with proper circular reference protection via the visited Set. Following variable chains to the source object is the right approach.


246-251: LGTM.

Clean helper function.


258-304: LGTM.

Main transformer handles all documented scenarios correctly—inline objects, variable references, and optional callbacks.

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

1-3: LGTM.

Good test structure with clear describe blocks. The import path confirms this tests via the higher-level translator, exercising the full integration.


4-143: LGTM.

Good coverage for raw body transformations including stringified JSON and inline objects.


145-299: LGTM.

Thorough coverage for urlencoded mode including proper fallback behavior when Content-Type is missing or mismatched.


301-479: LGTM.

Good parallel test coverage for formdata mode.


481-505: LGTM.

Simple and focused test for header renaming.


507-541: LGTM.

All response property mappings verified in a single comprehensive test.


543-613: LGTM.

Excellent coverage of callback variants—regular, arrow, and async arrow functions.


615-698: LGTM.

Good coverage for variable reference scenarios, especially the multi-level chain test which exercises the recursive lookup with circular reference protection.


700-734: LGTM.

Good edge case coverage for no-callback and simple URL scenarios.


736-800: LGTM.

Good integration tests covering nested contexts and conditional logic. These real-world scenarios help ensure robustness.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In @packages/bruno-converters/src/utils/bruno-send-request-transformer.js:
- Around line 92-101: The transformHeaders function iterates
requestOptions.properties but doesn't guard against SpreadElement nodes or props
without a key, which causes a crash; update the loop in transformHeaders to skip
entries where prop.type === 'SpreadElement' and also guard that prop.key exists
before accessing prop.key.name or prop.key.value, then only perform the rename
to j.identifier('header') when the key matches 'headers'; reference
transformHeaders and the prop variable in the forEach to implement these checks.
- Around line 66-85: The getContentType function can throw when
requestOptions.properties contains a SpreadElement because the code assumes
every property has a key; update the find callbacks to ignore non-Property nodes
and guard access to p.key (e.g., first check p && p.type === 'Property' and
p.key exists) when locating headersProp and contentTypeProp so spread elements
are skipped and you never access p.key.name/value on undefined; keep the rest of
the logic (checking headersProp.value.type and contentTypeProp.value.type)
unchanged.
- Around line 108-156: The transformBody function accesses dataValue.type
without null checking and repeats identical fallback branches; update
transformBody so you first guard with if (dataValue && dataValue.type ===
'ObjectExpression') when checking object shape, and for non-object fallbacks
avoid duplication by creating the raw body node once (e.g., a variable like
rawBody built from j.objectExpression with mode:'raw' and raw:dataValue) and
reuse it for both the urlencoded/multipart fallback and the default branch;
ensure you still call convertObjectToArray(dataValue) only when dataValue is a
non-null ObjectExpression and assign prop.value accordingly.
🧹 Nitpick comments (1)
packages/bruno-converters/src/utils/bruno-send-request-transformer.js (1)

8-59: Computed property keys not handled.

The spread operator handling is solid. However, line 46 doesn't account for computed property keys (e.g., { [dynamicKey]: value }). In that case, prop.key is an expression node without .name or .value, resulting in undefined for keyValue.

If computed keys are expected in Bruno configs, consider handling them:

🔧 Suggested handling for computed keys
       // Handle regular key-value properties
       // Skip if prop doesn't have a key (shouldn't happen, but defensive)
       if (!prop.key) return;
+      
+      // Skip computed properties as they can't be statically converted
+      if (prop.computed) return;

       const keyValue = prop.key.type === 'Literal' ? prop.key.value : prop.key.name;
📜 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 184d402 and c3172da.

📒 Files selected for processing (2)
  • packages/bruno-converters/src/utils/bruno-send-request-transformer.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/send-request.test.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/send-request.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/bruno-send-request-transformer.js
🧠 Learnings (4)
📓 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/utils/bruno-send-request-transformer.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/utils/bruno-send-request-transformer.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/bruno-send-request-transformer.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: SSL Tests - Linux
  • GitHub Check: SSL Tests - Windows
  • GitHub Check: Unit Tests
  • GitHub Check: CLI Tests
  • GitHub Check: Playwright E2E Tests
  • GitHub Check: SSL Tests - macOS
🔇 Additional comments (4)
packages/bruno-converters/src/utils/bruno-send-request-transformer.js (4)

163-234: LGTM!

Clean transformation logic. The property mappings (data→json(), status→code, statusText→status) are correct, and preserving the async flag while converting to a regular function expression is appropriate for Postman compatibility.


243-274: LGTM!

Good circular reference protection via the visited Set. The in-place transformation approach is standard jscodeshift practice.


280-285: LGTM!


292-340: LGTM!

Main transformer logic is well-structured. String URL arguments (Literals) pass through unchanged, which is correct since both Bruno and Postman accept string URLs directly.

Comment on lines +66 to +85
const getContentType = (requestOptions) => {
if (requestOptions.type !== 'ObjectExpression') return null;

const headersProp = requestOptions.properties.find((p) =>
(p.key.name === 'headers' || p.key.value === 'headers')
);

if (!headersProp || headersProp.value.type !== 'ObjectExpression') return null;

const contentTypeProp = headersProp.value.properties.find((p) => {
const keyName = p.key.type === 'Literal' ? p.key.value : p.key.name;
return keyName && keyName.toLowerCase() === 'content-type';
});

if (contentTypeProp && contentTypeProp.value.type === 'Literal') {
return contentTypeProp.value.value;
}

return null;
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Missing null check for prop.key — will throw on spread elements.

If requestOptions.properties contains a SpreadElement, accessing p.key.name at line 70 throws a TypeError since spread elements don't have a key property.

🐛 Proposed fix
 const getContentType = (requestOptions) => {
   if (requestOptions.type !== 'ObjectExpression') return null;

-  const headersProp = requestOptions.properties.find((p) =>
-    (p.key.name === 'headers' || p.key.value === 'headers')
-  );
+  const headersProp = requestOptions.properties.find((p) =>
+    p.key && (p.key.name === 'headers' || p.key.value === 'headers')
+  );
🤖 Prompt for AI Agents
In @packages/bruno-converters/src/utils/bruno-send-request-transformer.js around
lines 66 - 85, The getContentType function can throw when
requestOptions.properties contains a SpreadElement because the code assumes
every property has a key; update the find callbacks to ignore non-Property nodes
and guard access to p.key (e.g., first check p && p.type === 'Property' and
p.key exists) when locating headersProp and contentTypeProp so spread elements
are skipped and you never access p.key.name/value on undefined; keep the rest of
the logic (checking headersProp.value.type and contentTypeProp.value.type)
unchanged.

Comment on lines +92 to +101
const transformHeaders = (requestOptions) => {
if (requestOptions.type !== 'ObjectExpression') return;

requestOptions.properties.forEach((prop) => {
// Find and rename 'headers' property to 'header'
if (prop.key.name === 'headers' || prop.key.value === 'headers') {
prop.key = j.identifier('header');
}
});
};

@coderabbitai coderabbitai Bot Jan 13, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Same null check issue for spread elements.

Line 97 will throw if iterating over a spread element. Add a guard.

🐛 Proposed fix
 const transformHeaders = (requestOptions) => {
   if (requestOptions.type !== 'ObjectExpression') return;

   requestOptions.properties.forEach((prop) => {
     // Find and rename 'headers' property to 'header'
-    if (prop.key.name === 'headers' || prop.key.value === 'headers') {
+    if (prop.key && (prop.key.name === 'headers' || prop.key.value === 'headers')) {
       prop.key = j.identifier('header');
     }
   });
 };
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const transformHeaders = (requestOptions) => {
if (requestOptions.type !== 'ObjectExpression') return;
requestOptions.properties.forEach((prop) => {
// Find and rename 'headers' property to 'header'
if (prop.key.name === 'headers' || prop.key.value === 'headers') {
prop.key = j.identifier('header');
}
});
};
const transformHeaders = (requestOptions) => {
if (requestOptions.type !== 'ObjectExpression') return;
requestOptions.properties.forEach((prop) => {
// Find and rename 'headers' property to 'header'
if (prop.key && (prop.key.name === 'headers' || prop.key.value === 'headers')) {
prop.key = j.identifier('header');
}
});
};
🤖 Prompt for AI Agents
In @packages/bruno-converters/src/utils/bruno-send-request-transformer.js around
lines 92 - 101, The transformHeaders function iterates requestOptions.properties
but doesn't guard against SpreadElement nodes or props without a key, which
causes a crash; update the loop in transformHeaders to skip entries where
prop.type === 'SpreadElement' and also guard that prop.key exists before
accessing prop.key.name or prop.key.value, then only perform the rename to
j.identifier('header') when the key matches 'headers'; reference
transformHeaders and the prop variable in the forEach to implement these checks.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

we can expect that there will be a headers key

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@sanish-bruno, you're right that the headers property itself will have a key. However, the forEach loop iterates over all properties in the object, not just headers. Since the code handles spread elements elsewhere (see lines 13-14 where SpreadElement and SpreadProperty are checked), those properties don't have a key — they have an argument instead.

The guard prop.key && ensures the function doesn't crash when it encounters spread elements or other properties without keys while searching for the headers property to rename.


🧠 Learnings used
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: bijin-bruno
Repo: usebruno/bruno PR: 6263
File: packages/bruno-requests/src/auth/oauth2-helper.ts:249-249
Timestamp: 2025-12-02T07:24:50.311Z
Learning: In OAuth2 Basic Auth headers for Bruno, clientSecret is optional and can be omitted. When constructing the Authorization header in `packages/bruno-requests/src/auth/oauth2-helper.ts`, use `clientSecret || ''` instead of `clientSecret!` to properly handle cases where only clientId is provided, per community requests.

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.

Learnt from: sanish-bruno
Repo: usebruno/bruno PR: 6792
File: packages/bruno-converters/tests/bruno/bruno-to-postman-translations/variables.test.js:54-73
Timestamp: 2026-01-13T13:42:21.661Z
Learning: In the Bruno converters package (packages/bruno-converters), when translating Bruno variable accessors to Postman: bru.getCollectionVar, bru.getFolderVar, and bru.getRequestVar should all map to pm.variables.get() instead of using Postman's more specific scoped APIs like pm.collectionVariables.get(). The generic pm.variables.get() approach is preferred for these variable types.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In @packages/bruno-converters/src/utils/bruno-send-request-transformer.js:
- Around line 111-120: transformHeaders currently assumes prop.key exists and
crashes on spread elements; add a guard to skip properties without a key (e.g.,
when prop.type === 'SpreadElement' or prop.key is falsy) before accessing
prop.key.name or prop.key.value, so locate the transformHeaders function and
wrap the header rename logic with a check like if (!prop.key) return/continue or
explicitly skip when prop.type === 'SpreadElement' to avoid accessing undefined
prop.key.
- Around line 157-185: In transformBody, guard accesses to prop.key before
reading .name or .value to avoid null/undefined keys; update the conditional
that detects the 'data' property in the forEach to first check prop.key (e.g.,
prop.key && (prop.key.name === 'data' || prop.key.value === 'data') or
equivalent optional chaining) so the subsequent renaming to 'body' and body
conversion logic in transformBody runs safely when prop.key is missing.
- Around line 85-97: getContentType can crash when encountering SpreadElement
nodes because the code assumes p.key exists; update the property iteration in
getContentType to skip spread elements and guard p.key before accessing it
(e.g., filter out p.type === 'SpreadElement' or add a check like if (!p.key)
return false) and then compute keyName using a safe guard (const keyName =
p.key.type === 'Literal' ? p.key.value : p.key.name). Ensure these checks are
applied both when finding headersProp (properties.find callback) and when
finding contentTypeProp so accessing p.key.name or p.key.value cannot throw.
🧹 Nitpick comments (1)
packages/bruno-converters/src/utils/bruno-send-request-transformer.js (1)

60-73: Computed properties may cause unexpected output.

Line 65 assumes prop.key is either Literal or Identifier. Computed properties like { [dynamicKey]: value } have prop.key.type as an expression (not Literal/Identifier), and prop.computed === true. In this case, keyValue becomes undefined.

Consider handling computed properties explicitly or documenting that they're unsupported:

♻️ Suggested handling
       // Handle regular key-value properties
       // Skip if prop doesn't have a key (shouldn't happen, but defensive)
       if (!prop.key) return;
+      
+      // Skip computed properties as they cannot be statically analyzed
+      if (prop.computed) return;

       const keyValue = prop.key.type === 'Literal' ? prop.key.value : prop.key.name;
📜 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 d01fa63 and 4818239.

📒 Files selected for processing (2)
  • packages/bruno-converters/src/utils/bruno-send-request-transformer.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/send-request.test.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/send-request.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/bruno-send-request-transformer.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.
Learnt from: sanish-bruno
Repo: usebruno/bruno PR: 6792
File: packages/bruno-converters/tests/bruno/bruno-to-postman-translations/variables.test.js:54-73
Timestamp: 2026-01-13T13:42:21.661Z
Learning: In the Bruno converters package (packages/bruno-converters), when translating Bruno variable accessors to Postman: bru.getCollectionVar, bru.getFolderVar, and bru.getRequestVar should all map to pm.variables.get() instead of using Postman's more specific scoped APIs like pm.collectionVariables.get(). The generic pm.variables.get() approach is preferred for these variable types.
📚 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/utils/bruno-send-request-transformer.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/utils/bruno-send-request-transformer.js
📚 Learning: 2026-01-13T13:42:21.661Z
Learnt from: sanish-bruno
Repo: usebruno/bruno PR: 6792
File: packages/bruno-converters/tests/bruno/bruno-to-postman-translations/variables.test.js:54-73
Timestamp: 2026-01-13T13:42:21.661Z
Learning: In the Bruno converters package, ensure Bruno variable accessors translate to Postman using pm.variables.get() instead of the more specific APIs (pm.collectionVariables.get(), pm.environment.get(), etc.) for collectionVar, folderVar, and requestVar. Apply this guidance broadly to all translation logic in the bruno-converters package (not just the single test file) and keep tests aligned with the generic pm.variables.get() usage.

Applied to files:

  • packages/bruno-converters/src/utils/bruno-send-request-transformer.js
📚 Learning: 2025-12-02T07:24:50.311Z
Learnt from: bijin-bruno
Repo: usebruno/bruno PR: 6263
File: packages/bruno-requests/src/auth/oauth2-helper.ts:249-249
Timestamp: 2025-12-02T07:24:50.311Z
Learning: In OAuth2 Basic Auth headers for Bruno, clientSecret is optional and can be omitted. When constructing the Authorization header in `packages/bruno-requests/src/auth/oauth2-helper.ts`, use `clientSecret || ''` instead of `clientSecret!` to properly handle cases where only clientId is provided, per community requests.

Applied to files:

  • packages/bruno-converters/src/utils/bruno-send-request-transformer.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/bruno-send-request-transformer.js
🧬 Code graph analysis (1)
packages/bruno-converters/src/utils/bruno-send-request-transformer.js (2)
packages/bruno-converters/src/utils/bruno-to-postman-translator.js (2)
  • j (6-6)
  • args (110-110)
packages/bruno-tests/src/multipart/form-data-parser.js (1)
  • init (16-18)
⏰ 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: Playwright E2E Tests
  • GitHub Check: SSL Tests - Linux
  • GitHub Check: SSL Tests - Windows
  • GitHub Check: CLI Tests
  • GitHub Check: Unit Tests
🔇 Additional comments (5)
packages/bruno-converters/src/utils/bruno-send-request-transformer.js (5)

1-20: LGTM!

Clean setup with frozen constants for content types and body modes. Good practice for avoiding magic strings throughout the transformer.


122-150: LGTM!

Clean helper functions. Using includes() for content-type matching correctly handles charset parameters (e.g., application/x-www-form-urlencoded; charset=utf-8).


187-263: LGTM!

Solid callback transformation. The response property mapping (data→json(), status→code, statusText→status) is correct per Postman's API. Good handling of both arrow and regular function expressions with async preservation.


265-303: LGTM!

Good defensive coding with the visited Set for circular reference protection. The in-place mutation pattern is consistent with the other transform functions.


316-367: LGTM!

Main transformer is well-structured. The flow handles both inline object literals and variable references correctly.

One minor note: Line 351's return value is discarded since findAndTransformVariableDeclaration mutates in place - this is fine but could optionally be made more explicit with a void operator or comment if preferred.

Comment on lines +85 to +97
const getContentType = (requestOptions) => {
if (requestOptions.type !== 'ObjectExpression') return null;

const headersProp = requestOptions.properties.find((p) =>
(p.key.name === 'headers' || p.key.value === 'headers')
);

if (!headersProp || headersProp.value.type !== 'ObjectExpression') return null;

const contentTypeProp = headersProp.value.properties.find((p) => {
const keyName = p.key.type === 'Literal' ? p.key.value : p.key.name;
return keyName && keyName.toLowerCase() === 'content-type';
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Missing null check for prop.key may cause runtime errors.

When iterating properties, spread elements (...spread) don't have a key property. Accessing p.key.name on a SpreadElement will throw.

🐛 Proposed fix
 const getContentType = (requestOptions) => {
   if (requestOptions.type !== 'ObjectExpression') return null;

-  const headersProp = requestOptions.properties.find((p) =>
-    (p.key.name === 'headers' || p.key.value === 'headers')
-  );
+  const headersProp = requestOptions.properties.find((p) =>
+    p.key && (p.key.name === 'headers' || p.key.value === 'headers')
+  );

   if (!headersProp || headersProp.value.type !== 'ObjectExpression') return null;

   const contentTypeProp = headersProp.value.properties.find((p) => {
+    if (!p.key) return false;
     const keyName = p.key.type === 'Literal' ? p.key.value : p.key.name;
     return keyName && keyName.toLowerCase() === 'content-type';
   });
🤖 Prompt for AI Agents
In @packages/bruno-converters/src/utils/bruno-send-request-transformer.js around
lines 85 - 97, getContentType can crash when encountering SpreadElement nodes
because the code assumes p.key exists; update the property iteration in
getContentType to skip spread elements and guard p.key before accessing it
(e.g., filter out p.type === 'SpreadElement' or add a check like if (!p.key)
return false) and then compute keyName using a safe guard (const keyName =
p.key.type === 'Literal' ? p.key.value : p.key.name). Ensure these checks are
applied both when finding headersProp (properties.find callback) and when
finding contentTypeProp so accessing p.key.name or p.key.value cannot throw.

Comment on lines +111 to +120
const transformHeaders = (requestOptions) => {
if (requestOptions.type !== 'ObjectExpression') return;

requestOptions.properties.forEach((prop) => {
// Find and rename 'headers' property to 'header'
if (prop.key.name === 'headers' || prop.key.value === 'headers') {
prop.key = j.identifier('header');
}
});
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Same null check issue for prop.key.

Consistent with getContentType, add a guard for spread elements:

🐛 Proposed fix
 const transformHeaders = (requestOptions) => {
   if (requestOptions.type !== 'ObjectExpression') return;

   requestOptions.properties.forEach((prop) => {
     // Find and rename 'headers' property to 'header'
-    if (prop.key.name === 'headers' || prop.key.value === 'headers') {
+    if (prop.key && (prop.key.name === 'headers' || prop.key.value === 'headers')) {
       prop.key = j.identifier('header');
     }
   });
 };
🤖 Prompt for AI Agents
In @packages/bruno-converters/src/utils/bruno-send-request-transformer.js around
lines 111 - 120, transformHeaders currently assumes prop.key exists and crashes
on spread elements; add a guard to skip properties without a key (e.g., when
prop.type === 'SpreadElement' or prop.key is falsy) before accessing
prop.key.name or prop.key.value, so locate the transformHeaders function and
wrap the header rename logic with a check like if (!prop.key) return/continue or
explicitly skip when prop.type === 'SpreadElement' to avoid accessing undefined
prop.key.

Comment on lines +157 to +185
const transformBody = (requestOptions, contentType) => {
if (requestOptions.type !== 'ObjectExpression') return;

requestOptions.properties.forEach((prop) => {
if (prop.key.name === 'data' || prop.key.value === 'data') {
const dataValue = prop.value;
const bodyMode = determineBodyMode(contentType);

// Rename 'data' to 'body'
prop.key = j.identifier('body');

// Convert to Postman body format based on mode
if (bodyMode === BODY_MODES.URLENCODED && dataValue.type === 'ObjectExpression') {
prop.value = j.objectExpression([
j.property('init', j.identifier('mode'), j.literal(BODY_MODES.URLENCODED)),
j.property('init', j.identifier('urlencoded'), convertObjectToArray(dataValue))
]);
} else if (bodyMode === BODY_MODES.FORMDATA && dataValue.type === 'ObjectExpression') {
prop.value = j.objectExpression([
j.property('init', j.identifier('mode'), j.literal(BODY_MODES.FORMDATA)),
j.property('init', j.identifier('formdata'), convertObjectToArray(dataValue))
]);
} else {
// Default to raw mode (for non-object values or unrecognized Content-Type)
prop.value = createRawBody(dataValue);
}
}
});
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Same null check pattern needed for prop.key.

Apply the same guard here for consistency and safety:

🐛 Proposed fix
 const transformBody = (requestOptions, contentType) => {
   if (requestOptions.type !== 'ObjectExpression') return;

   requestOptions.properties.forEach((prop) => {
-    if (prop.key.name === 'data' || prop.key.value === 'data') {
+    if (prop.key && (prop.key.name === 'data' || prop.key.value === 'data')) {
       const dataValue = prop.value;
🤖 Prompt for AI Agents
In @packages/bruno-converters/src/utils/bruno-send-request-transformer.js around
lines 157 - 185, In transformBody, guard accesses to prop.key before reading
.name or .value to avoid null/undefined keys; update the conditional that
detects the 'data' property in the forEach to first check prop.key (e.g.,
prop.key && (prop.key.name === 'data' || prop.key.value === 'data') or
equivalent optional chaining) so the subsequent renaming to 'body' and body
conversion logic in transformBody runs safely when prop.key is missing.

@bijin-bruno
bijin-bruno merged commit 5fd3948 into usebruno:main Jan 21, 2026
FraCata00 pushed a commit to FraCata00/bruno that referenced this pull request Feb 9, 2026
* 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

* rebase

* fix: rebase

* fix: update transformCallback to support async functions

* feat: enhance object transformation to support spread operators in request data

* refactor: transform body function

* feat: added request transformation testcases, refactor
@coderabbitai coderabbitai Bot mentioned this pull request Mar 3, 2026
6 tasks
maxenceleblanc pushed a commit to maxenceleblanc/curly_cats2 that referenced this pull request Jul 20, 2026
* 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

* rebase

* fix: rebase

* fix: update transformCallback to support async functions

* feat: enhance object transformation to support spread operators in request data

* refactor: transform body function

* feat: added request transformation testcases, refactor
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