js-build-tools 2.3.0 → 2.4.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.
@@ -1,50 +1,50 @@
1
- "use strict";
2
-
1
+ "use strict";
2
+
3
3
  /**
4
4
  * Multilayered node tree-like structure with parent references
5
5
  * @memberOf module:testHelpers
6
6
  * @type {Object.<string, string|Object|Array>}
7
- */
8
- const circularObject = {
9
- name: 'root',
10
- parent: {},
11
- body: {},
12
- head: {},
13
- children: []
14
- };
15
- circularObject.children = [{
16
- name: 'body',
17
- parent: {},
18
- children: []
19
- }, {
20
- name: 'head',
21
- parent: {},
22
- children: []
23
- }];
24
- circularObject.body = circularObject.children[0];
25
- circularObject.head = circularObject.children[1];
26
- circularObject.body.parent = circularObject;
27
- circularObject.head.parent = circularObject;
28
- circularObject.body.children = [{
29
- name: 'body child one',
30
- parent: {},
31
- children: []
32
- }, {
33
- name: 'body child two',
34
- parent: {},
35
- children: []
36
- }];
37
- circularObject.body.children[0].parent = circularObject.body;
38
- circularObject.body.children[1].parent = circularObject.body;
39
- circularObject.head.children = [{
40
- name: 'head child one',
41
- parent: {},
42
- children: []
43
- }, {
44
- name: 'head child two',
45
- parent: {},
46
- children: []
47
- }];
48
- circularObject.head.children[0].parent = circularObject.head;
49
- circularObject.head.children[1].parent = circularObject.head;
7
+ */
8
+ const circularObject = {
9
+ name: 'root',
10
+ parent: {},
11
+ body: {},
12
+ head: {},
13
+ children: []
14
+ };
15
+ circularObject.children = [{
16
+ name: 'body',
17
+ parent: {},
18
+ children: []
19
+ }, {
20
+ name: 'head',
21
+ parent: {},
22
+ children: []
23
+ }];
24
+ circularObject.body = circularObject.children[0];
25
+ circularObject.head = circularObject.children[1];
26
+ circularObject.body.parent = circularObject;
27
+ circularObject.head.parent = circularObject;
28
+ circularObject.body.children = [{
29
+ name: 'body child one',
30
+ parent: {},
31
+ children: []
32
+ }, {
33
+ name: 'body child two',
34
+ parent: {},
35
+ children: []
36
+ }];
37
+ circularObject.body.children[0].parent = circularObject.body;
38
+ circularObject.body.children[1].parent = circularObject.body;
39
+ circularObject.head.children = [{
40
+ name: 'head child one',
41
+ parent: {},
42
+ children: []
43
+ }, {
44
+ name: 'head child two',
45
+ parent: {},
46
+ children: []
47
+ }];
48
+ circularObject.head.children[0].parent = circularObject.head;
49
+ circularObject.head.children[1].parent = circularObject.head;
50
50
  module.exports = circularObject;
@@ -1,5 +1,5 @@
1
- "use strict";
2
-
1
+ "use strict";
2
+
3
3
  /**
4
4
  * Simple way to count string occurrences for testing.
5
5
  * @function
@@ -7,6 +7,6 @@
7
7
  * @param {string} content
8
8
  * @param {string} search
9
9
  * @returns {number}
10
- */
11
- const countMatches = (content, search) => content.split(search).length - 1;
10
+ */
11
+ const countMatches = (content, search) => content.split(search).length - 1;
12
12
  module.exports = countMatches;
@@ -1,20 +1,20 @@
1
- "use strict";
2
-
1
+ "use strict";
2
+
3
3
  /**
4
4
  * Sample object with deep references.
5
5
  * @memberOf module:testHelpers
6
6
  * @type {Object.<string, string|number|Object>}
7
- */
8
- const deepReferenceObject = {
9
- object1: {
10
- name: 'someName',
11
- object2: {
12
- age: 12,
13
- array1: ['someString', 'anotherString']
14
- },
15
- array2: [89, 32]
16
- },
17
- title: 'Some Title',
18
- item: 45
19
- };
7
+ */
8
+ const deepReferenceObject = {
9
+ object1: {
10
+ name: 'someName',
11
+ object2: {
12
+ age: 12,
13
+ array1: ['someString', 'anotherString']
14
+ },
15
+ array2: [89, 32]
16
+ },
17
+ title: 'Some Title',
18
+ item: 45
19
+ };
20
20
  module.exports = deepReferenceObject;
@@ -1,33 +1,33 @@
1
- "use strict";
2
-
1
+ "use strict";
2
+
3
3
  /**
4
4
  * Sample of domItem child with nested child and optional details
5
5
  * @memberOf module:testHelpers
6
6
  * @type {Object.<string, string|number|Array|Object>}
7
- */
8
- const domItem = [{
9
- attributes: {
10
- className: 'row',
11
- style: {}
12
- },
13
- axis: 'y',
14
- children: [{
15
- attributes: {
16
- style: {}
17
- },
18
- axis: 'x',
19
- children: [],
20
- element: {},
21
- eventListeners: {},
22
- hasShip: false,
23
- isHit: false,
24
- parentItem: {},
25
- point: {},
26
- tagName: 'div'
27
- }],
28
- element: null,
29
- eventListeners: {},
30
- parentItem: {},
31
- tagName: 'div'
32
- }];
7
+ */
8
+ const domItem = [{
9
+ attributes: {
10
+ className: 'row',
11
+ style: {}
12
+ },
13
+ axis: 'y',
14
+ children: [{
15
+ attributes: {
16
+ style: {}
17
+ },
18
+ axis: 'x',
19
+ children: [],
20
+ element: {},
21
+ eventListeners: {},
22
+ hasShip: false,
23
+ isHit: false,
24
+ parentItem: {},
25
+ point: {},
26
+ tagName: 'div'
27
+ }],
28
+ element: null,
29
+ eventListeners: {},
30
+ parentItem: {},
31
+ tagName: 'div'
32
+ }];
33
33
  module.exports = domItem;
@@ -1,20 +1,20 @@
1
- "use strict";
2
-
1
+ "use strict";
2
+
3
3
  /**
4
4
  * Sample of jsonDom object containing empty nested array and objects
5
5
  * @memberOf module:testHelpers
6
6
  * @type {Object.<string, string|number|Array|Object>}
7
- */
8
- const jsonDom = {
9
- tagName: 'div',
10
- attributes: {
11
- style: {},
12
- className: 'column'
13
- },
14
- element: null,
15
- eventListeners: {},
16
- parentItem: {},
17
- children: [],
18
- axis: 'x'
19
- };
7
+ */
8
+ const jsonDom = {
9
+ tagName: 'div',
10
+ attributes: {
11
+ style: {},
12
+ className: 'column'
13
+ },
14
+ element: null,
15
+ eventListeners: {},
16
+ parentItem: {},
17
+ children: [],
18
+ axis: 'x'
19
+ };
20
20
  module.exports = jsonDom;
@@ -1,23 +1,23 @@
1
- "use strict";
2
-
1
+ "use strict";
2
+
3
3
  /**
4
4
  * Sample LinkedList for testing circular references.
5
5
  * @memberOf module:testHelpers
6
6
  * @type {Object.<string, string|Object>}
7
- */
8
- const linkedList = {
9
- name: 'one',
10
- prev: null,
11
- next: null
12
- };
13
- linkedList.next = {
14
- name: 'two',
15
- prev: linkedList,
16
- next: null
17
- };
18
- linkedList.next.next = {
19
- name: 'three',
20
- prev: linkedList.next,
21
- next: null
22
- };
7
+ */
8
+ const linkedList = {
9
+ name: 'one',
10
+ prev: null,
11
+ next: null
12
+ };
13
+ linkedList.next = {
14
+ name: 'two',
15
+ prev: linkedList,
16
+ next: null
17
+ };
18
+ linkedList.next.next = {
19
+ name: 'three',
20
+ prev: linkedList.next,
21
+ next: null
22
+ };
23
23
  module.exports = linkedList;
@@ -1,5 +1,5 @@
1
- "use strict";
2
-
1
+ "use strict";
2
+
3
3
  /**
4
4
  * Log out an object in a nicely formatted way.
5
5
  * @function
@@ -8,14 +8,14 @@
8
8
  * @param {string} [label=logging]
9
9
  * @param {string} [outputType=log]
10
10
  * @returns {string|undefined}
11
- */
12
- const logObject = function (object) {
13
- let label = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'logging';
14
- let outputType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'log';
15
- const logger = outputType === 'string' ? (label, object) => `'${label}' | ` + JSON.stringify(object) : console[outputType];
16
- if (typeof require === 'undefined' || outputType === 'string') {
17
- return logger(label, object);
18
- }
19
- return logger(label, require('util').inspect(object, false, null, true));
20
- };
11
+ */
12
+ const logObject = function (object) {
13
+ let label = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'logging';
14
+ let outputType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'log';
15
+ const logger = outputType === 'string' ? (label, object) => `'${label}' | ` + JSON.stringify(object) : console[outputType];
16
+ if (typeof require === 'undefined' || outputType === 'string') {
17
+ return logger(label, object);
18
+ }
19
+ return logger(label, require('util').inspect(object, false, null, true));
20
+ };
21
21
  module.exports = logObject;
@@ -1,20 +1,20 @@
1
- "use strict";
2
-
1
+ "use strict";
2
+
3
3
  /**
4
4
  * Sample of object containing multiple references.
5
5
  * @memberOf module:testHelpers
6
6
  * @type {Object.<string, string|number|Object>}
7
- */
8
- const multiReferenceObject = {
9
- object1: {
10
- name: 'someName'
11
- },
12
- object2: {
13
- age: 12
14
- },
15
- array1: ['someString', 'anotherString'],
16
- array2: [89, 32],
17
- title: 'Some Title',
18
- item: 45
19
- };
7
+ */
8
+ const multiReferenceObject = {
9
+ object1: {
10
+ name: 'someName'
11
+ },
12
+ object2: {
13
+ age: 12
14
+ },
15
+ array1: ['someString', 'anotherString'],
16
+ array2: [89, 32],
17
+ title: 'Some Title',
18
+ item: 45
19
+ };
20
20
  module.exports = multiReferenceObject;
@@ -1,28 +1,28 @@
1
- "use strict";
2
-
1
+ "use strict";
2
+
3
3
  /**
4
4
  * Sample NodeTree for testing circular references and arrays.
5
5
  * @memberOf module:testHelpers
6
6
  * @type {Object.<string, string|Object|Array>}
7
- */
8
- const nodeTree = {
9
- name: 'one',
10
- parent: null,
11
- children: []
12
- };
13
- nodeTree.children[0] = {
14
- name: 'child one',
15
- parent: nodeTree,
16
- children: []
17
- };
18
- nodeTree.children[1] = {
19
- name: 'child two',
20
- parent: nodeTree,
21
- children: []
22
- };
23
- nodeTree.children[0].children[0] = {
24
- name: 'grandchild one',
25
- parent: nodeTree.children[0],
26
- children: []
27
- };
7
+ */
8
+ const nodeTree = {
9
+ name: 'one',
10
+ parent: null,
11
+ children: []
12
+ };
13
+ nodeTree.children[0] = {
14
+ name: 'child one',
15
+ parent: nodeTree,
16
+ children: []
17
+ };
18
+ nodeTree.children[1] = {
19
+ name: 'child two',
20
+ parent: nodeTree,
21
+ children: []
22
+ };
23
+ nodeTree.children[0].children[0] = {
24
+ name: 'grandchild one',
25
+ parent: nodeTree.children[0],
26
+ children: []
27
+ };
28
28
  module.exports = nodeTree;
package/dist/testFull.js CHANGED
@@ -1,23 +1,23 @@
1
- 'use strict'
2
-
3
- const gulpConfig = require('../gulp.config.js')
4
- const {
5
- runCLI
6
- } = require('jest')
7
-
1
+ 'use strict'
2
+
3
+ const gulpConfig = require('../gulp.config.js')
4
+ const {
5
+ runCLI
6
+ } = require('jest')
7
+
8
8
  /**
9
9
  * Run all tests with jest.
10
10
  * Configure where tests are located by using 'testPath'.
11
11
  * @function
12
12
  * @memberOf module:js-build-tools
13
13
  * @returns {Promise<*>}
14
- */
15
- const testFull = () => {
16
- let testPath = gulpConfig.get('testPath')
17
- if (!Array.isArray(testPath)) {
18
- // The testPath must be an array of strings
19
- testPath = [testPath]
20
- }
21
- return runCLI(gulpConfig.get('testOptions'), testPath)
22
- }
23
- module.exports = testFull
14
+ */
15
+ const testFull = () => {
16
+ let testPath = gulpConfig.get('testPath')
17
+ if (!Array.isArray(testPath)) {
18
+ // The testPath must be an array of strings
19
+ testPath = [testPath]
20
+ }
21
+ return runCLI(gulpConfig.get('testOptions'), testPath)
22
+ }
23
+ module.exports = testFull
@@ -1,5 +1,5 @@
1
- 'use strict'
2
-
1
+ 'use strict'
2
+
3
3
  /**
4
4
  * An assortment of objects that can be used in tests and some functions to help debug and write tests.
5
5
  * @file
@@ -7,27 +7,27 @@
7
7
  * @version 2.0.0
8
8
  * @module testHelpers
9
9
  * @memberOf module:js-build-tools
10
- */
11
-
12
- const circularObject = require('./test-helpers/circularObject')
13
- const countMatches = require('./test-helpers/countMatches')
14
- const deepReferenceObject = require('./test-helpers/deepReferenceObject')
15
- const domItem = require('./test-helpers/domItem')
16
- const jsonDom = require('./test-helpers/jsonDom')
17
- const linkedList = require('./test-helpers/linkedList')
18
- const logObject = require('./test-helpers/logObject')
19
- const multiReferenceObject = require('./test-helpers/multiReferenceObject')
20
- const nodeTree = require('./test-helpers/nodeTree')
21
- const setUp = require('./test-helpers/setUp')
22
- module.exports = {
23
- circularObject,
24
- countMatches,
25
- deepReferenceObject,
26
- domItem,
27
- jsonDom,
28
- linkedList,
29
- logObject,
30
- multiReferenceObject,
31
- nodeTree,
32
- setUp
33
- }
10
+ */
11
+
12
+ const circularObject = require('./test-helpers/circularObject')
13
+ const countMatches = require('./test-helpers/countMatches')
14
+ const deepReferenceObject = require('./test-helpers/deepReferenceObject')
15
+ const domItem = require('./test-helpers/domItem')
16
+ const jsonDom = require('./test-helpers/jsonDom')
17
+ const linkedList = require('./test-helpers/linkedList')
18
+ const logObject = require('./test-helpers/logObject')
19
+ const multiReferenceObject = require('./test-helpers/multiReferenceObject')
20
+ const nodeTree = require('./test-helpers/nodeTree')
21
+ const setUp = require('./test-helpers/setUp')
22
+ module.exports = {
23
+ circularObject,
24
+ countMatches,
25
+ deepReferenceObject,
26
+ domItem,
27
+ jsonDom,
28
+ linkedList,
29
+ logObject,
30
+ multiReferenceObject,
31
+ nodeTree,
32
+ setUp
33
+ }
package/dist/testQuick.js CHANGED
@@ -1,25 +1,25 @@
1
- 'use strict'
2
-
3
- const gulpConfig = require('../gulp.config.js')
4
- const {
5
- runCLI
6
- } = require('jest')
7
-
1
+ 'use strict'
2
+
3
+ const gulpConfig = require('../gulp.config.js')
4
+ const {
5
+ runCLI
6
+ } = require('jest')
7
+
8
8
  /**
9
9
  * Run the Jest tests for files which have been modified (based on git status).
10
10
  * Configure where tests are located by using 'testPath'.
11
11
  * @function
12
12
  * @memberOf module:js-build-tools
13
13
  * @returns {Promise<*>}
14
- */
15
- const testQuick = () => {
16
- let testPath = gulpConfig.get('testPath')
17
- if (!Array.isArray(testPath)) {
18
- // The testPath must be an array of strings
19
- testPath = [testPath]
20
- }
21
- return runCLI({
22
- onlyChanged: true
23
- }, testPath)
24
- }
25
- module.exports = testQuick
14
+ */
15
+ const testQuick = () => {
16
+ let testPath = gulpConfig.get('testPath')
17
+ if (!Array.isArray(testPath)) {
18
+ // The testPath must be an array of strings
19
+ testPath = [testPath]
20
+ }
21
+ return runCLI({
22
+ onlyChanged: true
23
+ }, testPath)
24
+ }
25
+ module.exports = testQuick
@@ -1,12 +1,12 @@
1
- 'use strict'
2
-
3
- const tsFor = require('./partials/tsFor')
4
-
1
+ 'use strict'
2
+
3
+ const tsFor = require('./partials/tsFor')
4
+
5
5
  /**
6
6
  * Simplified typescript task using tsFor.
7
7
  * @function
8
8
  * @memberOf module:js-build-tools
9
9
  * @returns {Function}
10
- */
11
- const typeScript = tsFor()
12
- module.exports = typeScript
10
+ */
11
+ const typeScript = tsFor()
12
+ module.exports = typeScript
package/dist/watchFull.js CHANGED
@@ -1,15 +1,15 @@
1
- 'use strict'
2
-
3
- const {
4
- beginWatcher,
5
- runOnChange
6
- } = require('./partials')
7
-
1
+ 'use strict'
2
+
3
+ const {
4
+ beginWatcher,
5
+ runOnChange
6
+ } = require('./partials')
7
+
8
8
  /**
9
9
  * Watch for changes and run the distribution for the changed files, then bundle and test the changed files.
10
10
  * @function
11
11
  * @memberOf module:js-build-tools
12
12
  * @returns {FSWatcher}
13
- */
14
- const watchFull = () => beginWatcher().on('change', runOnChange)
15
- module.exports = watchFull
13
+ */
14
+ const watchFull = () => beginWatcher().on('change', runOnChange)
15
+ module.exports = watchFull
package/dist/watchTest.js CHANGED
@@ -1,18 +1,18 @@
1
- 'use strict'
2
-
3
- const gulpConfig = require('../gulp.config.js')
4
- const {
5
- watch
6
- } = require('gulp')
7
- const testQuick = require('./testQuick')
8
-
1
+ 'use strict'
2
+
3
+ const gulpConfig = require('../gulp.config.js')
4
+ const {
5
+ watch
6
+ } = require('gulp')
7
+ const testQuick = require('./testQuick')
8
+
9
9
  /**
10
10
  * Watch for changes and run the tests.
11
11
  * @function
12
12
  * @memberOf module:js-build-tools
13
13
  * @returns {*}
14
- */
15
- const watchTest = () => watch(gulpConfig.get('watchSearch'), {
16
- ignoreInitial: false
17
- }, testQuick)
18
- module.exports = watchTest
14
+ */
15
+ const watchTest = () => watch(gulpConfig.get('watchSearch'), {
16
+ ignoreInitial: false
17
+ }, testQuick)
18
+ module.exports = watchTest