@elliemae/pui-cli 5.21.1 → 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 +3 -4
- package/lib/testing/mocks/svg.js +5 -3
- package/lib/testing/resolver.js +44 -0
- package/lib/testing/setup-tests.js +25 -2
- package/lib/webpack/webpack.base.babel.js +1 -13
- package/lib/webpack/webpack.lib.base.babel.js +1 -13
- package/lib/webpack/webpack.storybook.js +1 -0
- package/package.json +7 -7
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
|
|
|
@@ -71,13 +71,12 @@ const jestConfig = {
|
|
|
71
71
|
},
|
|
72
72
|
setupFilesAfterEnv: [`${getRootDir()}/lib/testing/setup-tests.js`],
|
|
73
73
|
setupFiles: ['raf/polyfill', 'whatwg-fetch'],
|
|
74
|
-
testRegex: '(app|lib).*/tests/.*\\.test\\.(js|ts)$',
|
|
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(),
|
package/lib/testing/mocks/svg.js
CHANGED
|
@@ -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,
|
|
@@ -189,6 +176,7 @@ module.exports = (options) => ({
|
|
|
189
176
|
{
|
|
190
177
|
test: /\.svg$/i,
|
|
191
178
|
issuer: /\.[jt]sx?$/,
|
|
179
|
+
resourceQuery: /^((?!url).)*$/,
|
|
192
180
|
use: ['@svgr/webpack'],
|
|
193
181
|
},
|
|
194
182
|
{
|
|
@@ -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')],
|
|
@@ -173,6 +160,7 @@ module.exports = (options) => ({
|
|
|
173
160
|
{
|
|
174
161
|
test: /\.svg$/i,
|
|
175
162
|
issuer: /\.[jt]sx?$/,
|
|
163
|
+
resourceQuery: /^((?!url).)*$/,
|
|
176
164
|
use: ['@svgr/webpack'],
|
|
177
165
|
},
|
|
178
166
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/pui-cli",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.22.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "EllieMae Platform UI CLI",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"@testing-library/react": "~12.1.2",
|
|
94
94
|
"@testing-library/react-hooks": "~7.0.2",
|
|
95
95
|
"@types/jest": "~27.0.3",
|
|
96
|
-
"@types/node": "~16.11.
|
|
96
|
+
"@types/node": "~16.11.12",
|
|
97
97
|
"@types/rimraf": "~3.0.2",
|
|
98
98
|
"@types/testing-library__jest-dom": "~5.14.2",
|
|
99
99
|
"@typescript-eslint/eslint-plugin": "~5.6.0",
|
|
@@ -132,7 +132,8 @@
|
|
|
132
132
|
"dotenv": "~10.0.0",
|
|
133
133
|
"dotenv-webpack": "~7.0.3",
|
|
134
134
|
"duplicate-package-checker-webpack-plugin": "~3.0.0",
|
|
135
|
-
"
|
|
135
|
+
"enhanced-resolve": "~5.8.3",
|
|
136
|
+
"eslint": "~8.4.1",
|
|
136
137
|
"eslint-config-airbnb": "~18.2.1",
|
|
137
138
|
"eslint-config-airbnb-base": "~15.0.0",
|
|
138
139
|
"eslint-config-airbnb-typescript": "~15.0.0",
|
|
@@ -179,7 +180,7 @@
|
|
|
179
180
|
"minimist": "~1.2.5",
|
|
180
181
|
"moment": "~2.29.1",
|
|
181
182
|
"moment-locales-webpack-plugin": "~1.2.0",
|
|
182
|
-
"msw": "~0.36.
|
|
183
|
+
"msw": "~0.36.2",
|
|
183
184
|
"node-gyp": "~8.4.1",
|
|
184
185
|
"node-plop": "~0.30.0",
|
|
185
186
|
"nodemon": "~2.0.15",
|
|
@@ -188,7 +189,7 @@
|
|
|
188
189
|
"pino": "~7.5.1",
|
|
189
190
|
"pino-pretty": "~7.2.0",
|
|
190
191
|
"pinst": "~2.1.6",
|
|
191
|
-
"plop": "~3.0.
|
|
192
|
+
"plop": "~3.0.3",
|
|
192
193
|
"postcss": "~8.4.4",
|
|
193
194
|
"postcss-jsx": "~0.36.4",
|
|
194
195
|
"postcss-html": "~1.3.0",
|
|
@@ -211,7 +212,7 @@
|
|
|
211
212
|
"script-loader": "~0.7.2",
|
|
212
213
|
"semantic-release": "~18.0.1",
|
|
213
214
|
"shelljs": "~0.8.4",
|
|
214
|
-
"slackify-markdown": "~4.3.
|
|
215
|
+
"slackify-markdown": "~4.3.1",
|
|
215
216
|
"storybook-react-router": "~1.0.8",
|
|
216
217
|
"style-loader": "~3.3.1",
|
|
217
218
|
"stylelint": "~14.1.0",
|
|
@@ -222,7 +223,6 @@
|
|
|
222
223
|
"svg-url-loader": "~7.1.1",
|
|
223
224
|
"svgo": "~2.8.0",
|
|
224
225
|
"terser-webpack-plugin": "~5.2.5",
|
|
225
|
-
"ts-jest-resolver": "~2.0.0",
|
|
226
226
|
"ts-node": "~10.4.0",
|
|
227
227
|
"tsc-alias": "~1.4.2",
|
|
228
228
|
"tsc-files": "~1.1.3",
|