Skip to content

Commit 681e4af

Browse files
authored
Merge pull request #310 from ganesh-bruno/docs/getexecution-mode
added execution mode to docs
2 parents 7a16c31 + 1bd9270 commit 681e4af

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/pages/testing/script/javascript-reference.mdx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,34 @@ Sets a timeout for the request.
145145
req.setTimeout(5000); // Sets the timeout to 5000 milliseconds (5 seconds)
146146
```
147147

148+
### `getExecutionMode`
149+
150+
Get the current active execution mode of the request.
151+
152+
**Returns:**
153+
- `runner`: When the request is being executed as part of a collection run
154+
- `standalone`: When the request is being executed individually
155+
156+
**Example:**
157+
```javascript
158+
const executionMode = req.getExecutionMode();
159+
console.log(`Request is running in ${executionMode} mode`);
160+
```
161+
162+
### `getExecutionPlatform`
163+
164+
Get the platform on which the request is being executed.
165+
166+
**Returns:**
167+
- `app`: When running in the Bruno desktop application
168+
- `cli`: When running through the Bruno CLI
169+
170+
**Example:**
171+
```javascript
172+
const platform = req.getExecutionPlatform();
173+
console.log(`Request is running on ${platform} platform`);
174+
```
175+
148176
## Response
149177

150178
This `res` variable is available inside your scripting and testing context.

0 commit comments

Comments
 (0)