-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Remove
shelljs
use from backup command (#37356)
This is towards fixing `appsmithctl` into a modern component of the project. First order of business is to get rid of the `shelljs` dependency, since we don't really need it that seriously, and since it does weird stuff with `require()` that we can't use `esbuild` to build `appsmithctl`. Further PRs will remove `shelljs` from other commands as well, and then we'll remove `shelljs` from our dependencies. ## Automation /test sanity ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11814325698> > Commit: 98261ee > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11814325698&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.Sanity` > Spec: > <hr>Wed, 13 Nov 2024 09:58:36 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Improved backup process with enhanced error handling and asynchronous checks for available disk space. - New function for executing commands with output capture added to utility functions. - **Bug Fixes** - Refined error messages for insufficient disk space and password mismatches during backup. - **Tests** - Expanded test suite for backup utilities and command execution, ensuring robust coverage of various scenarios. - **Documentation** - Updated formatting of numeric constants for better readability. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
- Loading branch information
Showing
5 changed files
with
48 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const { describe, test, expect } = require("@jest/globals"); | ||
const utils = require("./utils"); | ||
|
||
describe("execCommandSilent", () => { | ||
|
||
test("Runs a command", async () => { | ||
await utils.execCommandSilent(["echo"]); | ||
}); | ||
|
||
test("silences stdout and stderr", async () => { | ||
const consoleSpy = jest.spyOn(console, "log"); | ||
await utils.execCommandSilent(["node", "--eval", "console.log('test')"]); | ||
expect(consoleSpy).not.toHaveBeenCalled(); | ||
consoleSpy.mockRestore(); | ||
}); | ||
|
||
test("handles errors silently", async () => { | ||
await expect(utils.execCommandSilent(["nonexistentcommand"])) | ||
.rejects.toThrow(); | ||
}); | ||
|
||
}); |