@mediatool/frontend-tools 1.3.0 → 1.3.1
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/dist/mtft.cjs +3 -0
- package/lib/test/dom-shims.cjs +14 -0
- package/lib/test/index.js +3 -0
- package/package.json +2 -2
package/dist/mtft.cjs
CHANGED
|
@@ -68,6 +68,7 @@ function build (type) {
|
|
|
68
68
|
|
|
69
69
|
const require$1 = module$1.createRequire((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('mtft.cjs', document.baseURI).href)));
|
|
70
70
|
const mochaCliPath = require$1.resolve('mocha/lib/cli/cli.js');
|
|
71
|
+
const domShimsPath = require$1.resolve('@mediatool/frontend-tools/lib/test/dom-shims.cjs');
|
|
71
72
|
|
|
72
73
|
const extensions = '{js,jsx,ts,tsx}';
|
|
73
74
|
const types = {
|
|
@@ -85,6 +86,8 @@ async function test (typeOrSpec) {
|
|
|
85
86
|
spec,
|
|
86
87
|
'--require',
|
|
87
88
|
'global-jsdom/register',
|
|
89
|
+
'--require',
|
|
90
|
+
domShimsPath,
|
|
88
91
|
];
|
|
89
92
|
|
|
90
93
|
const mochaProcess = child_process.spawn(process.execPath, args, { stdio: 'inherit' });
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
if (typeof window !== 'undefined' && !window.matchMedia) {
|
|
2
|
+
window.matchMedia = function(query) {
|
|
3
|
+
return {
|
|
4
|
+
matches: false,
|
|
5
|
+
media: query,
|
|
6
|
+
onchange: null,
|
|
7
|
+
addListener: function () {},
|
|
8
|
+
removeListener: function() {},
|
|
9
|
+
addEventListener: function() {},
|
|
10
|
+
removeEventListener: function() {},
|
|
11
|
+
dispatchEvent: function() { return true; }
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
}
|
package/lib/test/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import { spawn } from 'child_process'
|
|
|
3
3
|
|
|
4
4
|
const require = createRequire(import.meta.url)
|
|
5
5
|
const mochaCliPath = require.resolve('mocha/lib/cli/cli.js')
|
|
6
|
+
const domShimsPath = require.resolve('@mediatool/frontend-tools/lib/test/dom-shims.cjs')
|
|
6
7
|
|
|
7
8
|
const extensions = '{js,jsx,ts,tsx}'
|
|
8
9
|
const types = {
|
|
@@ -20,6 +21,8 @@ export default async function test (typeOrSpec) {
|
|
|
20
21
|
spec,
|
|
21
22
|
'--require',
|
|
22
23
|
'global-jsdom/register',
|
|
24
|
+
'--require',
|
|
25
|
+
domShimsPath,
|
|
23
26
|
]
|
|
24
27
|
|
|
25
28
|
const mochaProcess = spawn(process.execPath, args, { stdio: 'inherit' })
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mediatool/frontend-tools",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Common configs and tooling for bundling, testing, linting frontend modules",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
".": "./dist/utils.js",
|
|
10
10
|
"./assertions": "./dist/assertions.js",
|
|
11
11
|
"./react": "./dist/react.js",
|
|
12
|
-
"./lib/test/
|
|
12
|
+
"./lib/test/dom-shims.cjs": "./lib/test/dom-shims.cjs"
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
15
|
"build": "rm -rf dist && rollup -c rollup.config.js",
|