From 19aca36fab66d8003cf8bdcbc3ecd067a1cf1814 Mon Sep 17 00:00:00 2001 From: Christian Bromann Date: Fri, 6 Dec 2024 10:39:02 -0300 Subject: [PATCH 1/2] fix(mock-doc): don't show error message for SSR workflows --- src/mock-doc/node.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/mock-doc/node.ts b/src/mock-doc/node.ts index da8f2ad8143..a4e49be049a 100644 --- a/src/mock-doc/node.ts +++ b/src/mock-doc/node.ts @@ -234,10 +234,15 @@ export class MockElement extends MockNode { attachInternals(): MockElementInternals { return new Proxy({} as unknown as MockElementInternals, { get: function (_target, prop, _receiver) { - console.error( - `NOTE: Property ${String(prop)} was accessed on ElementInternals, but this property is not implemented. -Testing components with ElementInternals is fully supported in e2e tests.`, - ); + /** + * only print warning when running in a test environment + */ + if ('process' in globalThis && globalThis.process.env.__STENCIL_SPEC_TESTS__) { + console.error( + `NOTE: Property ${String(prop)} was accessed on ElementInternals, but this property is not implemented. + Testing components with ElementInternals is fully supported in e2e tests.` + ); + } }, }); } From dd3e2aa1996618d8effc31c1a757b3eb2e72bf5a Mon Sep 17 00:00:00 2001 From: Christian Bromann Date: Tue, 10 Dec 2024 15:52:08 -0300 Subject: [PATCH 2/2] prettier --- src/mock-doc/node.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mock-doc/node.ts b/src/mock-doc/node.ts index a4e49be049a..6c25b8c55c1 100644 --- a/src/mock-doc/node.ts +++ b/src/mock-doc/node.ts @@ -240,7 +240,7 @@ export class MockElement extends MockNode { if ('process' in globalThis && globalThis.process.env.__STENCIL_SPEC_TESTS__) { console.error( `NOTE: Property ${String(prop)} was accessed on ElementInternals, but this property is not implemented. - Testing components with ElementInternals is fully supported in e2e tests.` + Testing components with ElementInternals is fully supported in e2e tests.`, ); } },