[GH-ISSUE #4520] [bug]: hoppscotch-cli errors on npm test for Windows machine #1654

Open
opened 2026-03-16 21:17:48 +03:00 by kerem · 4 comments
Owner

Originally created by @Leon-Luu on GitHub (Nov 7, 2024).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/4520

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

In windows machine I got 100% errors related to packages\hoppscotch-cli when performs npm test (the same error is not seen on ubuntu)

Computer info:
windows 11
v18.15.0


Error info:
✓ src/tests/unit/getters.spec.ts (21 tests) 53ms
│ (node:39192) [DEP0147] DeprecationWarning: In future versions of Node.js, fs.rmdir(path, { recursive: true }) will be removed. Use fs.rm(path, { recursive: true }) instead
│ (Use node --trace-deprecation ... to show where the warning was created)
│ ❯ src/tests/e2e/commands/test.spec.ts (45 tests | 5 failed) 99961ms
│ × hopp test [options] <file_path_or_id> > Test hopp test <file_path_or_id> --env <file_path_or_id> command: > AWS Signature Authorization type > Successfully translates the authorization information to headers/query params and sends …
│ → expected Error: Command failed: node F:\develop\te… { …(4) } to be null
│ × hopp test [options] <file_path_or_id> > Test hopp test <file_path_or_id> --env <file_path_or_id> command: > Digest Authorization type > Successfully translates the authorization information to headers/query params and sends it alon…
│ → expected Error: Command failed: node F:\develop\te… { …(4) } to be null
│ × hopp test [options] <file_path_or_id> > Testhopp test <file_path_or_id> --env <file_path_or_id> --reporter-junit [path] > Report export fails with the code REPORT_EXPORT_FAILED while encountering an error during path creation │ → expected '' to be 'REPORT_EXPORT_FAILED' // Object.is equality │ × hopp test [options] <file_path_or_id> > Testhopp test <file_path_or_id> --env <file_path_or_id> --reporter-junit [path] > Generates a JUnit report at the default path
│ → Snapshot hopp test [options] <file_path_or_id> > Testhopp test <file_path_or_id> --env <file_path_or_id> --reporter-junit [path] > Generates a JUnit report at the default path 1 mismatched │ × hopp test [options] <file_path_or_id> > Testhopp test <file_path_or_id> --env <file_path_or_id> --reporter-junit [path] > Generates a JUnit report at the specified path
│ → Snapshot hopp test [options] <file_path_or_id> > Testhopp test <file_path_or_id> --env <file_path_or_id> --reporter-junit [path] > Generates a JUnit report at the specified path 1mismatched │ ⎯⎯⎯⎯⎯⎯⎯ Failed Tests 5 ⎯⎯⎯⎯⎯⎯⎯ │ FAIL src/tests/e2e/commands/test.spec.ts > hopp test [options] <file_path_or_id> > Testhopp test <file_path_or_id> --env <file_path_or_id>command: > AWS Signature Authorization type > Successfully translates the authorization in… │ AssertionError: expected Error: Command failed: node F:\develop\te… { …(4) } to be null │ ❯ src/tests/e2e/commands/test.spec.ts:418:23 │ 416| const { error } = await runCLI(args, { env }); │ 417| │ 418| expect(error).toBeNull(); │ | ^ │ 419| }); │ 420| }); │ ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/5]⎯ │ FAIL src/tests/e2e/commands/test.spec.ts > hopp test [options] <file_path_or_id> > Testhopp test <file_path_or_id> --env <file_path_or_id> command: > Digest Authorization type > Successfully translates the authorization informati… │ AssertionError: expected Error: Command failed: node F:\develop\te… { …(4) } to be null │ ❯ src/tests/e2e/commands/test.spec.ts:436:23 │ 434| const { error } = await runCLI(args); │ 435| │ 436| expect(error).toBeNull(); │ | ^ │ 437| }); │ 438| }); │ ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[2/5]⎯ │ FAIL src/tests/e2e/commands/test.spec.ts > hopp test [options] <file_path_or_id> > Testhopp test <file_path_or_id> --env <file_path_or_id> --reporter-junit [path] > Report export fails with the code REPORT_EXPORT_FAILED while enc…
│ AssertionError: expected '' to be 'REPORT_EXPORT_FAILED' // Object.is equality
│ - Expected
│ + Received
│ - REPORT_EXPORT_FAILED
│ ❯ src/tests/e2e/commands/test.spec.ts:662:19
│ 660|
│ 661| const out = getErrorCode(stderr);
│ 662| expect(out).toBe("REPORT_EXPORT_FAILED");
│ | ^
│ 663|
│ 664| expect(stdout).not.toContain(
│ ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[3/5]⎯
│ FAIL src/tests/e2e/commands/test.spec.ts > hopp test [options] <file_path_or_id> > Testhopp test <file_path_or_id> --env <file_path_or_id> --reporter-junit [path] > Generates a JUnit report at the default path │ Error: Snapshot hopp test [options] <file_path_or_id> > Testhopp test <file_path_or_id> --env <file_path_or_id> --reporter-junit [path] > Generates a JUnit report at the default path 1 mismatched
│ - Expected
│ + Received
│ @@ -1,10 +1,10 @@
│ "



│ + REQUEST_ERROR - TypeError [ERR_INVALID_URL]: Invalid URL]]>





│ @@ -70,11 +70,11 @@







│ hopp test [options] > Testhopp test --env --reporter-junit [path] > Generates a JUnit report at the specified path │ Error: Snapshot hopp test [options] > Testhopp test --env --reporter-junit [path] > Generates a JUnit report at the specified path 1 mismatched │ - Expected │ + Received │ @@ -1,10 +1,10 @@ │ " │ │ │
│ + REQUEST_ERROR - TypeError [ERR_INVALID_URL]: Invalid URL]]>





│ @@ -70,11 +70,11 @@







│ <![CDATA[
│ PARSING_ERROR - {
│ ❯ src/tests/e2e/commands/test.spec.ts:724:55
│ 722| .toString();
│ 723|
│ 724| expect(replaceDynamicValuesInStr(fileContents)).toMatchSnapshot(…
│ | ^
│ 725| });
│ 726|
│ ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[5/5]⎯
│  ELIFECYCLE  Test failed. See above for more details.

Steps to reproduce

  1. User windows machine
  2. go to packages\hoppscotch-cli
  3. perform npm test
  4. check test results

Environment

Production

Version

Cloud

Originally created by @Leon-Luu on GitHub (Nov 7, 2024). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/4520 ### Is there an existing issue for this? - [X] I have searched the existing issues ### Current behavior In windows machine I got 100% errors related to packages\hoppscotch-cli when performs npm test (the same error is not seen on ubuntu) Computer info: windows 11 v18.15.0 -------------- Error info: ✓ src/tests/unit/getters.spec.ts (21 tests) 53ms │ (node:39192) [DEP0147] DeprecationWarning: In future versions of Node.js, fs.rmdir(path, { recursive: true }) will be removed. Use fs.rm(path, { recursive: true }) instead │ (Use node --trace-deprecation ... to show where the warning was created) │ ❯ src/tests/e2e/commands/test.spec.ts (45 tests | 5 failed) 99961ms │ × hopp test [options] <file_path_or_id> > Test hopp test <file_path_or_id> --env <file_path_or_id> command: > AWS Signature Authorization type > Successfully translates the authorization information to headers/query params and sends … │ → expected Error: Command failed: node F:\develop\te… { …(4) } to be null │ × hopp test [options] <file_path_or_id> > Test hopp test <file_path_or_id> --env <file_path_or_id> command: > Digest Authorization type > Successfully translates the authorization information to headers/query params and sends it alon… │ → expected Error: Command failed: node F:\develop\te… { …(4) } to be null │ × hopp test [options] <file_path_or_id> > Testhopp test <file_path_or_id> --env <file_path_or_id> --reporter-junit [path] > Report export fails with the code REPORT_EXPORT_FAILED while encountering an error during path creation │ → expected '' to be 'REPORT_EXPORT_FAILED' // Object.is equality │ × hopp test [options] <file_path_or_id> > Testhopp test <file_path_or_id> --env <file_path_or_id> --reporter-junit [path] > Generates a JUnit report at the default path │ → Snapshot hopp test [options] <file_path_or_id> > Testhopp test <file_path_or_id> --env <file_path_or_id> --reporter-junit [path] > Generates a JUnit report at the default path 1 mismatched │ × hopp test [options] <file_path_or_id> > Testhopp test <file_path_or_id> --env <file_path_or_id> --reporter-junit [path] > Generates a JUnit report at the specified path │ → Snapshot hopp test [options] <file_path_or_id> > Testhopp test <file_path_or_id> --env <file_path_or_id> --reporter-junit [path] > Generates a JUnit report at the specified path 1mismatched │ ⎯⎯⎯⎯⎯⎯⎯ Failed Tests 5 ⎯⎯⎯⎯⎯⎯⎯ │ FAIL src/__tests__/e2e/commands/test.spec.ts > hopp test [options] <file_path_or_id> > Testhopp test <file_path_or_id> --env <file_path_or_id>command: > AWS Signature Authorization type > Successfully translates the authorization in… │ AssertionError: expected Error: Command failed: node F:\develop\te… { …(4) } to be null │ ❯ src/__tests__/e2e/commands/test.spec.ts:418:23 │ 416| const { error } = await runCLI(args, { env }); │ 417| │ 418| expect(error).toBeNull(); │ | ^ │ 419| }); │ 420| }); │ ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/5]⎯ │ FAIL src/__tests__/e2e/commands/test.spec.ts > hopp test [options] <file_path_or_id> > Testhopp test <file_path_or_id> --env <file_path_or_id> command: > Digest Authorization type > Successfully translates the authorization informati… │ AssertionError: expected Error: Command failed: node F:\develop\te… { …(4) } to be null │ ❯ src/__tests__/e2e/commands/test.spec.ts:436:23 │ 434| const { error } = await runCLI(args); │ 435| │ 436| expect(error).toBeNull(); │ | ^ │ 437| }); │ 438| }); │ ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[2/5]⎯ │ FAIL src/__tests__/e2e/commands/test.spec.ts > hopp test [options] <file_path_or_id> > Testhopp test <file_path_or_id> --env <file_path_or_id> --reporter-junit [path] > Report export fails with the code REPORT_EXPORT_FAILED while enc… │ AssertionError: expected '' to be 'REPORT_EXPORT_FAILED' // Object.is equality │ - Expected │ + Received │ - REPORT_EXPORT_FAILED │ ❯ src/tests/e2e/commands/test.spec.ts:662:19 │ 660| │ 661| const out = getErrorCode(stderr); │ 662| expect(out).toBe("REPORT_EXPORT_FAILED"); │ | ^ │ 663| │ 664| expect(stdout).not.toContain( │ ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[3/5]⎯ │ FAIL src/tests/e2e/commands/test.spec.ts > hopp test [options] <file_path_or_id> > Testhopp test <file_path_or_id> --env <file_path_or_id> --reporter-junit [path] > Generates a JUnit report at the default path │ Error: Snapshot hopp test [options] <file_path_or_id> > Testhopp test <file_path_or_id> --env <file_path_or_id> --reporter-junit [path] > Generates a JUnit report at the default path 1 mismatched │ - Expected │ + Received │ @@ -1,10 +1,10 @@ │ " │ │ │ │ + REQUEST_ERROR - TypeError [ERR_INVALID_URL]: Invalid URL]]> │ │ │ │ │ │ @@ -70,11 +70,11 @@ │ │ │ │ │ │ │ │ hopp test [options] > Test`hopp test --env --reporter-junit [path] > Generates a JUnit report at the specified path │ Error: Snapshot `hopp test [options] > Test`hopp test --env --reporter-junit [path] > Generates a JUnit report at the specified path 1` mismatched │ - Expected │ + Received │ @@ -1,10 +1,10 @@ │ " │ │ │ │ + REQUEST_ERROR - TypeError [ERR_INVALID_URL]: Invalid URL]]> │ │ │ │ │ │ @@ -70,11 +70,11 @@ │ │ │ │ │ │ │ │ <![CDATA[ │ PARSING_ERROR - { │ ❯ src/tests/e2e/commands/test.spec.ts:724:55 │ 722| .toString(); │ 723| │ 724| expect(replaceDynamicValuesInStr(fileContents)).toMatchSnapshot(… │ | ^ │ 725| }); │ 726| │ ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[5/5]⎯ │  ELIFECYCLE  Test failed. See above for more details. ### Steps to reproduce 1) User windows machine 2) go to packages\hoppscotch-cli 2) perform npm test 3) check test results ### Environment Production ### Version Cloud
Author
Owner

@ImNicolasTheDev commented on GitHub (Nov 20, 2024):

Hi there!
It seems like the path you are exporting the report to is incorrect. Could you make sure to try both relative and absolute paths?
Also, maybe your path contains special characters that could prevent the path to be found correctly...

<!-- gh-comment-id:2488172840 --> @ImNicolasTheDev commented on GitHub (Nov 20, 2024): Hi there! It seems like the path you are exporting the report to is incorrect. Could you make sure to try both relative and absolute paths? Also, maybe your path contains special characters that could prevent the path to be found correctly...
Author
Owner

@Leon-Luu commented on GitHub (Nov 21, 2024):

We shouldn't do any more than that do pnpm test on either root folder or packages\hoppscotch-cli folder. This has been working earlier in Windows.

<!-- gh-comment-id:2490591118 --> @Leon-Luu commented on GitHub (Nov 21, 2024): We shouldn't do any more than that do **pnpm test** on either root folder or packages\hoppscotch-cli folder. This has been working earlier in Windows.
Author
Owner

@ImNicolasTheDev commented on GitHub (Nov 21, 2024):

We shouldn't do any more than that do pnpm test on either root folder or packages\hoppscotch-cli folder. This has been working earlier in Windows.

You should find information here : https://docs.hoppscotch.io/documentation/clients/cli/overview#windows-and-macos
On Windows, you should run hopp test <hoppscotch-collection-file> --reporter-junit [path_to_export_report]

Note that you can add other arguments, you can find them here : https://docs.hoppscotch.io/documentation/clients/cli/overview#arguments

Hope that helps! 😉

<!-- gh-comment-id:2491508593 --> @ImNicolasTheDev commented on GitHub (Nov 21, 2024): > We shouldn't do any more than that do **pnpm test** on either root folder or packages\hoppscotch-cli folder. This has been working earlier in Windows. You should find information here : https://docs.hoppscotch.io/documentation/clients/cli/overview#windows-and-macos On Windows, you should run `hopp test <hoppscotch-collection-file> --reporter-junit [path_to_export_report]` Note that you can add other arguments, you can find them here : https://docs.hoppscotch.io/documentation/clients/cli/overview#arguments Hope that helps! 😉
Author
Owner

@Leon-Luu commented on GitHub (Nov 22, 2024):

@ImNicolasTheDev seems like you had misunderstood the problem here. It is about the test cases errors on https://github.com/hoppscotch/hoppscotch/tree/main/packages/hoppscotch-cli/src/tests while executing the test on windows. It is NOT about using the CLI, there is no problem there.

<!-- gh-comment-id:2493288614 --> @Leon-Luu commented on GitHub (Nov 22, 2024): @ImNicolasTheDev seems like you had misunderstood the problem here. It is about the test cases errors on https://github.com/hoppscotch/hoppscotch/tree/main/packages/hoppscotch-cli/src/__tests__ while executing the test on windows. It is NOT about using the CLI, there is no problem there.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#1654
No description provided.