@dword-design/base 9.0.9 → 9.1.0
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/cli.js
CHANGED
|
@@ -28,9 +28,9 @@ const run = async () => {
|
|
|
28
28
|
},
|
|
29
29
|
...(base.config.testInContainer && {
|
|
30
30
|
'test:raw': {
|
|
31
|
-
arguments: '[
|
|
32
|
-
handler: (
|
|
33
|
-
|
|
31
|
+
arguments: '[patterns...]',
|
|
32
|
+
handler: (patterns, options) => base.testRaw({
|
|
33
|
+
patterns,
|
|
34
34
|
...options
|
|
35
35
|
}),
|
|
36
36
|
options: [{
|
|
@@ -43,9 +43,9 @@ const run = async () => {
|
|
|
43
43
|
}
|
|
44
44
|
}),
|
|
45
45
|
test: {
|
|
46
|
-
arguments: '[
|
|
47
|
-
handler: (
|
|
48
|
-
|
|
46
|
+
arguments: '[patterns...]',
|
|
47
|
+
handler: (patterns, options) => base.test({
|
|
48
|
+
patterns,
|
|
49
49
|
...options
|
|
50
50
|
}),
|
|
51
51
|
options: [{
|
|
@@ -13,6 +13,7 @@ export default async function (options) {
|
|
|
13
13
|
var _ref, _this$packageConfig$n, _ref2, _ref3;
|
|
14
14
|
options = {
|
|
15
15
|
log: true,
|
|
16
|
+
patterns: [],
|
|
16
17
|
...options
|
|
17
18
|
};
|
|
18
19
|
const volumeName = (_ref = (_this$packageConfig$n = this.packageConfig.name, replace('@', '')(_this$packageConfig$n)), replace('/', '-')(_ref));
|
|
@@ -24,7 +25,7 @@ export default async function (options) {
|
|
|
24
25
|
const userInfo = os.userInfo();
|
|
25
26
|
try {
|
|
26
27
|
var _ref4, _envVariableNames, _ref5;
|
|
27
|
-
return await execa('docker', ['run', '--rm', '--tty', ...(_ref4 = (_envVariableNames = envVariableNames, filter(name => process.env[name] !== undefined)(_envVariableNames)), flatMap(name => ['--env', `${name}=${process.env[name]}`])(_ref4)), '-v', `${process.cwd()}:/app`, '-v', `${volumeName}:/app/node_modules`, 'dworddesign/testing:latest', 'bash', '-c', (_ref5 = ['yarn --frozen-lockfile', '&&', 'yarn test:raw', ...(options.updateSnapshots ? [' --update-snapshots'] : []), ...
|
|
28
|
+
return await execa('docker', ['run', '--rm', '--tty', ...(_ref4 = (_envVariableNames = envVariableNames, filter(name => process.env[name] !== undefined)(_envVariableNames)), flatMap(name => ['--env', `${name}=${process.env[name]}`])(_ref4)), '-v', `${process.cwd()}:/app`, '-v', `${volumeName}:/app/node_modules`, 'dworddesign/testing:latest', 'bash', '-c', (_ref5 = ['yarn --frozen-lockfile', '&&', 'yarn test:raw', ...(options.updateSnapshots ? [' --update-snapshots'] : []), ...options.patterns, ...(options.grep ? [`-g "${options.grep}"`] : [])], join(' ')(_ref5))], options.log ? {
|
|
28
29
|
stdio: 'inherit'
|
|
29
30
|
} : {
|
|
30
31
|
all: true
|
|
@@ -12,3 +12,22 @@ All files | 100 | 100 | 100 | 100 |
|
|
|
12
12
|
index.foo | 100 | 100 | 100 | 100 |
|
|
13
13
|
-----------|---------|----------|---------|---------|-------------------"
|
|
14
14
|
`;
|
|
15
|
+
|
|
16
|
+
exports[`index multiple patterns 1`] = `
|
|
17
|
+
"
|
|
18
|
+
|
|
19
|
+
index1
|
|
20
|
+
✓ valid
|
|
21
|
+
|
|
22
|
+
index2
|
|
23
|
+
✓ valid
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
2 passing
|
|
27
|
+
|
|
28
|
+
----------|---------|----------|---------|---------|-------------------
|
|
29
|
+
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
|
|
30
|
+
----------|---------|----------|---------|---------|-------------------
|
|
31
|
+
All files | 0 | 0 | 0 | 0 |
|
|
32
|
+
----------|---------|----------|---------|---------|-------------------"
|
|
33
|
+
`;
|
|
@@ -17,9 +17,10 @@ export default async function (options) {
|
|
|
17
17
|
var _ref, _this$config$coverage;
|
|
18
18
|
options = {
|
|
19
19
|
log: !stdEnv.test,
|
|
20
|
+
patterns: [],
|
|
20
21
|
...options
|
|
21
22
|
};
|
|
22
|
-
if (
|
|
23
|
+
if (options.patterns.length === 0) {
|
|
23
24
|
if (!validatePackageJson(this.packageConfig)) {
|
|
24
25
|
throw new Error(endent`
|
|
25
26
|
package.json invalid
|
|
@@ -30,7 +31,7 @@ export default async function (options) {
|
|
|
30
31
|
await this.depcheck();
|
|
31
32
|
}
|
|
32
33
|
const runDockerTests = !isCI() || !(_ref = ['win32', 'darwin'], includes(process.platform)(_ref));
|
|
33
|
-
return execa(this.packageConfig.type === 'module' ? packageName`c8` : packageName`nyc`, ['--reporter', 'lcov', '--reporter', 'text', '--cwd', process.cwd(), '--all', ...(_this$config$coverage = this.config.coverageFileExtensions, flatMap(extension => ['--extension', extension])(_this$config$coverage)), '--exclude', '**/*.spec.js', '--exclude', 'coverage', '--exclude', 'tmp-*', '--exclude', 'dist', 'mocha', '--ui', packageName`mocha-ui-exports-auto-describe`, '--require', packageName`@dword-design/babel-register`, '--require', packageName`@dword-design/pretest`, '--file', require.resolve('@dword-design/setup-test'), ...(runDockerTests ? [] : ['--ignore', '**/*.usesdocker.spec.js']), '--timeout', 130000, ...(options.grep ? ['--grep', options.grep] : []), ...(process.platform === 'win32' ? ['--exit'] : [])
|
|
34
|
+
return execa(this.packageConfig.type === 'module' ? packageName`c8` : packageName`nyc`, ['--reporter', 'lcov', '--reporter', 'text', '--cwd', process.cwd(), '--all', ...(_this$config$coverage = this.config.coverageFileExtensions, flatMap(extension => ['--extension', extension])(_this$config$coverage)), '--exclude', '**/*.spec.js', '--exclude', 'coverage', '--exclude', 'tmp-*', '--exclude', 'dist', 'mocha', '--ui', packageName`mocha-ui-exports-auto-describe`, '--require', packageName`@dword-design/babel-register`, '--require', packageName`@dword-design/pretest`, '--file', require.resolve('@dword-design/setup-test'), ...(runDockerTests ? [] : ['--ignore', '**/*.usesdocker.spec.js']), '--timeout', 130000, ...(options.patterns.length > 0 ? options.patterns : ['{,!(node_modules)/**/}*.spec.js']), ...(options.grep ? ['--grep', options.grep] : []), ...(process.platform === 'win32' ? ['--exit'] : [])], {
|
|
34
35
|
env: {
|
|
35
36
|
NODE_ENV: 'test',
|
|
36
37
|
...(this.packageConfig.type === 'module' && {
|