8000 Log the params passed to test.js to the console. · lodash/lodash@72ae25b · GitHub
[go: up one dir, main page]

Skip to content

Commit 72ae25b

Browse files
committed
Log the params passed to test.js to the console.
1 parent 02e5cc1 commit 72ae25b

File tree

1 file changed

+50
-50
lines changed

1 file changed

+50
-50
lines changed

test/test.js

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,36 @@
11
;(function(root, undefined) {
22
'use strict';
33

4-
/** Object shortcuts */
5-
var amd = root.define && define.amd,
6-
phantom = root.phantom,
4+
/** Method and object shortcuts */
5+
var phantom = root.phantom,
6+
amd = root.define && define.amd,
7+
document = !phantom && root.document,
8+
body = document && document.body,
9+
create = Object.create,
10+
freeze = Object.freeze,
11+
params = root.arguments,
712
process = root.process,
8-
system = root.system;
13+
push = Array.prototype.push,
14+
slice = Array.< 10000 span class=pl-c1>prototype.slice,
15+
system = root.system,
16+
toString = Object.prototype.toString,
17+
Worker = document && root.Worker;
918

1019
/** The file path of the Lo-Dash file to test */
1120
var filePath = (function() {
1221
var min = 0,
13-
args = root.arguments,
1422
result = [];
1523

1624
if (phantom) {
17-
result = phantom.args;
25+
result = params = phantom.args;
1826
} else if (system) {
1927
min = 1;
20-
result = system.args;
28+
result = params = system.args;
2129
} else if (process) {
2230
min = 2;
23-
result = process.argv;
24-
} else if (args) {
25-
result = args;
31+
result = params = process.argv;
32+
} else if (params) {
33+
result = params;
2634
}
2735
var last = result[result.length - 1];
2836
result = (result.length > min && !/test(?:\.js)?$/.test(last)) ? last : '../lodash.js';
@@ -36,21 +44,50 @@
3644
return result;
3745
}());
3846

39-
/** The basename of the Lo-Dash file to test */
40-
var basename = /[\w.-]+$/.exec(filePath)[0];
41-
4247
/** The `ui` object */
4348
var ui = root.ui || (root.ui = {
4449
'buildPath': filePath,
4550
'loaderPath': '',
4651
'urlParams': {}
4752
});
4853

54+
/** The basename of the Lo-Dash file to test */
55+
var basename = /[\w.-]+$/< 10000 /span>.exec(filePath)[0];
56+
4957
/** Used to indicate testing a modularized build */
5058
var isModularize = ui.isModularize || /\b(?:commonjs|(index|main)\.js|lodash-(?:amd|node)|modularize|npm)\b/.test([ui.buildPath, ui.urlParams.build, basename]);
5159

60+
/** Detect if testing `npm` modules */
61+
var isNpm = isModularize && /\bnpm\b/.test([ui.buildPath, ui.urlParams.build]);
62+
63+
/** Detects if running in a PhantomJS web page */
64+
var isPhantomPage = typeof callPhantom == 'function';
65+
66+
/** Detect if running in Rhino */
67+
var isRhino = root.java && typeof global == 'function' && global().Array === root.Array;
68+
69+
/** Use a single "load" function */
70+
var load = !amd && typeof require == 'function' ? require : root.load;
71+
72+
/** The unit testing framework */
73+
var QUnit = (function() {
74+
var noop = Function.prototype;
75+
return root.QUnit || (
76+
root.addEventListener || (root.addEventListener = noop),
77+
root.setTimeout || (root.setTimeout = noop),
78+
root.QUnit = load('../vendor/qunit/qunit/qunit.js') || root.QUnit,
79+
(load('../vendor/qunit-clib/qunit-clib.js') || { 'runInContext': noop }).runInContext(root),
80+
addEventListener === noop && delete root.addEventListener,
81+
root.QUnit
82+
);
83+
}());
84+
5285
/*--------------------------------------------------------------------------*/
5386

87+
// log params passed to `test.js`
88+
if (params) {
89+
console.log('test.js invoked with arguments: ' + JSON.stringify(slice.call(params)));
90+
}
5491
// exit early if going to run tests in a PhantomJS web page
5592
if (phantom && isModularize) {
5693
var page = require('webpage').create();
@@ -91,41 +128,6 @@
91128

92129
/*--------------------------------------------------------------------------*/
93130

94-
/** Method and object shortcuts */
95-
var document = !phantom && root.document,
96-
body = document && document.body,
97-
create = Object.create,
98-
freeze = Object.freeze,
99-
push = Array.prototype.push,
100-
slice = Array.prototype.slice,
101-
toString = Object.prototype.toString,
102-
Worker = document && root.Worker;
103-
104-
/** Detect if testing `npm` modules */
105-
var isNpm = isModularize && /\bnpm\b/.test([ui.buildPath, ui.urlParams.build]);
106-
107-
/** Detects if running in a PhantomJS web page */
108-
var isPhantomPage = typeof callPhantom == 'function';
109-
110-
/** Detect if running in Rhino */
111-
var isRhino = root.java && typeof global == 'function' && global().Array === root.Array;
112-
113-
/** Use a single "load" function */
114-
var load = !amd && typeof require == 'function' ? require : root.load;
115-
116-
/** The unit testing framework */
117-
var QUnit = (function() {
118-
var noop = Function.prototype;
119-
return root.QUnit || (
120-
root.addEventListener || (root.addEventListener = noop),
121-
root.setTimeout || (root.setTimeout = noop),
122-
root.QUnit = load('../vendor/qunit/qunit/qunit.js') || root.QUnit,
123-
(load('../vendor/qunit-clib/qunit-clib.js') || { 'runInContext': noop }).runInContext(root),
124-
addEventListener === noop && delete root.addEventListener,
125-
root.QUnit
126-
);
127-
}());
128-
129131
/** The `lodash` function to test */
130132
var _ = root._ || (root._ = (
131133
_ = load(filePath) || root._,
@@ -163,8 +165,6 @@
163165
/** Used to check problem JScript properties too */
164166
var shadowedObject = _.invert(shadowedProps);
165167

166-
/*--------------------------------------------------------------------------*/
167-
168168
/**
169169
* Skips a given number of tests with a passing result.
170170
*

0 commit comments

Comments
 (0)
0