@elliemae/pui-cli 5.22.0 → 5.22.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/lib/cli-commands/test.js +1 -12
- package/lib/testing/jest.config.js +2 -3
- package/lib/testing/resolver.js +44 -0
- package/lib/testing/setup-tests.js +25 -2
- package/lib/webpack/webpack.base.babel.js +0 -13
- package/lib/webpack/webpack.lib.base.babel.js +0 -13
- package/package.json +3 -4
- package/lib/testing/jest-resolver.js +0 -16
package/lib/cli-commands/test.js
CHANGED
|
@@ -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 (
|
|
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
|
|
|
@@ -74,10 +74,9 @@ const jestConfig = {
|
|
|
74
74
|
testRegex: '(app|lib).*/tests/.*\\.test\\.(js|ts|tsx|jsx)$',
|
|
75
75
|
snapshotSerializers: [],
|
|
76
76
|
testResultsProcessor: 'jest-sonar-reporter',
|
|
77
|
-
resolver: '
|
|
77
|
+
resolver: path.resolve(__dirname, './resolver.js'),
|
|
78
78
|
transformIgnorePatterns: [
|
|
79
|
-
'node_modules/(?!(@elliemae
|
|
80
|
-
'node_modules/@elliemae/em-platform-document-viewer',
|
|
79
|
+
'node_modules/(?!(@elliemae/em-platform-document-viewer|@elliemae/pui-cli|@elliemae/pui-app-widgets|lodash-es|react-spring|react-select|react-dates|@babel/runtime)/)',
|
|
81
80
|
],
|
|
82
81
|
globals: {
|
|
83
82
|
APP_CONFIG: getAppConfig(),
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const resolutions = [
|
|
2
|
+
{
|
|
3
|
+
matcher: /\.jsx?$/i,
|
|
4
|
+
extensions: ['.tsx', '.ts'],
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
matcher: /\.mjs$/i,
|
|
8
|
+
extensions: ['.mts'],
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
matcher: /\.cjs$/i,
|
|
12
|
+
extensions: ['.cts'],
|
|
13
|
+
},
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
const importResolver = require('enhanced-resolve').create.sync({
|
|
17
|
+
conditionNames: ['import', 'node', 'default'],
|
|
18
|
+
extensions: ['.js', '.jsx', '.json', '.node', '.ts', '.tsx'],
|
|
19
|
+
});
|
|
20
|
+
const requireResolver = require('enhanced-resolve').create.sync({
|
|
21
|
+
conditionNames: ['require', 'node', 'default'],
|
|
22
|
+
extensions: ['.js', '.jsx', '.json', '.node', '.ts', '.tsx'],
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
module.exports = (request, options) => {
|
|
26
|
+
let resolver = requireResolver;
|
|
27
|
+
if (options.conditions?.includes('import')) {
|
|
28
|
+
resolver = importResolver;
|
|
29
|
+
}
|
|
30
|
+
const resolution = resolutions.find(({ matcher }) => matcher.test(request));
|
|
31
|
+
if (resolution) {
|
|
32
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
33
|
+
for (const extension of resolution.extensions) {
|
|
34
|
+
try {
|
|
35
|
+
return resolver(
|
|
36
|
+
options.basedir,
|
|
37
|
+
request.replace(resolution.matcher, extension),
|
|
38
|
+
);
|
|
39
|
+
// eslint-disable-next-line no-empty
|
|
40
|
+
} catch {}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return resolver(options.basedir, request);
|
|
44
|
+
};
|
|
@@ -5,8 +5,31 @@ import 'regenerator-runtime/runtime';
|
|
|
5
5
|
import '@testing-library/jest-dom/extend-expect';
|
|
6
6
|
import { toHaveNoViolations } from 'jest-axe';
|
|
7
7
|
import ResizeObserver from 'resize-observer-polyfill';
|
|
8
|
-
import addMatchMedia from '
|
|
9
|
-
import { logger } from '
|
|
8
|
+
import addMatchMedia from '@elliemae/pui-cli/lib/testing/mocks/matchMedia';
|
|
9
|
+
import { logger } from '@elliemae/pui-cli/lib/testing/mocks/pui-diagnostics';
|
|
10
|
+
|
|
11
|
+
// eslint-disable-next-line no-console
|
|
12
|
+
const originalError = console.error;
|
|
13
|
+
// eslint-disable-next-line no-console
|
|
14
|
+
console.error = (...args) => {
|
|
15
|
+
const ignoreList = [
|
|
16
|
+
`Warning: Can't perform a React state update on an unmounted component`,
|
|
17
|
+
`Warning: Function components cannot be given refs`,
|
|
18
|
+
`Warning: Failed %s type:`,
|
|
19
|
+
`Warning: Invalid DOM property`,
|
|
20
|
+
`Warning: Each child in a list should have a unique`,
|
|
21
|
+
'Warning: Received `%s` for a non-boolean attribute',
|
|
22
|
+
'Warning: <%s /> is using incorrect casing.',
|
|
23
|
+
'Warning: The tag <%s> is unrecognized in this browser',
|
|
24
|
+
];
|
|
25
|
+
if (
|
|
26
|
+
ignoreList.find(
|
|
27
|
+
(ignoreMsg) => !!args.find((arg) => arg.includes?.(ignoreMsg)),
|
|
28
|
+
)
|
|
29
|
+
)
|
|
30
|
+
return false;
|
|
31
|
+
return originalError(...args);
|
|
32
|
+
};
|
|
10
33
|
|
|
11
34
|
if (expect) expect.extend(toHaveNoViolations);
|
|
12
35
|
jest.setTimeout(60000);
|
|
@@ -7,7 +7,6 @@ const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack
|
|
|
7
7
|
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
|
|
8
8
|
const MomentLocalesPlugin = require('moment-locales-webpack-plugin');
|
|
9
9
|
const { WebpackManifestPlugin } = require('webpack-manifest-plugin');
|
|
10
|
-
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
|
|
11
10
|
|
|
12
11
|
const {
|
|
13
12
|
excludeNodeModulesExcept,
|
|
@@ -16,7 +15,6 @@ const {
|
|
|
16
15
|
getAlias,
|
|
17
16
|
getPaths,
|
|
18
17
|
} = require('./helpers');
|
|
19
|
-
const { isTypeScriptEnabled } = require('../typescript/util');
|
|
20
18
|
|
|
21
19
|
// get the application configuration
|
|
22
20
|
const devMode = process.env.NODE_ENV !== 'production';
|
|
@@ -103,17 +101,6 @@ const plugins = [
|
|
|
103
101
|
new WebpackManifestPlugin(),
|
|
104
102
|
];
|
|
105
103
|
|
|
106
|
-
if (isTypeScriptEnabled()) {
|
|
107
|
-
plugins.push(
|
|
108
|
-
new ForkTsCheckerWebpackPlugin({
|
|
109
|
-
async: devMode,
|
|
110
|
-
eslint: {
|
|
111
|
-
files: './app/**/*.{ts,js,tsx,jsx}',
|
|
112
|
-
},
|
|
113
|
-
}),
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
104
|
module.exports = (options) => ({
|
|
118
105
|
mode: options.mode,
|
|
119
106
|
entry: options.entry,
|
|
@@ -10,7 +10,6 @@ const PostcssPresetEnv = require('postcss-preset-env');
|
|
|
10
10
|
const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin');
|
|
11
11
|
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
|
|
12
12
|
const MomentLocalesPlugin = require('moment-locales-webpack-plugin');
|
|
13
|
-
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
|
|
14
13
|
const ResolveTypeScriptPlugin = require('resolve-typescript-plugin').default;
|
|
15
14
|
|
|
16
15
|
const {
|
|
@@ -21,7 +20,6 @@ const {
|
|
|
21
20
|
getAssetPath,
|
|
22
21
|
getAlias,
|
|
23
22
|
} = require('./helpers');
|
|
24
|
-
const { isTypeScriptEnabled } = require('../typescript/util');
|
|
25
23
|
|
|
26
24
|
const devMode = process.env.NODE_ENV !== 'production';
|
|
27
25
|
const minicssLoader = {
|
|
@@ -62,17 +60,6 @@ const plugins = [
|
|
|
62
60
|
new MomentLocalesPlugin(),
|
|
63
61
|
];
|
|
64
62
|
|
|
65
|
-
if (isTypeScriptEnabled()) {
|
|
66
|
-
plugins.push(
|
|
67
|
-
new ForkTsCheckerWebpackPlugin({
|
|
68
|
-
async: devMode,
|
|
69
|
-
eslint: {
|
|
70
|
-
files: './lib/**/*.{ts,js,tsx,jsx}',
|
|
71
|
-
},
|
|
72
|
-
}),
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
63
|
module.exports = (options) => ({
|
|
77
64
|
mode: options.mode,
|
|
78
65
|
entry: [path.join(process.cwd(), 'lib/index')],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/pui-cli",
|
|
3
|
-
"version": "5.22.
|
|
3
|
+
"version": "5.22.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "EllieMae Platform UI CLI",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -180,7 +180,7 @@
|
|
|
180
180
|
"minimist": "~1.2.5",
|
|
181
181
|
"moment": "~2.29.1",
|
|
182
182
|
"moment-locales-webpack-plugin": "~1.2.0",
|
|
183
|
-
"msw": "~0.36.
|
|
183
|
+
"msw": "~0.36.2",
|
|
184
184
|
"node-gyp": "~8.4.1",
|
|
185
185
|
"node-plop": "~0.30.0",
|
|
186
186
|
"nodemon": "~2.0.15",
|
|
@@ -189,7 +189,7 @@
|
|
|
189
189
|
"pino": "~7.5.1",
|
|
190
190
|
"pino-pretty": "~7.2.0",
|
|
191
191
|
"pinst": "~2.1.6",
|
|
192
|
-
"plop": "~3.0.
|
|
192
|
+
"plop": "~3.0.3",
|
|
193
193
|
"postcss": "~8.4.4",
|
|
194
194
|
"postcss-jsx": "~0.36.4",
|
|
195
195
|
"postcss-html": "~1.3.0",
|
|
@@ -223,7 +223,6 @@
|
|
|
223
223
|
"svg-url-loader": "~7.1.1",
|
|
224
224
|
"svgo": "~2.8.0",
|
|
225
225
|
"terser-webpack-plugin": "~5.2.5",
|
|
226
|
-
"ts-jest-resolver": "~2.0.0",
|
|
227
226
|
"ts-node": "~10.4.0",
|
|
228
227
|
"tsc-alias": "~1.4.2",
|
|
229
228
|
"tsc-files": "~1.1.3",
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
const importResolver = require('enhanced-resolve').create.sync({
|
|
2
|
-
conditionNames: ['import', 'node', 'default'],
|
|
3
|
-
extensions: ['.js', '.json', '.node', '.ts'],
|
|
4
|
-
});
|
|
5
|
-
const requireResolver = require('enhanced-resolve').create.sync({
|
|
6
|
-
conditionNames: ['require', 'node', 'default'],
|
|
7
|
-
extensions: ['.js', '.json', '.node', '.ts'],
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
module.exports = (request, options) => {
|
|
11
|
-
let resolver = requireResolver;
|
|
12
|
-
if (options.conditions?.includes('import')) {
|
|
13
|
-
resolver = importResolver;
|
|
14
|
-
}
|
|
15
|
-
return resolver(options.basedir, request);
|
|
16
|
-
};
|