Skip to content

Commit

Permalink
fix(cli): failed to run script in cli if timeline dir is not inited
Browse files Browse the repository at this point in the history
  • Loading branch information
ihexxa committed Dec 5, 2024
1 parent 8868780 commit 725ac24
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/insomnia-smoke-test/fixtures/simple.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ resources:
settingRebuildPath: true
settingFollowRedirects: global
_type: request
preRequestScript: |-
console.log('executing pre-request script');
- _id: fld_01de564274824ecaad272330339ea6b2
parentId: wrk_0702a57d75d44255a8cecd2c5fa87809
modified: 1668533312225
Expand Down Expand Up @@ -101,6 +103,8 @@ resources:
settingRebuildPath: true
settingFollowRedirects: global
_type: request
preRequestScript: |-
console.log('executing pre-request script');
- _id: req_579daeabc7534a52b242bdaaaf6ca4dc
parentId: wrk_0702a57d75d44255a8cecd2c5fa87809
modified: 1666867670885
Expand All @@ -122,6 +126,8 @@ resources:
settingRebuildPath: true
settingFollowRedirects: global
_type: request
preRequestScript: |-
console.log('executing pre-request script');
- _id: env_42a94488fcd6106a75fb3ededd6bb4fbd267aa95
parentId: wrk_0702a57d75d44255a8cecd2c5fa87809
modified: 1666867924188
Expand Down
2 changes: 2 additions & 0 deletions packages/insomnia/src/common/send-request.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import fs from 'fs/promises';
import path from 'path';

import { type BaseModel, types as modelTypes } from '../models';
Expand Down Expand Up @@ -122,6 +123,7 @@ export async function getSendRequestCallbackMemDb(environmentId: string, memDB:
return async function sendRequest(requestId: string, iteration?: number) {
const requestData = await fetchInsoRequestData(requestId, environmentId);
const getCurrentRowOfIterationData = wrapAroundIterationOverIterationData(iterationData, iteration);
await fs.mkdir(path.dirname(requestData.timelinePath), { recursive: true });

const mutatedContext = await tryToExecutePreRequestScript(requestData, transientVariables, getCurrentRowOfIterationData, iteration, iterationCount);
if (mutatedContext === null) {
Expand Down

0 comments on commit 725ac24

Please sign in to comment.