Kong / Kong/insomnia

Pre-Request Scripts are not executed in Test-Suites

Open
#7,703 2 comments 0 reactions 0 assignees View on GitHub
C-improvement S-verified
Dominant language
TypeScript
Stars
40k
Forks
2.4k
Avg merge
2d 13h
Merged PRs (30d)
61

Description

### Expected Behavior

I have implemented a request, that has a pre request script. The pre-request script gets executed when I execute it in the collection tab. When I integrate the request in a test suite the pre request script should be executed when running the tests.

### Actual Behavior

In a unittest in Insomnia the pre request script are not executed

### Reproduction Steps

_No response_

### Is there an existing issue for this?

- [X] I have searched the [issue tracker](https://www.github.com/Kong/insomnia/issues) for this problem.

### Additional Information

This is the step in the test suite:
const response1 = await insomnia.send();
expect(response1.status).to.equal(204);

Version: Insomnia 9.3.2
Build date: 4.7.2024
OS: Windows_NT x64 10.0.22631
Electron: 30.0.9
Node: 20.11.1
Node ABI: 123
V8: 12.4.254.20-electron.0
Architecture: x64

### Insomnia Version

9.3.2

### What operating system are you using?

Windows

### Operating System Version

Windows 11 Enterprise, 23H2

### Installation method

Downloaded from Insomnia Website

### Last Known Working Insomnia version

_No response_

Contributor guide

Open the contributing guide

Research direction

No files or tests are named. Start by tracing how Insomnia test suites execute insomnia.send() and how collection requests run pre-request scripts, then compare those paths. Done means the pre-request script runs before the request in a test suite and the reported status assertion passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
api, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.