File tree Expand file tree Collapse file tree 2 files changed +23
-24
lines changed
packages/@lwc/integration-not-karma Expand file tree Collapse file tree 2 files changed +23
-24
lines changed Original file line number Diff line number Diff line change 1+ import { spyOn } from '@vitest/spy' ;
12import * as LWC from 'lwc' ;
2- import { spyConsole } from '../../helpers/console' ;
33import { setHooks } from '../../helpers/hooks' ;
44
55setHooks ( { 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+
1133function appendTestTarget ( ssrText ) {
1234 const div = document . createElement ( 'div' ) ;
1335 const testTarget = parseStringToDom ( ssrText ) ;
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments