-
Notifications
You must be signed in to change notification settings - Fork 304
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7206 from mook-as/path-management/rename-on-write
Path management: rename files in place where possible
- Loading branch information
Showing
9 changed files
with
490 additions
and
180 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
390 changes: 295 additions & 95 deletions
390
pkg/rancher-desktop/integrations/__tests__/manageLinesInFile.spec.ts
Large diffs are not rendered by default.
Oops, something went wrong.
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,21 @@ | ||
// `Symbol.dispose` exists as of NodeJS 20; if it's unset, set it (because we | ||
// are currently on NodeJS 18). | ||
(Symbol as any).dispose ??= Symbol.for('nodejs.dispose'); | ||
|
||
/** | ||
* Given a Jest SpyInstance, return it as a Disposable such that mockRestore will | ||
* be called when the instance goes out of scope. | ||
* @note This will no longer be needed as of Jest 30 (where it's built in). | ||
*/ | ||
export function withResource< | ||
T = any, | ||
Y extends any[] = any, | ||
C = any, | ||
U extends jest.MockInstance<T, Y, C> = any, | ||
>(input: U): U & Disposable { | ||
(input as any)[Symbol.dispose] = () => { | ||
input.mockRestore(); | ||
}; | ||
|
||
return input as U & Disposable; | ||
} |
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
Oops, something went wrong.