[PR #3154] [MERGED] refactor: move hoppscotch-common tests to vitest #4260

Closed
opened 2026-03-17 01:48:39 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/3154
Author: @AndrewBastin
Created: 6/20/2023
Status: Merged
Merged: 6/21/2023
Merged by: @AndrewBastin

Base: release/2023.8.0Head: refactor/vitest


📝 Commits (1)

  • 9bdabeb refactor: introduce vitest and move tests to support it

📊 Changes

21 files changed (+700 additions, -283 deletions)

View changed files

📝 packages/hoppscotch-common/.eslintrc.js (+0 -1)
📝 packages/hoppscotch-common/package.json (+6 -1)
📝 packages/hoppscotch-common/src/helpers/__tests__/editorutils.spec.js (+1 -0)
📝 packages/hoppscotch-common/src/helpers/__tests__/jsonParse.spec.js (+1 -0)
📝 packages/hoppscotch-common/src/helpers/__tests__/platformutils.spec.js (+2 -1)
📝 packages/hoppscotch-common/src/helpers/curl/__tests__/curlparser.spec.js (+28 -27)
📝 packages/hoppscotch-common/src/helpers/curl/__tests__/detectContentType.spec.js (+57 -52)
📝 packages/hoppscotch-common/src/helpers/strategies/__tests__/AxiosStrategy-NoProxy.spec.js (+3 -2)
📝 packages/hoppscotch-common/src/helpers/strategies/__tests__/AxiosStrategy-Proxy.spec.js (+16 -15)
📝 packages/hoppscotch-common/src/helpers/strategies/__tests__/ExtensionStrategy-NoProxy.spec.js (+19 -18)
📝 packages/hoppscotch-common/src/helpers/utils/__tests__/b64.spec.js (+3 -6)
📝 packages/hoppscotch-common/src/helpers/utils/__tests__/contenttypes.spec.js (+1 -0)
📝 packages/hoppscotch-common/src/helpers/utils/__tests__/debounce.spec.js (+7 -6)
📝 packages/hoppscotch-common/src/helpers/utils/__tests__/uri.spec.js (+1 -0)
📝 packages/hoppscotch-common/src/helpers/utils/__tests__/valid.spec.js (+1 -0)
📝 packages/hoppscotch-common/src/newstore/__tests__/DispatchingStore.spec.js (+38 -35)
packages/hoppscotch-common/src/setupTests.ts (+71 -0)
packages/hoppscotch-common/src/vitest.d.ts (+13 -0)
📝 packages/hoppscotch-common/tsconfig.json (+7 -4)
packages/hoppscotch-common/vitest.config.ts (+14 -0)

...and 1 more files

📄 Description

Closes HFE-83

Description

This PR reintroduces test runs for hoppscotch-common and port the old Jest unit test scripts to work with Vitest.

Things done

  • Add do-test entry for hoppscotch-common so it can integrate with repo-wide test runs.
  • Introduce test and test:watch scripts to hoppscotch-common so we can run vitest for a single run or on watch mode.
  • Introduce vitest as dev dependency to hoppscotch-common
  • Introduce setupTests.ts where couple of custom matchers (pertaining to fp-ts constructs) are added.
  • Introduce vitest.d.ts to extend the typescript types for the custom matchers.

Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

Additional Information

N/A


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hoppscotch/hoppscotch/pull/3154 **Author:** [@AndrewBastin](https://github.com/AndrewBastin) **Created:** 6/20/2023 **Status:** ✅ Merged **Merged:** 6/21/2023 **Merged by:** [@AndrewBastin](https://github.com/AndrewBastin) **Base:** `release/2023.8.0` ← **Head:** `refactor/vitest` --- ### 📝 Commits (1) - [`9bdabeb`](https://github.com/hoppscotch/hoppscotch/commit/9bdabebab0146eedaf3ecec4ac5ebcf13bb49873) refactor: introduce vitest and move tests to support it ### 📊 Changes **21 files changed** (+700 additions, -283 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-common/.eslintrc.js` (+0 -1) 📝 `packages/hoppscotch-common/package.json` (+6 -1) 📝 `packages/hoppscotch-common/src/helpers/__tests__/editorutils.spec.js` (+1 -0) 📝 `packages/hoppscotch-common/src/helpers/__tests__/jsonParse.spec.js` (+1 -0) 📝 `packages/hoppscotch-common/src/helpers/__tests__/platformutils.spec.js` (+2 -1) 📝 `packages/hoppscotch-common/src/helpers/curl/__tests__/curlparser.spec.js` (+28 -27) 📝 `packages/hoppscotch-common/src/helpers/curl/__tests__/detectContentType.spec.js` (+57 -52) 📝 `packages/hoppscotch-common/src/helpers/strategies/__tests__/AxiosStrategy-NoProxy.spec.js` (+3 -2) 📝 `packages/hoppscotch-common/src/helpers/strategies/__tests__/AxiosStrategy-Proxy.spec.js` (+16 -15) 📝 `packages/hoppscotch-common/src/helpers/strategies/__tests__/ExtensionStrategy-NoProxy.spec.js` (+19 -18) 📝 `packages/hoppscotch-common/src/helpers/utils/__tests__/b64.spec.js` (+3 -6) 📝 `packages/hoppscotch-common/src/helpers/utils/__tests__/contenttypes.spec.js` (+1 -0) 📝 `packages/hoppscotch-common/src/helpers/utils/__tests__/debounce.spec.js` (+7 -6) 📝 `packages/hoppscotch-common/src/helpers/utils/__tests__/uri.spec.js` (+1 -0) 📝 `packages/hoppscotch-common/src/helpers/utils/__tests__/valid.spec.js` (+1 -0) 📝 `packages/hoppscotch-common/src/newstore/__tests__/DispatchingStore.spec.js` (+38 -35) ➕ `packages/hoppscotch-common/src/setupTests.ts` (+71 -0) ➕ `packages/hoppscotch-common/src/vitest.d.ts` (+13 -0) 📝 `packages/hoppscotch-common/tsconfig.json` (+7 -4) ➕ `packages/hoppscotch-common/vitest.config.ts` (+14 -0) _...and 1 more files_ </details> ### 📄 Description Closes HFE-83 ### Description This PR reintroduces test runs for `hoppscotch-common` and port the old Jest unit test scripts to work with [Vitest](https://vitest.dev/). #### Things done - Add `do-test` entry for `hoppscotch-common` so it can integrate with repo-wide test runs. - Introduce `test` and `test:watch` scripts to `hoppscotch-common` so we can run vitest for a single run or on watch mode. - Introduce `vitest` as dev dependency to `hoppscotch-common` - Introduce `setupTests.ts` where couple of [custom matchers](https://vitest.dev/guide/extending-matchers.html) (pertaining to fp-ts constructs) are added. - Introduce `vitest.d.ts` to extend the typescript types for the custom matchers. ### Checks - [x] My pull request adheres to the code style of this project - [ ] My code requires changes to the documentation - [ ] I have updated the documentation as required - [x] All the tests have passed ### Additional Information <!-- Any additional information like breaking changes, dependencies added, screenshots, comparisons between new and old behaviour, etc. --> N/A --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 01:48:39 +03:00
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#4260
No description provided.