@elliemae/pui-cli 6.0.0-beta.4 → 6.0.0-beta.40

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.
Files changed (43) hide show
  1. package/lib/cli-commands/pack.js +1 -1
  2. package/lib/cli-commands/test.js +1 -12
  3. package/lib/cli-commands/tsc.js +103 -0
  4. package/lib/cli-commands/utils.js +9 -4
  5. package/lib/cli-commands/vitest.js +66 -0
  6. package/lib/cli.js +2 -0
  7. package/lib/lint/eslint/common.js +12 -7
  8. package/lib/lint/eslint/typescript/common.js +6 -1
  9. package/lib/lint/eslint/typescript/non-react.js +1 -1
  10. package/lib/lint/eslint/typescript/react.js +6 -1
  11. package/lib/lint/lint-staged.config.js +8 -1
  12. package/lib/pui-config/index.js +18 -0
  13. package/lib/server/index.js +5 -9
  14. package/lib/server/middlewares/addDevMiddlewares.js +2 -2
  15. package/lib/server/middlewares/addProdMiddlewares.js +10 -3
  16. package/lib/testing/jest.config.js +26 -7
  17. package/lib/testing/mocks/matchMedia.js +12 -6
  18. package/lib/testing/mocks/pui-app-loader.js +1 -3
  19. package/lib/testing/mocks/pui-diagnostics.js +27 -35
  20. package/lib/testing/mocks/pui-user-monitoring.js +3 -5
  21. package/lib/testing/mocks/retry-axios.js +3 -5
  22. package/lib/testing/mocks/svg.js +5 -3
  23. package/lib/testing/resolver.js +47 -0
  24. package/lib/testing/setup-react-env.js +3 -0
  25. package/lib/testing/setup-tests.js +28 -4
  26. package/lib/testing/vitest.config.ts +9 -0
  27. package/lib/transpile/.swcrc +11 -0
  28. package/lib/transpile/esbuild.js +62 -0
  29. package/lib/transpile/react-shim.js +2 -0
  30. package/lib/transpile/swcrc.config.js +13 -0
  31. package/lib/typescript/tsc-files/index.js +66 -0
  32. package/lib/typescript/tsc-files/utils.js +16 -0
  33. package/lib/webpack/helpers.js +37 -3
  34. package/lib/webpack/webpack.base.babel.js +43 -69
  35. package/lib/webpack/webpack.dev.babel.js +2 -2
  36. package/lib/webpack/webpack.lib.base.babel.js +27 -48
  37. package/lib/webpack/webpack.lib.dev.babel.js +1 -2
  38. package/lib/webpack/webpack.lib.prod.babel.js +6 -11
  39. package/lib/webpack/webpack.prod.babel.js +6 -11
  40. package/lib/webpack/webpack.storybook.js +20 -88
  41. package/package.json +109 -100
  42. package/lib/esbuild.js +0 -39
  43. package/lib/testing/setup-styled-components-tests.js +0 -1
@@ -4,7 +4,7 @@ const path = require('path');
4
4
  const { writeFile, readFile } = require('fs/promises');
5
5
  const { exec, logInfo, logError, logSuccess } = require('./utils');
6
6
  const { isTypeScriptEnabled } = require('../typescript/util');
7
- const { esBuild } = require('../esbuild');
7
+ const { esBuild } = require('../transpile/esbuild');
8
8
 
9
9
  const { name } = require('../../package.json');
10
10
 
@@ -1,6 +1,5 @@
1
1
  const { exit } = require('yargs');
2
2
  const { exec, logError, logSuccess } = require('./utils');
3
- const { lintCSS, lintJS } = require('./lint');
4
3
 
5
4
  const { CI = false } = process.env;
6
5
 
@@ -19,17 +18,7 @@ async function handler(argv) {
19
18
  if (argv.r) commandOptions += ' --bail --findRelatedTests';
20
19
  if (argv.s) commandOptions += ' --silent';
21
20
  try {
22
- if (!CI) {
23
- try {
24
- await lintJS();
25
- await lintCSS();
26
- logSuccess('Linting completed');
27
- } catch (err) {
28
- logError('Linting failed');
29
- exit(-1, err);
30
- return -1;
31
- }
32
- } else {
21
+ if (CI) {
33
22
  await exec('rimraf ./reports');
34
23
  }
35
24
 
@@ -0,0 +1,103 @@
1
+ const { exit } = require('yargs');
2
+ const { dirname, join } = require('path');
3
+ const { spawnSync } = require('child_process');
4
+ const fs = require('fs');
5
+ const { logInfo, logError } = require('./utils');
6
+
7
+ const randomChars = () => Math.random().toString(36).slice(2);
8
+
9
+ const resolveFromModule = (moduleName, ...paths) => {
10
+ const modulePath = dirname(require.resolve(`${moduleName}/package.json`));
11
+ return join(modulePath, ...paths);
12
+ };
13
+
14
+ const resolveFromRoot = (...paths) => join(process.cwd(), ...paths);
15
+
16
+ const validateTypescript = async () => {
17
+ const args = process.argv.slice(2);
18
+ const argsProjectIndex = args.findIndex((arg) =>
19
+ ['-p', '--project'].includes(arg),
20
+ );
21
+ const argsProjectValue =
22
+ argsProjectIndex !== -1 ? args[argsProjectIndex + 1] : undefined;
23
+
24
+ const files = args.filter((file) => /\.(ts|tsx)$/.test(file));
25
+ if (files.length === 0) {
26
+ process.exit(0);
27
+ }
28
+
29
+ const remainingArgsToForward = args
30
+ .slice()
31
+ .filter((arg) => !files.includes(arg));
32
+
33
+ if (argsProjectIndex !== -1) {
34
+ remainingArgsToForward.splice(argsProjectIndex, 2);
35
+ }
36
+
37
+ // Load existing config
38
+ const tsconfigPath = argsProjectValue || resolveFromRoot('tsconfig.json');
39
+ const tsconfigContent = fs.readFileSync(tsconfigPath).toString();
40
+ // Use 'eval' to read the JSON as regular JavaScript syntax so that comments are allowed
41
+ // eslint-disable-next-line prefer-const
42
+ let tsconfig = {};
43
+ // eslint-disable-next-line no-eval
44
+ eval(`tsconfig = ${tsconfigContent}`);
45
+
46
+ // Write a temp config file
47
+ const tmpTsconfigPath = resolveFromRoot(`tsconfig.${randomChars()}.json`);
48
+ const tmpTsconfig = {
49
+ ...tsconfig,
50
+ compilerOptions: {
51
+ ...tsconfig.compilerOptions,
52
+ skipLibCheck: true,
53
+ },
54
+ files,
55
+ include: ['shared/typings'],
56
+ };
57
+ fs.writeFileSync(tmpTsconfigPath, JSON.stringify(tmpTsconfig, null, 2));
58
+
59
+ // Type-check our files
60
+ const { status } = spawnSync(
61
+ resolveFromModule(
62
+ 'typescript',
63
+ `../.bin/tsc${process.platform === 'win32' ? '.cmd' : ''}`,
64
+ ),
65
+ ['-p', tmpTsconfigPath, ...remainingArgsToForward],
66
+ { stdio: 'inherit' },
67
+ );
68
+
69
+ // Delete temp config file
70
+ fs.unlinkSync(tmpTsconfigPath);
71
+
72
+ process.exit(status);
73
+ };
74
+
75
+ async function handler(argv) {
76
+ try {
77
+ await validateTypescript(argv.p);
78
+ logInfo('Typescript validation started');
79
+ } catch (err) {
80
+ logError('Typescript validation failed', err);
81
+ exit(-1, err);
82
+ }
83
+ }
84
+
85
+ exports.command = 'tsc [options]';
86
+
87
+ exports.describe = 'validate typescript code';
88
+
89
+ exports.builder = {
90
+ project: {
91
+ alias: 'p',
92
+ type: 'boolean',
93
+ default: false,
94
+ },
95
+ docs: {
96
+ type: 'boolean',
97
+ default: false,
98
+ },
99
+ };
100
+
101
+ exports.handler = handler;
102
+
103
+ exports.validateTypescript = validateTypescript;
@@ -24,10 +24,15 @@ exports.logSuccess = (...args) => console.log(chalk.green(...args));
24
24
  exports.logError = console.error;
25
25
 
26
26
  const readPackageLock = async () => {
27
- const appPkgLockFile = path.join(process.cwd(), 'package-lock.json');
28
- const pkgLockJSON = await readFile(appPkgLockFile, 'utf8');
29
- const { dependencies } = JSON.parse(pkgLockJSON);
30
- return (moduleName) => dependencies[moduleName]?.version || '';
27
+ try {
28
+ const appPkgLockFile = path.join(process.cwd(), 'package-lock.json');
29
+ const pkgLockJSON = await readFile(appPkgLockFile, 'utf8');
30
+ const { dependencies } = JSON.parse(pkgLockJSON);
31
+ return (moduleName) => dependencies[moduleName]?.version || '';
32
+ } catch (err) {
33
+ console.warn('Package lock file not found');
34
+ return () => '';
35
+ }
31
36
  };
32
37
 
33
38
  const getSupportedBrowsers = async () => {
@@ -0,0 +1,66 @@
1
+ const { exit } = require('yargs');
2
+ const path = require('path');
3
+ const { exec, logError, logSuccess } = require('./utils');
4
+
5
+ const { CI = false } = process.env;
6
+
7
+ const configPath = path.resolve(__dirname, '../testing/vitest.config.ts');
8
+
9
+ async function test(commandOptions) {
10
+ await exec(
11
+ `cross-env FORCE_COLOR=true vitest --config ${configPath} ${commandOptions}`,
12
+ );
13
+ }
14
+
15
+ // eslint-disable-next-line max-statements
16
+ async function handler(argv) {
17
+ let commandOptions = '--coverage';
18
+ if (argv.fix) commandOptions = '-u';
19
+ else if (argv.watch) commandOptions = '--watch';
20
+ if (argv.p) commandOptions += ' --passWithNoTests';
21
+ if (argv.r) commandOptions += ' --related';
22
+ if (argv.s) commandOptions += ' --silent';
23
+ try {
24
+ if (CI) {
25
+ await exec('rimraf ./reports');
26
+ }
27
+
28
+ // eslint-disable-next-line jest/valid-title, jest/no-disabled-tests, jest/expect-expect
29
+ await test(commandOptions);
30
+ logSuccess('Unit test execution completed');
31
+ } catch (err) {
32
+ logError('Unit test execution failed', err);
33
+ exit(-1, err);
34
+ return -1;
35
+ }
36
+ return 0;
37
+ }
38
+
39
+ exports.command = 'vitest [options]';
40
+
41
+ exports.describe = 'unit tests application code using vitest';
42
+
43
+ exports.builder = {
44
+ fix: {
45
+ alias: 'f',
46
+ type: 'boolean',
47
+ },
48
+ watch: {
49
+ alias: 'w',
50
+ type: 'boolean',
51
+ },
52
+ passWithNoTests: {
53
+ alias: 'p',
54
+ type: 'boolean',
55
+ },
56
+ related: {
57
+ alias: 'r',
58
+ type: 'boolean',
59
+ },
60
+ silent: {
61
+ alias: 's',
62
+ type: 'boolean',
63
+ },
64
+ };
65
+
66
+ exports.handler = handler;
package/lib/cli.js CHANGED
@@ -12,6 +12,7 @@ const lintCmd = require('./cli-commands/lint');
12
12
  const gendocCmd = require('./cli-commands/gendoc');
13
13
  const codemodCmd = require('./cli-commands/codemod');
14
14
  const storybookCmd = require('./cli-commands/storybook');
15
+ const vitestCmd = require('./cli-commands/vitest');
15
16
 
16
17
  envConfig();
17
18
  process.env.PATH +=
@@ -25,5 +26,6 @@ yargs.command(lintCmd).help().argv;
25
26
  yargs.command(gendocCmd).help().argv;
26
27
  yargs.command(codemodCmd).help().argv;
27
28
  yargs.command(storybookCmd).help().argv;
29
+ yargs.command(vitestCmd).help().argv;
28
30
 
29
31
  notifyUpdates();
@@ -4,14 +4,17 @@ const webpackConfig = require('../../webpack/webpack.prod.babel');
4
4
 
5
5
  exports.baseExtends = [
6
6
  'plugin:eslint-comments/recommended',
7
+ 'plugin:import/recommended',
7
8
  'plugin:prettier/recommended',
8
9
  'plugin:jest/recommended',
9
10
  'plugin:jsdoc/recommended',
10
11
  'plugin:wdio/recommended',
11
12
  'plugin:testing-library/dom',
13
+ 'plugin:storybook/recommended',
12
14
  ];
13
15
 
14
- const basePlugins = ['testing-library', 'jest', 'jsdoc', 'wdio'];
16
+ const basePlugins = ['testing-library', 'jest', 'jsdoc', 'wdio', 'import'];
17
+ exports.basePlugins = basePlugins;
15
18
 
16
19
  exports.baseOverrides = [
17
20
  {
@@ -36,12 +39,10 @@ const baseRules = {
36
39
  'import/prefer-default-export': 0,
37
40
  'import/extensions': [
38
41
  2,
39
- 'ignorePackages',
42
+ 'never',
40
43
  {
41
- js: 'never',
42
- jsx: 'never',
43
- ts: 'never',
44
- tsx: 'never',
44
+ json: 'ignorePackages',
45
+ js: 'ignorePackages',
45
46
  },
46
47
  ],
47
48
  indent: [
@@ -104,7 +105,11 @@ const reactRules = {
104
105
  'react/react-in-jsx-scope': 0,
105
106
  'react/jsx-filename-extension': [
106
107
  1,
107
- { extensions: ['.js', '.jsx', '.ts', '.tsx'] },
108
+ { extensions: ['.js', '.jsx', '.tsx', '.mdx'] },
109
+ ],
110
+ 'react/function-component-definition': [
111
+ 2,
112
+ { namedComponents: 'arrow-function' },
108
113
  ],
109
114
  'redux-saga/no-yield-in-race': 2,
110
115
  'redux-saga/yield-effects': 2,
@@ -1,7 +1,8 @@
1
- const { baseExtends } = require('../common');
1
+ const { baseExtends, basePlugins } = require('../common');
2
2
 
3
3
  exports.tsBaseExtends = [
4
4
  'plugin:@typescript-eslint/recommended',
5
+ 'plugin:import/typescript',
5
6
  'plugin:@typescript-eslint/recommended-requiring-type-checking',
6
7
  ].concat(baseExtends);
7
8
 
@@ -24,6 +25,7 @@ exports.tsBaseRules = {
24
25
  exports.tsBaseConfig = {
25
26
  files: ['*.ts', '*.tsx'],
26
27
  parser: '@typescript-eslint/parser',
28
+ plugins: ['@typescript-eslint'].concat(basePlugins),
27
29
  parserOptions: {
28
30
  tsconfigRootDir: process.cwd(),
29
31
  project: 'tsconfig.json',
@@ -34,5 +36,8 @@ exports.tsBaseConfig = {
34
36
  alwaysTryTypes: true,
35
37
  },
36
38
  },
39
+ 'import/parsers': {
40
+ '@typescript-eslint/parser': ['.ts', '.tsx'],
41
+ },
37
42
  },
38
43
  };
@@ -4,7 +4,7 @@ const { tsBaseExtends, tsBaseRules, tsBaseConfig } = require('./common');
4
4
 
5
5
  exports.tsConfig = {
6
6
  ...tsBaseConfig,
7
- extends: ['airbnb-typescript/base'].concat(tsBaseExtends),
7
+ extends: ['airbnb-base', 'airbnb-typescript/base'].concat(tsBaseExtends),
8
8
  rules: {
9
9
  ...baseRules,
10
10
  ...tsBaseRules,
@@ -4,7 +4,12 @@ const { tsBaseExtends, tsBaseRules, tsBaseConfig } = require('./common');
4
4
 
5
5
  exports.tsReactConfig = {
6
6
  ...tsBaseConfig,
7
- extends: ['airbnb-typescript'].concat(tsBaseExtends),
7
+ extends: [
8
+ 'airbnb',
9
+ 'airbnb/hooks',
10
+ 'plugin:redux-saga/recommended',
11
+ 'airbnb-typescript',
12
+ ].concat(tsBaseExtends),
8
13
  rules: {
9
14
  ...baseRules,
10
15
  ...tsBaseRules,
@@ -1,5 +1,12 @@
1
+ const path = require('path');
2
+
1
3
  module.exports = {
2
- '*.{ts,tsx}': ['tsc-files --noEmit --emitDeclarationOnly false'],
4
+ '*.{ts,tsx}': [
5
+ `node ${path.resolve(
6
+ __dirname,
7
+ '../typescript/tsc-files/index.js',
8
+ )} --noEmit --emitDeclarationOnly false`,
9
+ ],
3
10
  '*.{js,ts,jsx,tsx}': [
4
11
  'npm run lint:fix',
5
12
  'npm run test:staged',
@@ -0,0 +1,18 @@
1
+ const path = require('path');
2
+ const fs = require('fs');
3
+ const { merge } = require('lodash');
4
+
5
+ const baseConfig = {
6
+ esBuild: {
7
+ target: 'es2020',
8
+ },
9
+ };
10
+
11
+ const getPUIConfig = () => {
12
+ const configPath = path.resolve(process.cwd(), './pui.config.js');
13
+ if (!fs.existsSync(configPath)) return baseConfig;
14
+ const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
15
+ return merge(baseConfig, config);
16
+ };
17
+
18
+ exports.getPUIConfig = getPUIConfig;
@@ -13,8 +13,11 @@ const { loadRoutes } = require('./util');
13
13
  const { getAssetPath } = require('../webpack/helpers');
14
14
 
15
15
  const pino = expressPinoLogger({
16
- prettyPrint: {
17
- levelFirst: true,
16
+ transport: {
17
+ target: 'pino-pretty',
18
+ options: {
19
+ colorize: true,
20
+ },
18
21
  },
19
22
  });
20
23
  pino.logger.level = 'warn';
@@ -57,13 +60,6 @@ const customHost = argv.host || process.env.HOST;
57
60
  const host = customHost || null; // Let http.Server use its default IPv6/4 host
58
61
  const prettyHost = customHost || 'localhost';
59
62
 
60
- // use the gzipped bundle
61
- app.get('*.js', (req, res, next) => {
62
- req.url += '.gz';
63
- res.set('Content-Encoding', 'gzip');
64
- next();
65
- });
66
-
67
63
  // Start your app.
68
64
  app.listen(port, host, async (err) => {
69
65
  if (err) {
@@ -1,5 +1,5 @@
1
1
  const webpack = require('webpack');
2
- const express = require('express');
2
+ const expressStaticGzip = require('express-static-gzip');
3
3
  const webpackDevMiddleware = require('webpack-dev-middleware');
4
4
  const webpackHotMiddleware = require('webpack-hot-middleware');
5
5
  const { sendFileWithCSPNonce } = require('../csp');
@@ -25,7 +25,7 @@ module.exports = function addDevMiddlewares(app, webpackConfig) {
25
25
  heartbeat: 10 * 1000,
26
26
  }),
27
27
  );
28
- app.use(express.static('cdn'));
28
+ app.use(expressStaticGzip('cdn'));
29
29
 
30
30
  const { outputFileSystem } = (middleware || {}).context || {};
31
31
 
@@ -1,6 +1,6 @@
1
1
  const path = require('path');
2
- const express = require('express');
3
2
  const compression = require('compression');
3
+ const expressStaticGzip = require('express-static-gzip');
4
4
  const { sendFileWithCSPNonce } = require('../csp');
5
5
 
6
6
  module.exports = function addProdMiddlewares(app, options) {
@@ -17,8 +17,15 @@ module.exports = function addProdMiddlewares(app, options) {
17
17
  sendFileWithCSPNonce({ outputPath, res });
18
18
  });
19
19
 
20
- app.use(publicPath, express.static(outputPath, { index: false }));
21
- app.use(express.static('cdn'));
20
+ app.use(
21
+ publicPath,
22
+ expressStaticGzip(outputPath, {
23
+ index: false,
24
+ enableBrotli: true,
25
+ orderPreference: ['br'],
26
+ }),
27
+ );
28
+ app.use(expressStaticGzip('cdn'));
22
29
 
23
30
  app.get('*', (req, res) => sendFileWithCSPNonce({ outputPath, res }));
24
31
  };
@@ -1,5 +1,6 @@
1
1
  const path = require('path');
2
2
  const { getAppConfig, getAssetPath } = require('../webpack/helpers');
3
+ const swcrcConfig = require('../transpile/swcrc.config.js');
3
4
 
4
5
  const name = '@elliemae/pui-cli';
5
6
  const rootDir = path.join('<rootDir>', 'node_modules', name);
@@ -42,8 +43,8 @@ const jestConfig = {
42
43
  '!app/*/RbGenerated*/*.{js, ts, jsx, tsx}',
43
44
  '!app/index.{js, ts, jsx, tsx}',
44
45
  '!app/global-styles.{js, ts, jsx, tsx}',
45
- '!app/*/*/loadable.{js, ts, jsx, tsx}',
46
- '!lib/*/*/loadable.{js, ts, jsx, tsx}',
46
+ '!app/**/loadable.{js, ts, jsx, tsx}',
47
+ '!lib/**/loadable.{js, ts, jsx, tsx}',
47
48
  ],
48
49
  coverageThreshold: {
49
50
  // Todo: enable the coverage threshold later
@@ -66,17 +67,35 @@ const jestConfig = {
66
67
  '@elliemae/pui-user-monitoring': `${getRootDir()}/lib/testing/mocks/pui-user-monitoring.js`,
67
68
  '@elliemae/pui-app-loader': `${getRootDir()}/lib/testing/mocks/pui-app-loader.js`,
68
69
  '@elliemae/pui-diagnostics': `${getRootDir()}/lib/testing/mocks/pui-diagnostics.js`,
70
+ 'react-spring/web': '<rootDir>/node_modules/react-spring/web.cjs.js',
71
+ 'react-spring/renderprops':
72
+ '<rootDir>/node_modules/react-spring/renderprops.cjs.js',
69
73
  'styled-components':
70
74
  '<rootDir>/node_modules/styled-components/dist/styled-components.cjs.js',
71
75
  },
76
+ moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
72
77
  setupFilesAfterEnv: [`${getRootDir()}/lib/testing/setup-tests.js`],
73
78
  setupFiles: ['raf/polyfill', 'whatwg-fetch'],
74
- testRegex: '(app|lib).*/tests/.*\\.test\\.(js|ts)$',
79
+ testRegex: '(app|lib).*/tests/.*\\.test\\.[jt]sx?$',
75
80
  snapshotSerializers: [],
76
81
  testResultsProcessor: 'jest-sonar-reporter',
82
+ resolver: path.resolve(__dirname, './resolver.js'),
83
+ transform: {
84
+ '^.+\\.[jt]sx?$': ['@swc/jest', swcrcConfig],
85
+ },
86
+ // transform: {
87
+ // '^.+\\.[jt]sx?$': [
88
+ // 'esbuild-jest',
89
+ // {
90
+ // target: 'es2020',
91
+ // loaders: {
92
+ // '.js': 'jsx',
93
+ // },
94
+ // },
95
+ // ],
96
+ // },
77
97
  transformIgnorePatterns: [
78
- 'node_modules/(?!(@elliemae/*|lodash-es/*)/)',
79
- 'node_modules/@elliemae/em-platform-document-viewer',
98
+ 'node_modules/(?!(.*@elliemae/pui-cli|lodash-es|react-select|react-dates)/)',
80
99
  ],
81
100
  globals: {
82
101
  APP_CONFIG: getAppConfig(),
@@ -86,8 +105,8 @@ const jestConfig = {
86
105
  testEnvironment: 'jsdom',
87
106
  };
88
107
 
89
- if (isReactModule)
108
+ if (isReactModule && jestConfig.setupFilesAfterEnv)
90
109
  jestConfig.setupFilesAfterEnv.push(
91
- `${getRootDir()}/lib/testing/setup-styled-components-tests.js`,
110
+ `${getRootDir()}/lib/testing/setup-react-env.js`,
92
111
  );
93
112
  module.exports = jestConfig;
@@ -1,13 +1,19 @@
1
1
  /**
2
2
  *
3
3
  */
4
- export default function () {
4
+ export default () => {
5
5
  Object.defineProperty(window, 'matchMedia', {
6
- value: () => ({
6
+ writable: true,
7
+ value: jest.fn().mockImplementation((query) => ({
7
8
  matches: false,
8
- addListener: () => {},
9
- removeListener: () => {},
10
- }),
9
+ media: query,
10
+ onchange: null,
11
+ addListener: jest.fn(), // Deprecated
12
+ removeListener: jest.fn(), // Deprecated
13
+ addEventListener: jest.fn(),
14
+ removeEventListener: jest.fn(),
15
+ dispatchEvent: jest.fn(),
16
+ })),
11
17
  });
12
18
 
13
19
  Object.defineProperty(window, 'getComputedStyle', {
@@ -15,4 +21,4 @@ export default function () {
15
21
  getPropertyValue: () => {},
16
22
  }),
17
23
  });
18
- }
24
+ };
@@ -1,3 +1 @@
1
- module.exports = {
2
- load: () => {},
3
- };
1
+ export const load = () => {};
@@ -1,36 +1,28 @@
1
- module.exports = {
2
- logger() {
3
- return {
4
- setLogLevel() {},
5
- setOptions() {},
6
- info() {},
7
- warn() {},
8
- error() {},
9
- trace() {},
10
- debug() {},
11
- audit() {},
12
- fatal() {},
13
- };
14
- },
15
- LogLevel: {
16
- info: 'info',
17
- debug: 'debug',
18
- trace: 'trace',
19
- warn: 'warn',
20
- error: 'error',
21
- audit: 'audit',
22
- fatal: 'fatal',
23
- },
24
- Console() {
25
- return {
26
- log() {},
27
- };
28
- },
29
- http() {
30
- return {
31
- log() {},
32
- };
33
- },
34
- webvitals() {},
35
- logUnhandledErrors() {},
1
+ export const logger = () => ({
2
+ setLogLevel() {},
3
+ setOptions() {},
4
+ info() {},
5
+ warn() {},
6
+ error() {},
7
+ trace() {},
8
+ debug() {},
9
+ audit() {},
10
+ fatal() {},
11
+ });
12
+ export const LogLevel = {
13
+ info: 'info',
14
+ debug: 'debug',
15
+ trace: 'trace',
16
+ warn: 'warn',
17
+ error: 'error',
18
+ audit: 'audit',
19
+ fatal: 'fatal',
36
20
  };
21
+ export const Console = () => ({
22
+ log: () => {},
23
+ });
24
+ export const http = () => ({
25
+ log() {},
26
+ });
27
+ export const webvitals = () => {};
28
+ export const logUnhandledErrors = () => {};
@@ -1,5 +1,3 @@
1
- module.exports = {
2
- setCustomUserData: () => {},
3
- setCustomVirtualPageName: () => {},
4
- startVirtualPageMonitoringWithAutoEnd: () => {},
5
- };
1
+ export const setCustomUserData = () => {};
2
+ export const setCustomVirtualPageName = () => {};
3
+ export const startVirtualPageMonitoringWithAutoEnd = () => {};
@@ -1,5 +1,3 @@
1
- module.exports = {
2
- attach: jest.fn(),
3
- detach: jest.fn(),
4
- getConfig: jest.fn(),
5
- };
1
+ export const attach = jest.fn();
2
+ export const detach = jest.fn();
3
+ export const getConfig = jest.fn();
@@ -1,3 +1,5 @@
1
- module.exports = {
2
- ReactComponent: 'IMAGE_MOCK',
3
- };
1
+ // eslint-disable-next-line no-unused-vars
2
+ import * as React from 'react';
3
+
4
+ export default 'SvgrURL';
5
+ export const ReactComponent = 'div';