vitest 0.0.19 → 0.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -156,8 +156,8 @@ describe('suite', () => {
156
156
  - [x] Mock
157
157
  - [x] Global Mode & Types
158
158
  - [ ] Parallel Executing
159
- - [ ] CLI Help
160
- - [ ] JSDom
159
+ - [ ] CLI Help (Use yargs)
160
+ - [x] JSDom
161
161
  - [ ] Watch
162
162
  - [ ] Source Map
163
163
  - [ ] Coverage
@@ -19,7 +19,7 @@ export function JestChaiExpect() {
19
19
  const obj = utils.flag(this, 'object');
20
20
  this.assert(Boolean(obj), 'expected #{this} to be truthy', 'expected #{this} to not be truthy', obj);
21
21
  });
22
- utils.addMethod(proto, 'toFalsy', function () {
22
+ utils.addMethod(proto, 'toBeFalsy', function () {
23
23
  const obj = utils.flag(this, 'object');
24
24
  this.assert(!obj, 'expected #{this} to be falsy', 'expected #{this} to not be falsy', obj);
25
25
  });
@@ -1,4 +1,5 @@
1
1
  import { JSDOM } from 'jsdom';
2
+ import { KEYS } from './keys';
2
3
  export function setupJSDOM(global) {
3
4
  const dom = new JSDOM('<!DOCTYPE html>', {
4
5
  pretendToBeVisual: true,
@@ -6,7 +7,7 @@ export function setupJSDOM(global) {
6
7
  // TODO: options
7
8
  url: 'http://localhost:3000',
8
9
  });
9
- const keys = Object.getOwnPropertyNames(dom.window)
10
+ const keys = KEYS.concat(Object.getOwnPropertyNames(dom.window))
10
11
  .filter(k => !k.startsWith('_'))
11
12
  .filter(k => !(k in global));
12
13
  for (const key of keys)
@@ -0,0 +1 @@
1
+ export declare const KEYS: string[];
@@ -0,0 +1,187 @@
1
+ // SEE https://github.com/jsdom/jsdom/blob/master/lib/jsdom/living/interfaces.js
2
+ const LIVING_KEYS = [
3
+ 'DOMException',
4
+ 'NamedNodeMap',
5
+ 'Attr',
6
+ 'Node',
7
+ 'Element',
8
+ 'DocumentFragment',
9
+ 'HTMLDocument',
10
+ 'Document',
11
+ 'CharacterData',
12
+ 'Comment',
13
+ 'DocumentType',
14
+ 'DOMImplementation',
15
+ 'ProcessingInstruction',
16
+ 'Image',
17
+ 'Text',
18
+ 'Event',
19
+ 'CustomEvent',
20
+ 'MessageEvent',
21
+ 'ErrorEvent',
22
+ 'HashChangeEvent',
23
+ 'PopStateEvent',
24
+ 'UIEvent',
25
+ 'MouseEvent',
26
+ 'KeyboardEvent',
27
+ 'TouchEvent',
28
+ 'ProgressEvent',
29
+ 'EventTarget',
30
+ 'Location',
31
+ 'History',
32
+ 'HTMLElement',
33
+ 'HTMLAnchorElement',
34
+ 'HTMLAppletElement',
35
+ 'HTMLAreaElement',
36
+ 'HTMLAudioElement',
37
+ 'HTMLBaseElement',
38
+ 'HTMLBodyElement',
39
+ 'HTMLBRElement',
40
+ 'HTMLButtonElement',
41
+ 'HTMLCanvasElement',
42
+ 'HTMLDataElement',
43
+ 'HTMLDataListElement',
44
+ 'HTMLDialogElement',
45
+ 'HTMLDirectoryElement',
46
+ 'HTMLDivElement',
47
+ 'HTMLDListElement',
48
+ 'HTMLEmbedElement',
49
+ 'HTMLFieldSetElement',
50
+ 'HTMLFontElement',
51
+ 'HTMLFormElement',
52
+ 'HTMLFrameElement',
53
+ 'HTMLFrameSetElement',
54
+ 'HTMLHeadingElement',
55
+ 'HTMLHeadElement',
56
+ 'HTMLHRElement',
57
+ 'HTMLHtmlElement',
58
+ 'HTMLIFrameElement',
59
+ 'HTMLImageElement',
60
+ 'HTMLInputElement',
61
+ 'HTMLLabelElement',
62
+ 'HTMLLegendElement',
63
+ 'HTMLLIElement',
64
+ 'HTMLLinkElement',
65
+ 'HTMLMapElement',
66
+ 'HTMLMediaElement',
67
+ 'HTMLMenuElement',
68
+ 'HTMLMetaElement',
69
+ 'HTMLMeterElement',
70
+ 'HTMLModElement',
71
+ 'HTMLObjectElement',
72
+ 'HTMLOListElement',
73
+ 'HTMLOptGroupElement',
74
+ 'HTMLOptionElement',
75
+ 'HTMLOutputElement',
76
+ 'HTMLParagraphElement',
77
+ 'HTMLParamElement',
78
+ 'HTMLPreElement',
79
+ 'HTMLProgressElement',
80
+ 'HTMLQuoteElement',
81
+ 'HTMLScriptElement',
82
+ 'HTMLSelectElement',
83
+ 'HTMLSourceElement',
84
+ 'HTMLSpanElement',
85
+ 'HTMLStyleElement',
86
+ 'HTMLTableCaptionElement',
87
+ 'HTMLTableCellElement',
88
+ 'HTMLTableColElement',
89
+ 'HTMLTableDataCellElement',
90
+ 'HTMLTableElement',
91
+ 'HTMLTableHeaderCellElement',
92
+ 'HTMLTimeElement',
93
+ 'HTMLTitleElement',
94
+ 'HTMLTableRowElement',
95
+ 'HTMLTableSectionElement',
96
+ 'HTMLTemplateElement',
97
+ 'HTMLTextAreaElement',
98
+ 'HTMLTrackElement',
99
+ 'HTMLUListElement',
100
+ 'HTMLUnknownElement',
101
+ 'HTMLVideoElement',
102
+ 'StyleSheet',
103
+ 'MediaList',
104
+ 'CSSStyleSheet',
105
+ 'CSSRule',
106
+ 'CSSStyleRule',
107
+ 'CSSMediaRule',
108
+ 'CSSImportRule',
109
+ 'CSSStyleDeclaration',
110
+ 'StyleSheetList',
111
+ 'XPathException',
112
+ 'XPathExpression',
113
+ 'XPathResult',
114
+ 'XPathEvaluator',
115
+ 'HTMLCollection',
116
+ 'NodeFilter',
117
+ 'NodeIterator',
118
+ 'NodeList',
119
+ 'Blob',
120
+ 'File',
121
+ 'FileList',
122
+ 'FormData',
123
+ 'XMLHttpRequest',
124
+ 'XMLHttpRequestEventTarget',
125
+ 'XMLHttpRequestUpload',
126
+ 'DOMTokenList',
127
+ 'URL',
128
+ ];
129
+ const OTHER_KEYS = [
130
+ 'addEventListener',
131
+ 'alert',
132
+ 'atob',
133
+ 'blur',
134
+ 'btoa',
135
+ /* 'clearInterval', */
136
+ /* 'clearTimeout', */
137
+ 'close',
138
+ 'confirm',
139
+ /* 'console', */
140
+ 'createPopup',
141
+ 'dispatchEvent',
142
+ 'document',
143
+ 'focus',
144
+ 'frames',
145
+ 'getComputedStyle',
146
+ 'history',
147
+ 'innerHeight',
148
+ 'innerWidth',
149
+ 'length',
150
+ 'location',
151
+ 'moveBy',
152
+ 'moveTo',
153
+ 'name',
154
+ 'navigator',
155
+ 'open',
156
+ 'outerHeight',
157
+ 'outerWidth',
158
+ 'pageXOffset',
159
+ 'pageYOffset',
160
+ 'parent',
161
+ 'postMessage',
162
+ 'print',
163
+ 'prompt',
164
+ 'removeEventListener',
165
+ 'resizeBy',
166
+ 'resizeTo',
167
+ 'screen',
168
+ 'screenLeft',
169
+ 'screenTop',
170
+ 'screenX',
171
+ 'screenY',
172
+ 'scroll',
173
+ 'scrollBy',
174
+ 'scrollLeft',
175
+ 'scrollTo',
176
+ 'scrollTop',
177
+ 'scrollX',
178
+ 'scrollY',
179
+ 'self',
180
+ /* 'setInterval', */
181
+ /* 'setTimeout', */
182
+ 'stop',
183
+ /* 'toString', */
184
+ 'top',
185
+ 'window',
186
+ ];
187
+ export const KEYS = LIVING_KEYS.concat(OTHER_KEYS);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitest",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/antfu/vitest#readme",