From 922567b0f9c717e8aa9a0e9760090c354fcdd4bc Mon Sep 17 00:00:00 2001 From: George He Date: Wed, 27 Nov 2024 16:57:44 +0800 Subject: [PATCH] fix(cli): the first item is executed as the last one (#8205) --- packages/insomnia-inso/src/cli.test.ts | 3 ++- packages/insomnia-inso/src/cli.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/insomnia-inso/src/cli.test.ts b/packages/insomnia-inso/src/cli.test.ts index 07d3acc31a8..557a24be5db 100644 --- a/packages/insomnia-inso/src/cli.test.ts +++ b/packages/insomnia-inso/src/cli.test.ts @@ -155,7 +155,8 @@ describe('inso dev bundle', () => { expect(firstReqLogPosition).toBeGreaterThanOrEqual(0); expect(secondReqLogPosition).toBeGreaterThanOrEqual(0); - expect(firstReqLogPosition < secondReqLogPosition).toBeTruthy; + + expect(secondReqLogPosition).toBeGreaterThan(firstReqLogPosition); }); }); }); diff --git a/packages/insomnia-inso/src/cli.ts b/packages/insomnia-inso/src/cli.ts index 58e89c3038e..89111ae91db 100644 --- a/packages/insomnia-inso/src/cli.ts +++ b/packages/insomnia-inso/src/cli.ts @@ -545,7 +545,7 @@ export const go = (args?: string[]) => { // sort requests if (options.item.length) { const requestOrder = new Map(); - options.item.forEach((reqId: string, order: number) => requestOrder.set(reqId, order)); + options.item.forEach((reqId: string, order: number) => requestOrder.set(reqId, order + 1)); requestsToRun = requestsToRun.sort((a, b) => (requestOrder.get(a._id) || requestsToRun.length) - (requestOrder.get(b._id) || requestsToRun.length)); }