Skip to content

Commit 8eece7c

Browse files
committed
test(wtr): move util into only file that uses it
1 parent f729461 commit 8eece7c

File tree

2 files changed

+23
-24
lines changed

2 files changed

+23
-24
lines changed

packages/@lwc/integration-not-karma/configs/plugins/test-hydration.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import { spyOn } from '@vitest/spy';
12
import * as LWC from 'lwc';
2-
import { spyConsole } from '../../helpers/console';
33
import { setHooks } from '../../helpers/hooks';
44

55
setHooks({ sanitizeHtmlContent: (content) => content });
@@ -8,6 +8,28 @@ function parseStringToDom(html) {
88
return Document.parseHTMLUnsafe(html).body.firstChild;
99
}
1010

11+
/**
12+
* A much simplified version of the spies originally used for Karma.
13+
* Should probably be eventually replaced with individual spies.
14+
*/
15+
export function spyConsole() {
16+
const log = spyOn(console, 'log');
17+
const warn = spyOn(console, 'warn');
18+
const error = spyOn(console, 'error');
19+
return {
20+
calls: {
21+
log: log.mock.calls,
22+
warn: warn.mock.calls,
23+
error: error.mock.calls,
24+
},
25+
reset() {
26+
log.mockRestore();
27+
warn.mockRestore();
28+
error.mockRestore();
29+
},
30+
};
31+
}
32+
1133
function appendTestTarget(ssrText) {
1234
const div = document.createElement('div');
1335
const testTarget = parseStringToDom(ssrText);

packages/@lwc/integration-not-karma/helpers/console.js

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)