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

fix(svelte): default mount log to true #23771

Merged
merged 3 commits into from Sep 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion npm/svelte/src/mount.ts
Expand Up @@ -76,7 +76,7 @@ export function mount<T extends SvelteComponent> (
// by waiting, we are delaying test execution for the next tick of event loop
// and letting hooks and component lifecycle methods to execute mount
return cy.wait(0, { log: false }).then(() => {
if (options.log) {
if (options.log !== false) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice, all our adapters do this - this could be part of GA, the standard API that adapters must comply with. Part of that could be logging the component name, and we could enforce it via an interface or something.

const mountMessage = `<${getComponentDisplayName(Component)} ... />`

Cypress.log({
Expand Down
30 changes: 30 additions & 0 deletions system-tests/project-fixtures/svelte/src/mount.cy.js
Expand Up @@ -53,4 +53,34 @@ describe("Svelte mount", () => {
cy.then(() => messageStore.set("Written from spec"));
cy.contains("h1", "Written from spec");
});

context("log", () => {
it("displays component name in mount log", () => {
cy.mount(Counter);

cy.wrap(Cypress.$(window.top.document.body)).within(() =>
cy
.contains("displays component name in mount log")
.closest(".collapsible")
.click()
.within(() =>
cy
.get(".command-name-mount")
.should("contain", "mount<Counter ... />")
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it would be helpful for future us to add a comment detailing the fact there is no space here purposefully, but I'm not too concerned with it.

)
);
});

it("does not display mount log", () => {
cy.mount(Counter, { log: false });

cy.wrap(Cypress.$(window.top.document.body)).within(() =>
cy
.contains("does not display mount log")
.closest(".collapsible")
.click()
.within(() => cy.get(".command-name-mount").should("not.exist"))
);
});
});
});