@mediatool/frontend-tools 1.3.2 → 1.3.3

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 CHANGED
@@ -84,7 +84,7 @@ function build (type) {
84
84
 
85
85
  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)));
86
86
  const mochaCliPath = require$1.resolve('mocha/lib/cli/cli.js');
87
- const domShimsPath = require$1.resolve('@mediatool/frontend-tools/lib/test/dom-shims.cjs');
87
+ const requireFilePath = require$1.resolve('@mediatool/frontend-tools/lib/test/require.cjs');
88
88
 
89
89
  const extensions = '{js,jsx,ts,tsx}';
90
90
  const types = {
@@ -101,9 +101,7 @@ async function test (typeOrSpec) {
101
101
  mochaCliPath,
102
102
  spec,
103
103
  '--require',
104
- 'global-jsdom/register',
105
- '--require',
106
- domShimsPath,
104
+ requireFilePath,
107
105
  ];
108
106
 
109
107
  const mochaProcess = child_process.spawn(process.execPath, args, { stdio: 'inherit' });
package/lib/test/index.js CHANGED
@@ -3,7 +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
+ const requireFilePath = require.resolve('@mediatool/frontend-tools/lib/test/require.cjs')
7
7
 
8
8
  const extensions = '{js,jsx,ts,tsx}'
9
9
  const types = {
@@ -20,9 +20,7 @@ export default async function test (typeOrSpec) {
20
20
  mochaCliPath,
21
21
  spec,
22
22
  '--require',
23
- 'global-jsdom/register',
24
- '--require',
25
- domShimsPath,
23
+ requireFilePath,
26
24
  ]
27
25
 
28
26
  const mochaProcess = spawn(process.execPath, args, { stdio: 'inherit' })
@@ -1,5 +1,7 @@
1
+ require('global-jsdom/register')
2
+
1
3
  if (typeof window !== 'undefined' && !window.matchMedia) {
2
- window.matchMedia = function(query) {
4
+ window.matchMedia = function (query) {
3
5
  return {
4
6
  matches: false,
5
7
  media: query,
@@ -8,7 +10,11 @@ if (typeof window !== 'undefined' && !window.matchMedia) {
8
10
  removeListener: function() {},
9
11
  addEventListener: function() {},
10
12
  removeEventListener: function() {},
11
- dispatchEvent: function() { return true; }
12
- };
13
- };
13
+ dispatchEvent: function() { return true },
14
+ }
15
+ }
14
16
  }
17
+
18
+ require.extensions['.css'] = function () {
19
+ return undefined
20
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mediatool/frontend-tools",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
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/dom-shims.cjs": "./lib/test/dom-shims.cjs"
12
+ "./lib/test/require.cjs": "./lib/test/require.cjs"
13
13
  },
14
14
  "scripts": {
15
15
  "build": "rm -rf dist && rollup -c rollup.config.js",