[PR #3677] [MERGED] feat(js-sandbox): add pw.env.unset method #4489

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

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/3677
Author: @ajmalmohad
Created: 12/19/2023
Status: Merged
Merged: 1/23/2024
Merged by: @AndrewBastin

Base: release/2023.12.3Head: feature/unset-var-script


📝 Commits (5)

  • d680e49 feat: added unset variable to sandbox
  • 9d64616 chore: fixed comments
  • fbfebc8 test: increase coverage
  • c101f3c refactor: leverage helpers
  • 939d952 feat: show deletions for global environment in test results

📊 Changes

8 files changed (+328 additions, -51 deletions)

View changed files

📝 packages/hoppscotch-common/src/components/http/TestResult.vue (+7 -0)
📝 packages/hoppscotch-common/src/helpers/terndoc/ecma.json (+2 -1)
📝 packages/hoppscotch-common/src/helpers/terndoc/pw-pre.json (+1 -0)
📝 packages/hoppscotch-common/src/helpers/terndoc/pw-test.json (+1 -0)
📝 packages/hoppscotch-js-sandbox/src/__tests__/preRequest.spec.ts (+4 -3)
packages/hoppscotch-js-sandbox/src/__tests__/testing/envs/unset.spec.ts (+243 -0)
📝 packages/hoppscotch-js-sandbox/src/__tests__/testing/test-runner.spec.ts (+2 -2)
📝 packages/hoppscotch-js-sandbox/src/utils.ts (+68 -45)

📄 Description

We can unset variables using unset function in pre-request script and test script

Closes #3398

Description

Unset function is added to the Javascript Sandbox. It will work on both pre-request scripts and test scripts. An associated test suite was added. Also, the test results UI will now show deletions for the global environment.

Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • Documentation updates required are tracked here.
  • All the tests have passed

Additional Information

Screenshot from 2023-12-15 11-45-38
Screenshot from 2023-12-15 11-46-17
Screenshot from 2023-12-15 11-47-09


🔄 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/3677 **Author:** [@ajmalmohad](https://github.com/ajmalmohad) **Created:** 12/19/2023 **Status:** ✅ Merged **Merged:** 1/23/2024 **Merged by:** [@AndrewBastin](https://github.com/AndrewBastin) **Base:** `release/2023.12.3` ← **Head:** `feature/unset-var-script` --- ### 📝 Commits (5) - [`d680e49`](https://github.com/hoppscotch/hoppscotch/commit/d680e492f8356fafb2ee6ca004b49306584941a0) feat: added unset variable to sandbox - [`9d64616`](https://github.com/hoppscotch/hoppscotch/commit/9d6461605275d3a02990400575dc63ec89c3be8e) chore: fixed comments - [`fbfebc8`](https://github.com/hoppscotch/hoppscotch/commit/fbfebc88420ac077f1f01a8fbef7bdaa97bacaaf) test: increase coverage - [`c101f3c`](https://github.com/hoppscotch/hoppscotch/commit/c101f3c09c560cf736bb7604a2044813ed2fe9b3) refactor: leverage helpers - [`939d952`](https://github.com/hoppscotch/hoppscotch/commit/939d952c084b6059f89878161bca8d128845a954) feat: show deletions for global environment in test results ### 📊 Changes **8 files changed** (+328 additions, -51 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-common/src/components/http/TestResult.vue` (+7 -0) 📝 `packages/hoppscotch-common/src/helpers/terndoc/ecma.json` (+2 -1) 📝 `packages/hoppscotch-common/src/helpers/terndoc/pw-pre.json` (+1 -0) 📝 `packages/hoppscotch-common/src/helpers/terndoc/pw-test.json` (+1 -0) 📝 `packages/hoppscotch-js-sandbox/src/__tests__/preRequest.spec.ts` (+4 -3) ➕ `packages/hoppscotch-js-sandbox/src/__tests__/testing/envs/unset.spec.ts` (+243 -0) 📝 `packages/hoppscotch-js-sandbox/src/__tests__/testing/test-runner.spec.ts` (+2 -2) 📝 `packages/hoppscotch-js-sandbox/src/utils.ts` (+68 -45) </details> ### 📄 Description We can unset variables using unset function in pre-request script and test script <!-- Thanks for creating this pull request 🤗 Please make sure that the pull request is limited to one type (docs, feature, etc.) and keep it as small as possible. You can open multiple prs instead of opening a huge one. --> <!-- If this pull request closes an issue, please mention the issue number below --> Closes #3398 ### Description Unset function is added to the Javascript Sandbox. It will work on both pre-request scripts and test scripts. An associated test suite was added. Also, the test results UI will now show deletions for the global environment. <!-- You can also choose to add a list of changes and if they have been completed or not by using the markdown to-do list syntax - [ ] Not Completed - [x] Completed --> ### Checks <!-- Make sure your pull request passes the CI checks and do check the following fields as needed - --> - [x] My pull request adheres to the code style of this project - [x] My code requires changes to the documentation - [x] Documentation updates required are tracked [here](https://linear.app/hoppscotch/issue/HP-187/document-the-pwenvunset-method-under-scripts). - [x] All the tests have passed ### Additional Information ![Screenshot from 2023-12-15 11-45-38](https://github.com/hoppscotch/hoppscotch/assets/55492635/b5e6b95f-1adc-40f8-97a9-90e44d1e400b) ![Screenshot from 2023-12-15 11-46-17](https://github.com/hoppscotch/hoppscotch/assets/55492635/10c5b49b-4443-49ea-b9b4-61da44182945) ![Screenshot from 2023-12-15 11-47-09](https://github.com/hoppscotch/hoppscotch/assets/55492635/0f3d976b-673b-4efb-83d5-e52b6eeaf8e9) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 02:01:13 +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#4489
No description provided.