global-jsdom 8.7.0 → 9.0.0
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/commonjs/register.cjs +4 -0
- package/package.json +20 -20
- package/types/index.d.ts +7 -0
- package/HISTORY.md +0 -188
- package/LICENSE +0 -22
- package/README.md +0 -131
- package/commonjs/register.js +0 -4
- /package/commonjs/{index.js → index.cjs} +0 -0
package/package.json
CHANGED
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "global-jsdom",
|
|
3
3
|
"description": "Enable DOM in Node.js",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "9.0.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "jonathan schatz",
|
|
7
7
|
"email": "jon@divisionbyzero.com",
|
|
8
8
|
"url": "https://github.com/modosc"
|
|
9
9
|
},
|
|
10
|
-
"type": "
|
|
11
|
-
"main": "./commonjs/index.js",
|
|
10
|
+
"type": "module",
|
|
12
11
|
"exports": {
|
|
13
12
|
".": {
|
|
14
|
-
"require": "./commonjs/index.
|
|
13
|
+
"require": "./commonjs/index.cjs",
|
|
15
14
|
"default": "./esm/index.mjs"
|
|
16
15
|
},
|
|
17
16
|
"./register": {
|
|
18
|
-
"require": "./commonjs/register.
|
|
17
|
+
"require": "./commonjs/register.cjs",
|
|
19
18
|
"default": "./esm/register.mjs"
|
|
20
19
|
}
|
|
21
20
|
},
|
|
22
21
|
"module": "./esm/index.mjs",
|
|
22
|
+
"main": "./commonjs/index.cjs",
|
|
23
|
+
"types": "types/index.d.ts",
|
|
23
24
|
"files": [
|
|
24
25
|
"commonjs/*",
|
|
25
|
-
"esm/*"
|
|
26
|
+
"esm/*",
|
|
27
|
+
"types/*"
|
|
26
28
|
],
|
|
27
29
|
"bugs": {
|
|
28
30
|
"url": "https://github.com/modosc/global-jsdom/issues"
|
|
@@ -31,13 +33,13 @@
|
|
|
31
33
|
"Rico Sta. Cruz <rico@ricostacruz.com>"
|
|
32
34
|
],
|
|
33
35
|
"devDependencies": {
|
|
34
|
-
"chai": "^4.
|
|
35
|
-
"eslint": "^8.
|
|
36
|
+
"chai": "^4.3.7",
|
|
37
|
+
"eslint": "^8.39.0",
|
|
36
38
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
37
|
-
"eslint-plugin-import": "^2.
|
|
39
|
+
"eslint-plugin-import": "^2.27.5",
|
|
38
40
|
"eslint-plugin-mocha": "^10.1.0",
|
|
39
|
-
"jsdom": "^
|
|
40
|
-
"mocha": "^10.
|
|
41
|
+
"jsdom": "^22.0.0",
|
|
42
|
+
"mocha": "^10.2.0"
|
|
41
43
|
},
|
|
42
44
|
"homepage": "https://github.com/modosc/global-jsdom#readme",
|
|
43
45
|
"keywords": [
|
|
@@ -47,22 +49,20 @@
|
|
|
47
49
|
],
|
|
48
50
|
"license": "MIT",
|
|
49
51
|
"peerDependencies": {
|
|
50
|
-
"jsdom": ">=
|
|
52
|
+
"jsdom": ">=22 <23"
|
|
51
53
|
},
|
|
52
54
|
"engines": {
|
|
53
|
-
"node": ">=
|
|
55
|
+
"node": ">=16"
|
|
54
56
|
},
|
|
55
57
|
"repository": {
|
|
56
58
|
"type": "git",
|
|
57
59
|
"url": "git+https://github.com/modosc/global-jsdom.git"
|
|
58
60
|
},
|
|
59
61
|
"scripts": {
|
|
60
|
-
"test": "yarn test:
|
|
61
|
-
"test:
|
|
62
|
-
"test:
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"lint": "yarn eslint --ext=js,mjs --cache .eslintrc.js examples/ commonjs/ esm/ test/ ",
|
|
66
|
-
"lint:fix": "yarn eslint --ext=js,mjs --cache --fix .eslintrc.js examples/ commonjs/ esm/ test/"
|
|
62
|
+
"test": "yarn test:esm && yarn test:commonjs",
|
|
63
|
+
"test:esm": "yarn mocha --require test/setup.mjs test/*.test.mjs",
|
|
64
|
+
"test:commonjs": "yarn mocha --require test/setup.cjs test/*.test.cjs",
|
|
65
|
+
"lint": "yarn eslint --ext=cjs,mjs --cache .eslintrc.cjs commonjs/ esm/ test/",
|
|
66
|
+
"lint:fix": "yarn eslint --ext=cjs,mjs --cache --fix .eslintrc.cjs commonjs/ esm/ test/"
|
|
67
67
|
}
|
|
68
68
|
}
|
package/types/index.d.ts
ADDED
package/HISTORY.md
DELETED
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
## [v8.7.0]
|
|
2
|
-
- Relax jsdom peer dependency for jsdom 21
|
|
3
|
-
- update deps
|
|
4
|
-
|
|
5
|
-
## [v8.6.0]
|
|
6
|
-
- (really) fix jsdom peerDep
|
|
7
|
-
- fix(perf): consolidate window key filtering https://github.com/modosc/global-jsdom/pull/256
|
|
8
|
-
- update semver for jsdom in peerDeps (fixes #245) https://github.com/modosc/global-jsdom/pull/259
|
|
9
|
-
- update actions/checkout@v3, actions/setup-node@v3, node-version: 16 https://github.com/modosc/global-jsdom/pull/258
|
|
10
|
-
- remove babel deps
|
|
11
|
-
|
|
12
|
-
## [v8.5.0]
|
|
13
|
-
- Relax jsdom peer dependency for jsdom 20
|
|
14
|
-
- Update deps
|
|
15
|
-
|
|
16
|
-
## [v8.4.0]
|
|
17
|
-
- Relax jsdom peer dependency for jsdom 19
|
|
18
|
-
- Update deps
|
|
19
|
-
|
|
20
|
-
## [v8.3.0]
|
|
21
|
-
- Relax jsdom peer dependency for jsdom 18
|
|
22
|
-
- Update deps
|
|
23
|
-
|
|
24
|
-
## [v8.2.0]
|
|
25
|
-
- Relax jsdom peer dependency for jsdom 17
|
|
26
|
-
|
|
27
|
-
## [v8.1.0]
|
|
28
|
-
- Fix jsdom peer dependency version specifier https://github.com/modosc/global-jsdom/pull/126
|
|
29
|
-
- Update deps
|
|
30
|
-
|
|
31
|
-
## [v8.0.0]
|
|
32
|
-
> Feb 10, 2021
|
|
33
|
-
|
|
34
|
-
- **BREAKING CHANGE** `babel` usage removed, Node v12 or greater is required
|
|
35
|
-
- **BREAKING CHANGE** `pretendToBeVisual` is enabled by default, see https://github.com/modosc/global-jsdom/issues/97
|
|
36
|
-
- **BREAKING CHANGE** ES2015 modules are now `.mjs` files, you may need to
|
|
37
|
-
[enable a node flag](https://nodejs.org/api/esm.html#esm_conditional_exports)
|
|
38
|
-
|
|
39
|
-
## [v5.0.0]
|
|
40
|
-
> Jul 14, 2019
|
|
41
|
-
|
|
42
|
-
- Handle jsdom 15
|
|
43
|
-
[v5.0.0]: https://github.com/modosc/global-jsdom/compare/v4.3.0...v5.0.0
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
## [v4.3.0]
|
|
47
|
-
> Jul 14, 2019
|
|
48
|
-
|
|
49
|
-
- Update deps
|
|
50
|
-
[v4.3.0]: https://github.com/modosc/global-jsdom/compare/v4.2.0...v4.3.0
|
|
51
|
-
|
|
52
|
-
## [v4.2.0]
|
|
53
|
-
> Oct 19, 2017
|
|
54
|
-
|
|
55
|
-
- Just kidding, use `global.$jsdom` instead.
|
|
56
|
-
[v4.2.0]: https://github.com/modosc/global-jsdom/compare/v4.1.0...v4.2.0
|
|
57
|
-
|
|
58
|
-
## [v4.1.0]
|
|
59
|
-
> Oct 18, 2017
|
|
60
|
-
|
|
61
|
-
- Don't clobber `global.jsdom`, use `global._jsdom` instead
|
|
62
|
-
[v4.1.0]: https://github.com/modosc/global-jsdom/compare/v4.0.0...v4.1.0
|
|
63
|
-
|
|
64
|
-
## [v8.3.0]
|
|
65
|
-
- Relax jsdom peer dependency for jsdom 18
|
|
66
|
-
- Update deps## [v4.0.0]
|
|
67
|
-
> Oct 18, 2017
|
|
68
|
-
|
|
69
|
-
- Update peerDeps for jsdom 11
|
|
70
|
-
- Add es module export
|
|
71
|
-
- Drop browserify support
|
|
72
|
-
- Add access to global.jsdom instance
|
|
73
|
-
[v4.0.0]: https://github.com/modosc/global-jsdom/compare/v3.0.2...v4.0.0
|
|
74
|
-
|
|
75
|
-
## [v3.0.2]
|
|
76
|
-
> May 8, 2017
|
|
77
|
-
|
|
78
|
-
- [#17] - Fix issue with `Image`. ([@jtag05])
|
|
79
|
-
- [#16] - Mark jsdom as a peer dependency. ([@Cinematique])
|
|
80
|
-
|
|
81
|
-
[v3.0.2]: https://github.com/modosc/global-jsdom/compare/v3.0.0...v3.0.2
|
|
82
|
-
|
|
83
|
-
## [v3.0.0]
|
|
84
|
-
> May 8, 2017
|
|
85
|
-
|
|
86
|
-
- [#23] - jsdom-global now requires jsdom v10. ([@GinjiBan])
|
|
87
|
-
|
|
88
|
-
[v3.0.0]: https://github.com/modosc/global-jsdom/compare/v2.1.1...v3.0.0
|
|
89
|
-
|
|
90
|
-
## [v2.1.1]
|
|
91
|
-
> Dec 24, 2016
|
|
92
|
-
|
|
93
|
-
- [#11] - Fix issues with XMLHttpRequest.
|
|
94
|
-
|
|
95
|
-
[v2.1.1]: https://github.com/modosc/global-jsdom/compare/v2.1.0...v2.1.1
|
|
96
|
-
|
|
97
|
-
## [v2.1.0]
|
|
98
|
-
> Aug 22, 2016
|
|
99
|
-
|
|
100
|
-
- [#6], [#7] - Fix support for jsdom 9.4.0.
|
|
101
|
-
|
|
102
|
-
[v2.1.0]: https://github.com/modosc/global-jsdom/compare/v2.0.0...v2.1.0
|
|
103
|
-
|
|
104
|
-
## [v2.0.0]
|
|
105
|
-
> May 13, 2016
|
|
106
|
-
|
|
107
|
-
- [#3] - Allow overriding `html` and `options` being passed to jsdom. ([#5], [@kenjiru])
|
|
108
|
-
- Deprecate the undocumented (and never-used) feature of calling `jsdom(function)`.
|
|
109
|
-
|
|
110
|
-
[v2.0.0]: https://github.com/modosc/global-jsdom/compare/v1.7.0...v2.0.0
|
|
111
|
-
|
|
112
|
-
## [v1.7.0]
|
|
113
|
-
> Mar 21, 2016
|
|
114
|
-
|
|
115
|
-
- Implement `jsdom-global/register` for use in simpler cases.
|
|
116
|
-
|
|
117
|
-
[v1.7.0]: https://github.com/modosc/global-jsdom/compare/v1.6.2...v1.7.0
|
|
118
|
-
|
|
119
|
-
## [v1.6.2]
|
|
120
|
-
> Feb 22, 2016
|
|
121
|
-
|
|
122
|
-
- Fix typo in browser.js.
|
|
123
|
-
|
|
124
|
-
[v1.6.2]: https://github.com/modosc/global-jsdom/compare/v1.6.1...v1.6.2
|
|
125
|
-
|
|
126
|
-
## [v1.6.1]
|
|
127
|
-
> Jan 15, 2016
|
|
128
|
-
|
|
129
|
-
- Make `jsdomGlobal()` idempotent - that is, you may call it twice and expect
|
|
130
|
-
the same result without any side effects.
|
|
131
|
-
|
|
132
|
-
[v1.6.1]: https://github.com/modosc/global-jsdom/compare/v1.5.0...v1.6.1
|
|
133
|
-
|
|
134
|
-
## [v1.5.0]
|
|
135
|
-
> Jan 12, 2016
|
|
136
|
-
|
|
137
|
-
- Remove tape integration... we don't need it.
|
|
138
|
-
|
|
139
|
-
[v1.5.0]: https://github.com/modosc/global-jsdom/compare/v1.4.0...v1.5.0
|
|
140
|
-
|
|
141
|
-
## [v1.4.0]
|
|
142
|
-
> Jan 12, 2016
|
|
143
|
-
|
|
144
|
-
- `tape`: Shows navigator userAgent in tape output.
|
|
145
|
-
|
|
146
|
-
[v1.4.0]: https://github.com/modosc/global-jsdom/compare/v1.3.0...v1.4.0
|
|
147
|
-
|
|
148
|
-
## [v1.3.0]
|
|
149
|
-
> Jan 11, 2016
|
|
150
|
-
|
|
151
|
-
- Add browserify support.
|
|
152
|
-
|
|
153
|
-
[v1.3.0]: https://github.com/modosc/global-jsdom/compare/v1.2.0...v1.3.0
|
|
154
|
-
|
|
155
|
-
## [v1.2.0]
|
|
156
|
-
> Jan 11, 2016
|
|
157
|
-
|
|
158
|
-
- Fix compatibility with legacy Node.js versions.
|
|
159
|
-
|
|
160
|
-
[v1.2.0]: https://github.com/modosc/global-jsdom/compare/v1.1.0...v1.2.0
|
|
161
|
-
|
|
162
|
-
## [v1.1.0]
|
|
163
|
-
> Jan 11, 2016
|
|
164
|
-
|
|
165
|
-
- Add `cleanup()`.
|
|
166
|
-
|
|
167
|
-
[v1.1.0]: https://github.com/modosc/global-jsdom/compare/v1.0.0...v1.1.0
|
|
168
|
-
|
|
169
|
-
## [v1.0.0]
|
|
170
|
-
> Jan 11, 2016
|
|
171
|
-
|
|
172
|
-
- Initial release.
|
|
173
|
-
|
|
174
|
-
[v1.0.0]: https://github.com/modosc/global-jsdom/tree/v1.0.0
|
|
175
|
-
[#3]: https://github.com/modosc/global-jsdom/issues/3
|
|
176
|
-
[#5]: https://github.com/modosc/global-jsdom/issues/5
|
|
177
|
-
[#6]: https://github.com/modosc/global-jsdom/issues/6
|
|
178
|
-
[#7]: https://github.com/modosc/global-jsdom/issues/7
|
|
179
|
-
[#2]: https://github.com/modosc/global-jsdom/issues/2
|
|
180
|
-
[#11]: https://github.com/modosc/global-jsdom/issues/11
|
|
181
|
-
[#16]: https://github.com/modosc/global-jsdom/issues/16
|
|
182
|
-
[#17]: https://github.com/modosc/global-jsdom/issues/17
|
|
183
|
-
[#23]: https://github.com/modosc/global-jsdom/issues/23
|
|
184
|
-
[@Cinematique]: https://github.com/Cinematique
|
|
185
|
-
[@GinjiBan]: https://github.com/GinjiBan
|
|
186
|
-
[@jtag05]: https://github.com/jtag05
|
|
187
|
-
[@kenjiru]: https://github.com/kenjiru
|
|
188
|
-
[@ngryman]: https://github.com/ngryman
|
package/LICENSE
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright for portions of global-jsdom are held by Rico Sta. Cruz, 2016 as part of
|
|
4
|
-
jsdom-global. All other copyright for global-jsdom are held by jonathan schatz, 2017.
|
|
5
|
-
|
|
6
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
in the Software without restriction, including without limitation the rights
|
|
9
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
furnished to do so, subject to the following conditions:
|
|
12
|
-
|
|
13
|
-
The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
copies or substantial portions of the Software.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
SOFTWARE.
|
package/README.md
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
# global-jsdom
|
|
2
|
-
[](https://www.npmjs.com/package/global-jsdom)
|
|
3
|
-

|
|
4
|
-
|
|
5
|
-
> Enables DOM in Node.js
|
|
6
|
-
`global-jsdom` will inject `document`, `window` and other DOM API into your Node.js environment. This allows you to run browser tests in Node.js. The specific attributes set on `global` come directly from the `jsdom` version you have installed.
|
|
7
|
-
## Install
|
|
8
|
-
|
|
9
|
-
Requires [node][] >= 12 and [jsdom][] >= 10 or above
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
npm install --save-dev --save-exact jsdom global-jsdom
|
|
13
|
-
```
|
|
14
|
-
[node]: https://github.com/nodejs/node
|
|
15
|
-
[jsdom]: https://github.com/tmpvar/jsdom
|
|
16
|
-
|
|
17
|
-
## Usage
|
|
18
|
-
|
|
19
|
-
Just invoke it to turn your Node.js environment into a DOM environment.
|
|
20
|
-
|
|
21
|
-
```js
|
|
22
|
-
// commonjs
|
|
23
|
-
require('global-jsdom/register')
|
|
24
|
-
|
|
25
|
-
// or es2015
|
|
26
|
-
import 'global-jsdom/register'
|
|
27
|
-
|
|
28
|
-
// you can now use the DOM
|
|
29
|
-
document.body.innerHTML = 'hello'
|
|
30
|
-
|
|
31
|
-
// you can also access the current jsdom instance through $jsdom
|
|
32
|
-
global.$jsdom.reconfigure({})
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## Configuration
|
|
36
|
-
You may pass configuration parameters to `jsdom` like so:
|
|
37
|
-
```js
|
|
38
|
-
// commonjs
|
|
39
|
-
const globalJsdom = require('global-jsdom')
|
|
40
|
-
|
|
41
|
-
// or es2015
|
|
42
|
-
import globalJsdom from 'global-jsdom'
|
|
43
|
-
|
|
44
|
-
// then
|
|
45
|
-
globalJsdom(html, options)
|
|
46
|
-
```
|
|
47
|
-
Check the [jsdom.jsdom()][] documentation for valid values for the `options`
|
|
48
|
-
parameter.
|
|
49
|
-
|
|
50
|
-
### Default Options
|
|
51
|
-
The following set of default options are passed to `jsdom`
|
|
52
|
-
```js
|
|
53
|
-
{
|
|
54
|
-
// if url isn't set then localStorage breaks with a cryptic error, see
|
|
55
|
-
// https://github.com/jsdom/jsdom/issues/2304#issuecomment-408320484
|
|
56
|
-
url: 'http://localhost:3000',
|
|
57
|
-
// pretendToBeVisual is enabled so that react works, see
|
|
58
|
-
// https://github.com/jsdom/jsdom#pretending-to-be-a-visual-browser
|
|
59
|
-
pretendToBeVisual: true,
|
|
60
|
-
}
|
|
61
|
-
```
|
|
62
|
-
### Cleanup
|
|
63
|
-
To clean up the global namespace just invoke the returned function:
|
|
64
|
-
```js
|
|
65
|
-
// commonjs
|
|
66
|
-
const cleanup = require('global-jsdom')()
|
|
67
|
-
|
|
68
|
-
// es2015
|
|
69
|
-
import globalJsdom from 'global-jsdom'
|
|
70
|
-
const cleanup = globalJsdom()
|
|
71
|
-
|
|
72
|
-
// do things, then
|
|
73
|
-
cleanup()
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
## Tape
|
|
77
|
-
|
|
78
|
-
In [tape][], run it before your other tests.
|
|
79
|
-
|
|
80
|
-
```js
|
|
81
|
-
require('global-jsdom/register')
|
|
82
|
-
|
|
83
|
-
test('your tests', (t) => {
|
|
84
|
-
/* and so on... */
|
|
85
|
-
})
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
## Mocha
|
|
89
|
-
|
|
90
|
-
__Simple:__ Use Mocha's `--require` option. Add this to the `test/mocha.opts` file (create it if it doesn't exist)
|
|
91
|
-
|
|
92
|
-
```
|
|
93
|
-
-r global-jsdom/register
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
__Advanced:__ For finer control, you can instead add it via [mocha]'s `before` and `after` hooks.
|
|
97
|
-
|
|
98
|
-
```js
|
|
99
|
-
before(function () {
|
|
100
|
-
this.jsdom = require('global-jsdom')()
|
|
101
|
-
})
|
|
102
|
-
|
|
103
|
-
after(function () {
|
|
104
|
-
this.jsdom()
|
|
105
|
-
})
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
[tape]: https://github.com/substack/tape
|
|
109
|
-
[mocha]: https://mochajs.org/
|
|
110
|
-
[jsdom.jsdom()]: https://github.com/tmpvar/jsdom/#for-the-hardcore-jsdomjsdom
|
|
111
|
-
|
|
112
|
-
## ES2015
|
|
113
|
-
|
|
114
|
-
If you're using a [recent version of
|
|
115
|
-
node](https://nodejs.org/api/esm.html#esm_conditional_exports) then `import` should
|
|
116
|
-
just work:
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
```js
|
|
120
|
-
import 'global-jsdom/register'
|
|
121
|
-
import React from 'react'
|
|
122
|
-
import jQuery from 'jquery'
|
|
123
|
-
// ...
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
## Migration from `jsdom-global`
|
|
127
|
-
1. `browserify` support is dropped - I have no way to test this and `webpack` started giving higher priority to the `browser` field in `package.json` than `module`
|
|
128
|
-
|
|
129
|
-
## Thanks
|
|
130
|
-
|
|
131
|
-
original code forked from [jsdom-global](https://github.com/rstacruz/jsdom-global)
|
package/commonjs/register.js
DELETED
|
File without changes
|