@elliemae/pui-cli 6.0.0-beta.37 → 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.
|
@@ -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();
|
|
@@ -3,11 +3,17 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export default () => {
|
|
5
5
|
Object.defineProperty(window, 'matchMedia', {
|
|
6
|
-
|
|
6
|
+
writable: true,
|
|
7
|
+
value: jest.fn().mockImplementation((query) => ({
|
|
7
8
|
matches: false,
|
|
8
|
-
|
|
9
|
-
|
|
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', {
|
|
@@ -21,6 +21,7 @@ console.error = (...args) => {
|
|
|
21
21
|
'Warning: Received `%s` for a non-boolean attribute',
|
|
22
22
|
'Warning: <%s /> is using incorrect casing.',
|
|
23
23
|
'Warning: The tag <%s> is unrecognized in this browser',
|
|
24
|
+
'Warning: Invalid arguments supplied to oneOf',
|
|
24
25
|
];
|
|
25
26
|
if (
|
|
26
27
|
ignoreList.find(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/pui-cli",
|
|
3
|
-
"version": "6.0.0-beta.
|
|
3
|
+
"version": "6.0.0-beta.40",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "ICE MT UI Platform CLI",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -38,7 +38,8 @@
|
|
|
38
38
|
"storybook:build": "exit 0",
|
|
39
39
|
"storybook:docs:build": "exit 0",
|
|
40
40
|
"upgrade": "ncu -u && npm run setup",
|
|
41
|
-
"prepare": "husky install"
|
|
41
|
+
"prepare": "[ -n \"$CI\" ] || husky install",
|
|
42
|
+
"preinstall": "npx only-allow pnpm"
|
|
42
43
|
},
|
|
43
44
|
"jestSonar": {
|
|
44
45
|
"sonar56x": true,
|
|
@@ -83,18 +84,18 @@
|
|
|
83
84
|
"@stylelint/postcss-css-in-js": "~0.37.2",
|
|
84
85
|
"@svgr/webpack": "~6.1.2",
|
|
85
86
|
"@swc/cli": "~0.1.55",
|
|
86
|
-
"@swc/core": "~1.2.
|
|
87
|
+
"@swc/core": "~1.2.127",
|
|
87
88
|
"@swc/jest": "~0.2.15",
|
|
88
89
|
"@testing-library/jest-dom": "~5.16.1",
|
|
89
90
|
"@testing-library/react": "~12.1.2",
|
|
90
91
|
"@testing-library/react-hooks": "~7.0.2",
|
|
91
92
|
"@types/jest": "~27.4.0",
|
|
92
|
-
"@types/node": "~17.0.
|
|
93
|
+
"@types/node": "~17.0.8",
|
|
93
94
|
"@types/rimraf": "~3.0.2",
|
|
94
95
|
"@types/testing-library__jest-dom": "~5.14.2",
|
|
95
96
|
"@typescript-eslint/eslint-plugin": "~5.9.0",
|
|
96
97
|
"@typescript-eslint/parser": "~5.9.0",
|
|
97
|
-
"autoprefixer": "~10.4.
|
|
98
|
+
"autoprefixer": "~10.4.2",
|
|
98
99
|
"axe-core": "~4.3.5",
|
|
99
100
|
"babel-loader": "~8.2.3",
|
|
100
101
|
"babel-plugin-add-import-extension": "1.5.1",
|
|
@@ -142,7 +143,7 @@
|
|
|
142
143
|
"eslint-import-resolver-babel-module": "~5.3.1",
|
|
143
144
|
"eslint-import-resolver-typescript": "~2.5.0",
|
|
144
145
|
"eslint-import-resolver-webpack": "~0.13.2",
|
|
145
|
-
"eslint-plugin-compat": "~4.0.
|
|
146
|
+
"eslint-plugin-compat": "~4.0.1",
|
|
146
147
|
"eslint-plugin-eslint-comments": "~3.2.0",
|
|
147
148
|
"eslint-plugin-import": "~2.25.4",
|
|
148
149
|
"eslint-plugin-jest": "~25.3.4",
|
|
@@ -156,10 +157,10 @@
|
|
|
156
157
|
"eslint-plugin-storybook": "~0.5.5",
|
|
157
158
|
"eslint-plugin-testing-library": "~5.0.1",
|
|
158
159
|
"eslint-plugin-wdio": "~7.4.2",
|
|
159
|
-
"express-static-gzip": "~2.1.1",
|
|
160
160
|
"execa": "~5.1.1",
|
|
161
161
|
"express": "~4.17.2",
|
|
162
162
|
"express-pino-logger": "~7.0.0",
|
|
163
|
+
"express-static-gzip": "~2.1.1",
|
|
163
164
|
"favicons": "~6.2.2",
|
|
164
165
|
"favicons-webpack-plugin": "~5.0.2",
|
|
165
166
|
"file-loader": "~6.2.0",
|
|
@@ -173,13 +174,13 @@
|
|
|
173
174
|
"imports-loader": "~3.1.1",
|
|
174
175
|
"ip": "~1.1.5",
|
|
175
176
|
"jest-axe": "~5.0.1",
|
|
176
|
-
"jest-cli": "~27.4.
|
|
177
|
+
"jest-cli": "~27.4.7",
|
|
177
178
|
"jest-sonar-reporter": "~2.0.0",
|
|
178
179
|
"jest-styled-components": "~7.0.8",
|
|
179
180
|
"jscodeshift": "~0.13.0",
|
|
180
181
|
"jsdoc": "~3.6.7",
|
|
181
|
-
"lint-staged": "~12.1.
|
|
182
|
-
"mini-css-extract-plugin": "~2.4.
|
|
182
|
+
"lint-staged": "~12.1.7",
|
|
183
|
+
"mini-css-extract-plugin": "~2.4.6",
|
|
183
184
|
"minimist": "~1.2.5",
|
|
184
185
|
"moment": "~2.29.1",
|
|
185
186
|
"moment-locales-webpack-plugin": "~1.2.0",
|
|
@@ -194,12 +195,12 @@
|
|
|
194
195
|
"pinst": "~2.1.6",
|
|
195
196
|
"plop": "~3.0.5",
|
|
196
197
|
"postcss": "~8.4.5",
|
|
197
|
-
"postcss-jsx": "~0.36.4",
|
|
198
198
|
"postcss-html": "~1.3.0",
|
|
199
|
-
"postcss-
|
|
200
|
-
"postcss-syntax": "~0.36.2",
|
|
199
|
+
"postcss-jsx": "~0.36.4",
|
|
201
200
|
"postcss-loader": "~6.2.1",
|
|
201
|
+
"postcss-markdown": "~1.2.0",
|
|
202
202
|
"postcss-preset-env": "~7.2.0",
|
|
203
|
+
"postcss-syntax": "~0.36.2",
|
|
203
204
|
"prettier": "~2.5.1",
|
|
204
205
|
"pug": "~3.0.2",
|
|
205
206
|
"pug-loader": "~2.4.0",
|
|
@@ -214,10 +215,10 @@
|
|
|
214
215
|
"rimraf": "~3.0.2",
|
|
215
216
|
"script-loader": "~0.7.2",
|
|
216
217
|
"semantic-release": "~18.0.1",
|
|
217
|
-
"shelljs": "~0.8.
|
|
218
|
+
"shelljs": "~0.8.5",
|
|
218
219
|
"slackify-markdown": "~4.3.1",
|
|
219
|
-
"storybook-builder-vite": "~0.1.13",
|
|
220
220
|
"storybook-addon-turbo-build": "~1.0.1",
|
|
221
|
+
"storybook-builder-vite": "~0.1.13",
|
|
221
222
|
"storybook-react-router": "~1.0.8",
|
|
222
223
|
"style-loader": "~3.3.1",
|
|
223
224
|
"stylelint": "~14.2.0",
|
|
@@ -234,12 +235,13 @@
|
|
|
234
235
|
"tsc-files": "~1.1.3",
|
|
235
236
|
"tsconfig-paths": "~3.12.0",
|
|
236
237
|
"tsconfig-paths-webpack-plugin": "~3.5.2",
|
|
237
|
-
"type-fest": "~2.
|
|
238
|
+
"type-fest": "~2.9.0",
|
|
238
239
|
"typescript": "~4.5.4",
|
|
239
240
|
"update-notifier": "~5.1.0",
|
|
240
241
|
"url-loader": "~4.1.1",
|
|
241
242
|
"uuid": "~8.3.2",
|
|
242
243
|
"vite": "~2.7.10",
|
|
244
|
+
"vitest": "~0.0.139",
|
|
243
245
|
"webpack": "~5.65.0",
|
|
244
246
|
"webpack-bundle-analyzer": "~4.5.0",
|
|
245
247
|
"webpack-cli": "~4.9.1",
|