-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test(cli): add unit tests for CredentialsStorage functionality #1401
test(cli): add unit tests for CredentialsStorage functionality #1401
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
@spirulence is attempting to deploy a commit to the Codemod Team on Vercel. A member of the Team first needs to authorize it. |
npx vitest --coverage 130 ↵ ──(Wed,Dec04)─┘
DEV v1.6.0 /home/developer/gitclone/codemod/apps/cli
Coverage enabled with v8
stderr | test/credentialsStorage.test.ts > CredentialsStorage > when .codemod directory does not exist > should return null without throwing an error
Error: libsecret-1.so.0: cannot open shared object file: No such file or directory
Codemod CLI uses "keytar" to store your credentials securely.
Please make sure you have "libsecret" installed on your system.
Depending on your distribution, you will need to run the following command
Debian/Ubuntu: sudo apt-get install libsecret-1-dev
Fedora: sudo dnf install libsecret
Arch Linux: sudo pacman -S libsecret
If you were not able to install the necessary package or CLI was not able to detect the installation please reach out to us at our Community Slack channel.
You can still use the CLI with file-based replacement that will store your credentials at your home directory.
✓ test/credentialsStorageKeytar.test.ts (4)
✓ test/credentialsStorage.test.ts (4)
Test Files 2 passed (2)
Tests 8 passed (8)
Start at 22:57:18
Duration 2.04s (transform 448ms, setup 73ms, collect 2.48s, tests 96ms, environment 1ms, prepare 470ms)
% Coverage report from v8
--------------------------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
--------------------------|---------|----------|---------|---------|-------------------
All files | 3.3 | 43.1 | 26.82 | 3.3 |
cli | 0 | 0 | 0 | 0 |
build.js | 0 | 0 | 0 | 0 | 1-107
cli/src | 5.77 | 62.5 | 47.82 | 5.77 |
api.ts | 0 | 0 | 0 | 0 | 1-260
auth-utils.ts | 0 | 0 | 0 | 0 | 1-170
credentials-storage.ts | 99.27 | 89.28 | 100 | 99.27 | 98
dryrun-diff.ts | 0 | 0 | 0 | 0 | 1-108
fetch-codemod.ts | 0 | 0 | 0 | 0 | 1-325
flags.ts | 0 | 0 | 0 | 0 | 1-164
git.ts | 0 | 0 | 0 | 0 | 1-105
index.ts | 0 | 0 | 0 | 0 | 1-26
install-dependencies.ts | 0 | 0 | 0 | 0 | 1-367
main.ts | 0 | 0 | 0 | 0 | 1-357
safe-arguments.ts | 0 | 0 | 0 | 0 | 1-144
telemetry.ts | 0 | 0 | 0 | 0 | 1-75
worker.ts | 0 | 0 | 0 | 0 | 1-134
cli/src/commands | 0 | 0 | 0 | 0 |
feedback.ts | 0 | 0 | 0 | 0 | 1-17
init.ts | 0 | 0 | 0 | 0 | 1-246
learn.ts | 0 | 0 | 0 | 0 | 1-276
list.ts | 0 | 0 | 0 | 0 | 1-132
login.ts | 0 | 0 | 0 | 0 | 1-71
logout.ts | 0 | 0 | 0 | 0 | 1-31
publish.ts | 0 | 0 | 0 | 0 | 1-356
run.ts | 0 | 0 | 0 | 0 | 1-362
unpublish.ts | 0 | 0 | 0 | 0 | 1-64
whoami.ts | 0 | 0 | 0 | 0 | 1-37
cli/src/services | 0 | 0 | 0 | 0 |
auth-service.ts | 0 | 0 | 0 | 0 | 1-75
runner-service.ts | 0 | 0 | 0 | 0 | 1-136
cli/src/utils | 6.52 | 0 | 0 | 6.52 |
constants.ts | 100 | 100 | 100 | 100 |
detectCodemodEngine.ts | 0 | 0 | 0 | 0 | 1-10
download.ts | 0 | 0 | 0 | 0 | 1-37
general.ts | 0 | 0 | 0 | 0 | 1-22
logs.ts | 0 | 0 | 0 | 0 | 1-46
open.ts | 0 | 0 | 0 | 0 | 1-14
--------------------------|---------|----------|---------|---------|------------------- |
@all-contributors add @spirulence for code |
I've put up a pull request to add @spirulence! 🎉 |
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
7f3474e
into
codemod-com:codemod/handle-open-error
* fix(cli): when error opening a link - show it in console * fix: when coder env variable is set - print open url * fix: ensure shim for keytar works * fix: show url in cli * fix: print url * chore: Bump codemod cli * test(cli): add unit tests for CredentialsStorage functionality (#1401) * test(cli): add unit tests for CredentialsStorage functionality * test(cli): expand unit test coverage of credentialsStorage + keytar --------- Co-authored-by: Cameron Seebach <[email protected]>
Introduce unit tests to verify the behavior of the CredentialsStorage class, including:
getting credentials:
setting credentials:
deleting credentials:
as well as that warnings are emitted when keytar is not available
As @arybitskiy just did a bunch of work here, this PR is against his PR #1385 and can be merged along with that work.