Skip to content
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

chore(shell-api): use strict TS config for testing #2105

Merged
merged 3 commits into from
Jul 30, 2024

Conversation

addaleax
Copy link
Contributor

No description provided.


beforeEach(function () {
config = instanceState.context.config;
config = instanceState.shellApi.config;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if all the previous assertions were running on instanceState.context, i expect either them to be wrong/fail or something i am not able to follow.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, these are the same objects, except that using .shellApi instead of .context makes this typesafe

.context is the global object in which shell commands are being executed, it more or less has to be typed as any, and properties from .shellApi are just copied over to it:

this.context = contextObject;
Object.assign(contextObject, this.shellApi);

Copy link
Member

@Anemy Anemy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!!

@addaleax addaleax merged commit 4f9f6bf into main Jul 30, 2024
68 of 71 checks passed
@addaleax addaleax deleted the strict-ts-shell-api-sp branch July 30, 2024 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants