@loopback/build 6.0.0 → 6.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/CHANGELOG.md +11 -0
- package/index.js +2 -0
- package/package.json +4 -3
- package/src/merge-mocha-configs.js +39 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [6.1.0](https://github.com/strongloop/loopback-next/compare/@loopback/build@6.0.0...@loopback/build@6.1.0) (2020-06-30)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **build:** add a helper to merge mocha config objects ([3ce9eef](https://github.com/strongloop/loopback-next/commit/3ce9eefdb3a286f2d2b2690ec471f00d8124efb9))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [6.0.0](https://github.com/strongloop/loopback-next/compare/@loopback/build@5.4.3...@loopback/build@6.0.0) (2020-06-23)
|
|
7
18
|
|
|
8
19
|
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"url": "https://github.com/strongloop/loopback-next.git",
|
|
7
7
|
"directory": "packages/build"
|
|
8
8
|
},
|
|
9
|
-
"version": "6.
|
|
9
|
+
"version": "6.1.0",
|
|
10
10
|
"engines": {
|
|
11
11
|
"node": ">=10.16"
|
|
12
12
|
},
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"access": "public"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@loopback/eslint-config": "^8.0.
|
|
21
|
+
"@loopback/eslint-config": "^8.0.3",
|
|
22
22
|
"@types/mocha": "^7.0.2",
|
|
23
23
|
"@types/node": "^10.17.26",
|
|
24
24
|
"cross-spawn": "^7.0.3",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"eslint": "^7.3.1",
|
|
27
27
|
"fs-extra": "^9.0.1",
|
|
28
28
|
"glob": "^7.1.6",
|
|
29
|
+
"lodash": "^4.17.15",
|
|
29
30
|
"mocha": "^8.0.1",
|
|
30
31
|
"nyc": "^15.1.0",
|
|
31
32
|
"prettier": "^2.0.5",
|
|
@@ -45,5 +46,5 @@
|
|
|
45
46
|
"test": "npm run mocha",
|
|
46
47
|
"mocha": "node bin/run-mocha --timeout 30000 \"test/integration/*.js\" \"test/unit/*.js\""
|
|
47
48
|
},
|
|
48
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "b89db3d3b8be6a36e63e91c2331d217fda7538de"
|
|
49
50
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright IBM Corp. 2017,2020. All Rights Reserved.
|
|
2
|
+
// Node module: @loopback/build
|
|
3
|
+
// This file is licensed under the MIT License.
|
|
4
|
+
// License text available at https://opensource.org/licenses/MIT
|
|
5
|
+
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
const debug = require('debug')('loopback:build:merge-mocha-configs');
|
|
9
|
+
const {assignWith} = require('lodash');
|
|
10
|
+
|
|
11
|
+
module.exports = mergeMochaConfigs;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Merge multiple Mocha configuration files into a single one.
|
|
15
|
+
*
|
|
16
|
+
* @param {MochaConfig[]} configs A list of Mocha configuration objects
|
|
17
|
+
* as provided by `.mocharc.js` files.
|
|
18
|
+
*/
|
|
19
|
+
function mergeMochaConfigs(...configs) {
|
|
20
|
+
debug('Merging mocha configurations', ...configs);
|
|
21
|
+
const result = assignWith({}, ...configs, assignMochaConfigEntry);
|
|
22
|
+
debug('Merged config:', result);
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function assignMochaConfigEntry(targetValue, sourceValue, key) {
|
|
27
|
+
switch (key) {
|
|
28
|
+
case 'timeout':
|
|
29
|
+
return Math.max(targetValue || 0, sourceValue);
|
|
30
|
+
case 'require':
|
|
31
|
+
if (Array.isArray(sourceValue)) {
|
|
32
|
+
debug('Adding an array of files to require:', sourceValue);
|
|
33
|
+
return [...(targetValue || []), ...sourceValue];
|
|
34
|
+
} else {
|
|
35
|
+
debug('Adding a single file to require:', sourceValue);
|
|
36
|
+
return [...(targetValue || []), sourceValue];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|