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: running tests should create workspace-settings #579

Merged
merged 3 commits into from
Dec 22, 2024

Conversation

Skn0tt
Copy link
Member

@Skn0tt Skn0tt commented Dec 18, 2024

We store settings like activated projects in pw.workspace-settings. But we only write to it if it's modified, which means that users who never change anything about them don't get their settings stored. If we ever change the default settings, this means their workflows + muscle memory will be broken. Not good!

To prevent that from happening, this PR makes us saveSettings() before every test run. It also adds some tests to cover that.

@Skn0tt Skn0tt self-assigned this Dec 18, 2024

Choose a reason for hiding this comment

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

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

src/extension.ts Outdated
@@ -129,6 +129,7 @@ export class Extension implements RunHooks {
}

async onWillRunTests(config: TestConfig, debug: boolean) {
this._models.onWillRunTests();
Copy link
Member

Choose a reason for hiding this comment

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

This one is a little funny because embedder (extension) notifies model collection that a model called the embedder and notified it about the runTests event. I would call collection.saveSettings right where the model runs tests instead to save on the indirection.

Copy link
Member Author

Choose a reason for hiding this comment

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

It is! Didn't feel like I could just remove the private, so I added some indirection. But it looks like TestModel also calls TestModelCollection#_modelUpdated, so they trust one another. Made the change!

@Skn0tt Skn0tt merged commit 2b5464f into microsoft:main Dec 22, 2024
4 of 6 checks passed
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.

2 participants