stylus-source 0.28.2 → 0.29.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/vendor/Readme.md +1 -1
- data/vendor/lib/functions/index.js +75 -1
- data/vendor/lib/functions/url.js +11 -12
- data/vendor/lib/lexer.js +2 -1
- data/vendor/lib/stylus.js +1 -1
- data/vendor/lib/visitor/compiler.js +1 -1
- data/vendor/lib/visitor/evaluator.js +2 -0
- data/vendor/node_modules/cssom/package.json +0 -3
- data/vendor/node_modules/mocha/History.md +21 -0
- data/vendor/node_modules/mocha/Makefile +2 -2
- data/vendor/node_modules/mocha/_mocha.js +141 -48
- data/vendor/node_modules/mocha/bin/_mocha +53 -61
- data/vendor/node_modules/mocha/bin/mocha +3 -0
- data/vendor/node_modules/mocha/lib/interfaces/bdd.js +23 -6
- data/vendor/node_modules/mocha/lib/mocha.js +55 -4
- data/vendor/node_modules/mocha/lib/reporters/base.js +5 -5
- data/vendor/node_modules/mocha/lib/reporters/dot.js +5 -4
- data/vendor/node_modules/mocha/lib/reporters/html.js +25 -12
- data/vendor/node_modules/mocha/lib/reporters/landing.js +2 -2
- data/vendor/node_modules/mocha/lib/reporters/min.js +2 -2
- data/vendor/node_modules/mocha/lib/reporters/nyan.js +6 -6
- data/vendor/node_modules/mocha/lib/reporters/progress.js +1 -1
- data/vendor/node_modules/mocha/lib/reporters/xunit.js +5 -1
- data/vendor/node_modules/mocha/lib/runnable.js +1 -1
- data/vendor/node_modules/mocha/lib/runner.js +3 -3
- data/vendor/node_modules/mocha/lib/suite.js +7 -1
- data/vendor/node_modules/mocha/lib/utils.js +1 -1
- data/vendor/node_modules/mocha/mocha.css +18 -1
- data/vendor/node_modules/mocha/mocha.js +141 -48
- data/vendor/node_modules/mocha/package.json +6 -3
- data/vendor/node_modules/mocha/test.js +3 -5
- data/vendor/node_modules/should/History.md +11 -0
- data/vendor/node_modules/should/Readme.md +22 -10
- data/vendor/node_modules/should/lib/should.js +70 -62
- data/vendor/node_modules/should/package.json +5 -2
- data/vendor/node_modules/should/test/should.test.js +64 -0
- data/vendor/package.json +1 -1
- data/vendor/testing/foo.css +3 -0
- data/vendor/testing/index.js +1 -0
- data/vendor/testing/small.styl +12 -10
- metadata +3 -16
- data/vendor/node_modules/mocha/editors/JavaScript mocha.tmbundle/Snippets/bdd - after each.tmSnippet +0 -16
- data/vendor/node_modules/mocha/editors/JavaScript mocha.tmbundle/Snippets/bdd - after.tmSnippet +0 -16
- data/vendor/node_modules/mocha/editors/JavaScript mocha.tmbundle/Snippets/bdd - before each.tmSnippet +0 -16
- data/vendor/node_modules/mocha/editors/JavaScript mocha.tmbundle/Snippets/bdd - before.tmSnippet +0 -16
- data/vendor/node_modules/mocha/editors/JavaScript mocha.tmbundle/Snippets/bdd - it.tmSnippet +0 -16
- data/vendor/node_modules/mocha/editors/JavaScript mocha.tmbundle/Snippets/untitled.tmSnippet +0 -16
- data/vendor/node_modules/mocha/editors/JavaScript mocha.tmbundle/info.plist +0 -19
- data/vendor/node_modules/mocha/support/compile.js +0 -154
- data/vendor/node_modules/mocha/support/foot.js +0 -1
- data/vendor/node_modules/mocha/support/head.js +0 -2
- data/vendor/node_modules/mocha/support/tail.js +0 -150
- data/vendor/node_modules/mocha/support/template.html +0 -16
@@ -535,11 +535,6 @@ module.exports = function(suite){
|
|
535
535
|
|
536
536
|
suite.on('pre-require', function(context){
|
537
537
|
|
538
|
-
// noop variants
|
539
|
-
|
540
|
-
context.xdescribe = function(){};
|
541
|
-
context.xit = function(){};
|
542
|
-
|
543
538
|
/**
|
544
539
|
* Execute before running tests.
|
545
540
|
*/
|
@@ -572,6 +567,18 @@ module.exports = function(suite){
|
|
572
567
|
suites[0].afterEach(fn);
|
573
568
|
};
|
574
569
|
|
570
|
+
/**
|
571
|
+
* Pending describe.
|
572
|
+
*/
|
573
|
+
|
574
|
+
context.xdescribe = context.xcontext = function(title, fn){
|
575
|
+
var suite = Suite.create(suites[0], title);
|
576
|
+
suite.pending = true;
|
577
|
+
suites.unshift(suite);
|
578
|
+
fn();
|
579
|
+
suites.shift();
|
580
|
+
};
|
581
|
+
|
575
582
|
/**
|
576
583
|
* Describe a "suite" with the given `title`
|
577
584
|
* and callback `fn` containing nested suites
|
@@ -592,7 +599,17 @@ module.exports = function(suite){
|
|
592
599
|
*/
|
593
600
|
|
594
601
|
context.it = context.specify = function(title, fn){
|
595
|
-
suites[0]
|
602
|
+
var suite = suites[0];
|
603
|
+
if (suite.pending) var fn = null;
|
604
|
+
suite.addTest(new Test(title, fn));
|
605
|
+
};
|
606
|
+
|
607
|
+
/**
|
608
|
+
* Pending test case.
|
609
|
+
*/
|
610
|
+
|
611
|
+
context.xit = context.xspecify = function(title){
|
612
|
+
context.it(title);
|
596
613
|
};
|
597
614
|
});
|
598
615
|
};
|
@@ -983,13 +1000,15 @@ Mocha.prototype.ui = function(name){
|
|
983
1000
|
* @api private
|
984
1001
|
*/
|
985
1002
|
|
986
|
-
Mocha.prototype.loadFiles = function(){
|
1003
|
+
Mocha.prototype.loadFiles = function(fn){
|
987
1004
|
var suite = this.suite;
|
1005
|
+
var pending = this.files.length;
|
988
1006
|
this.files.forEach(function(file){
|
989
1007
|
file = path.resolve(file);
|
990
1008
|
suite.emit('pre-require', global, file);
|
991
1009
|
suite.emit('require', require(file), file);
|
992
1010
|
suite.emit('post-require', global, file);
|
1011
|
+
--pending || (fn && fn());
|
993
1012
|
});
|
994
1013
|
};
|
995
1014
|
|
@@ -999,7 +1018,7 @@ Mocha.prototype.loadFiles = function(){
|
|
999
1018
|
* @api private
|
1000
1019
|
*/
|
1001
1020
|
|
1002
|
-
Mocha.prototype.
|
1021
|
+
Mocha.prototype._growl = function(runner, reporter) {
|
1003
1022
|
var notify = require('growl');
|
1004
1023
|
|
1005
1024
|
runner.on('end', function(){
|
@@ -1032,6 +1051,55 @@ Mocha.prototype.grep = function(re){
|
|
1032
1051
|
return this;
|
1033
1052
|
};
|
1034
1053
|
|
1054
|
+
/**
|
1055
|
+
* Invert `.grep()` matches.
|
1056
|
+
*
|
1057
|
+
* @return {Mocha}
|
1058
|
+
* @api public
|
1059
|
+
*/
|
1060
|
+
|
1061
|
+
Mocha.prototype.invert = function(){
|
1062
|
+
this.options.invert = true;
|
1063
|
+
return this;
|
1064
|
+
};
|
1065
|
+
|
1066
|
+
/**
|
1067
|
+
* Ignore global leaks.
|
1068
|
+
*
|
1069
|
+
* @return {Mocha}
|
1070
|
+
* @api public
|
1071
|
+
*/
|
1072
|
+
|
1073
|
+
Mocha.prototype.ignoreLeaks = function(){
|
1074
|
+
this.options.ignoreLeaks = true;
|
1075
|
+
return this;
|
1076
|
+
};
|
1077
|
+
|
1078
|
+
/**
|
1079
|
+
* Enable growl support.
|
1080
|
+
*
|
1081
|
+
* @return {Mocha}
|
1082
|
+
* @api public
|
1083
|
+
*/
|
1084
|
+
|
1085
|
+
Mocha.prototype.growl = function(){
|
1086
|
+
this.options.growl = true;
|
1087
|
+
return this;
|
1088
|
+
};
|
1089
|
+
|
1090
|
+
/**
|
1091
|
+
* Ignore `globals`.
|
1092
|
+
*
|
1093
|
+
* @param {Array} globals
|
1094
|
+
* @return {Mocha}
|
1095
|
+
* @api public
|
1096
|
+
*/
|
1097
|
+
|
1098
|
+
Mocha.prototype.globals = function(globals){
|
1099
|
+
this.options.globals = globals;
|
1100
|
+
return this;
|
1101
|
+
};
|
1102
|
+
|
1035
1103
|
/**
|
1036
1104
|
* Run tests and invoke `fn()` when complete.
|
1037
1105
|
*
|
@@ -1047,9 +1115,9 @@ Mocha.prototype.run = function(fn){
|
|
1047
1115
|
var runner = new exports.Runner(suite);
|
1048
1116
|
var reporter = new this._reporter(runner);
|
1049
1117
|
runner.ignoreLeaks = options.ignoreLeaks;
|
1050
|
-
if (options.grep) runner.grep(options.grep);
|
1118
|
+
if (options.grep) runner.grep(options.grep, options.invert);
|
1051
1119
|
if (options.globals) runner.globals(options.globals);
|
1052
|
-
if (options.growl) this.
|
1120
|
+
if (options.growl) this._growl(runner, reporter);
|
1053
1121
|
return runner.run(fn);
|
1054
1122
|
};
|
1055
1123
|
|
@@ -1132,7 +1200,7 @@ exports.colors = {
|
|
1132
1200
|
|
1133
1201
|
var color = exports.color = function(type, str) {
|
1134
1202
|
if (!exports.useColors) return str;
|
1135
|
-
return '\
|
1203
|
+
return '\u001b[' + exports.colors[type] + 'm' + str + '\u001b[0m';
|
1136
1204
|
};
|
1137
1205
|
|
1138
1206
|
/**
|
@@ -1155,19 +1223,19 @@ exports.window = {
|
|
1155
1223
|
|
1156
1224
|
exports.cursor = {
|
1157
1225
|
hide: function(){
|
1158
|
-
process.stdout.write('\
|
1226
|
+
process.stdout.write('\u001b[?25l');
|
1159
1227
|
},
|
1160
1228
|
|
1161
1229
|
show: function(){
|
1162
|
-
process.stdout.write('\
|
1230
|
+
process.stdout.write('\u001b[?25h');
|
1163
1231
|
},
|
1164
1232
|
|
1165
1233
|
deleteLine: function(){
|
1166
|
-
process.stdout.write('\
|
1234
|
+
process.stdout.write('\u001b[2K');
|
1167
1235
|
},
|
1168
1236
|
|
1169
1237
|
beginningOfLine: function(){
|
1170
|
-
process.stdout.write('\
|
1238
|
+
process.stdout.write('\u001b[0G');
|
1171
1239
|
},
|
1172
1240
|
|
1173
1241
|
CR: function(){
|
@@ -1502,6 +1570,7 @@ function Dot(runner) {
|
|
1502
1570
|
var self = this
|
1503
1571
|
, stats = this.stats
|
1504
1572
|
, width = Base.window.width * .75 | 0
|
1573
|
+
, c = '․'
|
1505
1574
|
, n = 0;
|
1506
1575
|
|
1507
1576
|
runner.on('start', function(){
|
@@ -1509,21 +1578,21 @@ function Dot(runner) {
|
|
1509
1578
|
});
|
1510
1579
|
|
1511
1580
|
runner.on('pending', function(test){
|
1512
|
-
process.stdout.write(color('pending',
|
1581
|
+
process.stdout.write(color('pending', c));
|
1513
1582
|
});
|
1514
1583
|
|
1515
1584
|
runner.on('pass', function(test){
|
1516
1585
|
if (++n % width == 0) process.stdout.write('\n ');
|
1517
1586
|
if ('slow' == test.speed) {
|
1518
|
-
process.stdout.write(color('bright yellow',
|
1587
|
+
process.stdout.write(color('bright yellow', c));
|
1519
1588
|
} else {
|
1520
|
-
process.stdout.write(color(test.speed,
|
1589
|
+
process.stdout.write(color(test.speed, c));
|
1521
1590
|
}
|
1522
1591
|
});
|
1523
1592
|
|
1524
1593
|
runner.on('fail', function(test, err){
|
1525
1594
|
if (++n % width == 0) process.stdout.write('\n ');
|
1526
|
-
process.stdout.write(color('fail',
|
1595
|
+
process.stdout.write(color('fail', c));
|
1527
1596
|
});
|
1528
1597
|
|
1529
1598
|
runner.on('end', function(){
|
@@ -1628,8 +1697,8 @@ exports = module.exports = HTML;
|
|
1628
1697
|
|
1629
1698
|
var statsTemplate = '<ul id="stats">'
|
1630
1699
|
+ '<li class="progress"><canvas width="40" height="40"></canvas></li>'
|
1631
|
-
+ '<li class="passes">passes
|
1632
|
-
+ '<li class="failures">failures
|
1700
|
+
+ '<li class="passes"><a href="#">passes:</a> <em>0</em></li>'
|
1701
|
+
+ '<li class="failures"><a href="#">failures:</a> <em>0</em></li>'
|
1633
1702
|
+ '<li class="duration">duration: <em>0</em>s</li>'
|
1634
1703
|
+ '</ul>';
|
1635
1704
|
|
@@ -1650,7 +1719,9 @@ function HTML(runner) {
|
|
1650
1719
|
, stat = fragment(statsTemplate)
|
1651
1720
|
, items = stat.getElementsByTagName('li')
|
1652
1721
|
, passes = items[1].getElementsByTagName('em')[0]
|
1722
|
+
, passesLink = items[1].getElementsByTagName('a')[0]
|
1653
1723
|
, failures = items[2].getElementsByTagName('em')[0]
|
1724
|
+
, failuresLink = items[2].getElementsByTagName('a')[0]
|
1654
1725
|
, duration = items[3].getElementsByTagName('em')[0]
|
1655
1726
|
, canvas = stat.getElementsByTagName('canvas')[0]
|
1656
1727
|
, report = fragment('<ul id="report"></ul>')
|
@@ -1665,6 +1736,18 @@ function HTML(runner) {
|
|
1665
1736
|
|
1666
1737
|
if (!root) return error('#mocha div missing, add it to your document');
|
1667
1738
|
|
1739
|
+
// pass toggle
|
1740
|
+
on(passesLink, 'click', function () {
|
1741
|
+
var className = /pass/.test(report.className) ? '' : ' pass';
|
1742
|
+
report.className = report.className.replace(/fail|pass/g, '') + className;
|
1743
|
+
});
|
1744
|
+
|
1745
|
+
// failure toggle
|
1746
|
+
on(failuresLink, 'click', function () {
|
1747
|
+
var className = /fail/.test(report.className) ? '' : ' fail';
|
1748
|
+
report.className = report.className.replace(/fail|pass/g, '') + className;
|
1749
|
+
});
|
1750
|
+
|
1668
1751
|
root.appendChild(stat);
|
1669
1752
|
root.appendChild(report);
|
1670
1753
|
|
@@ -1732,17 +1815,16 @@ function HTML(runner) {
|
|
1732
1815
|
}
|
1733
1816
|
|
1734
1817
|
// toggle code
|
1735
|
-
var h2 = el.getElementsByTagName('h2')[0];
|
1736
|
-
|
1737
|
-
on(h2, 'click', function(){
|
1738
|
-
pre.style.display = 'none' == pre.style.display
|
1739
|
-
? 'block'
|
1740
|
-
: 'none';
|
1741
|
-
});
|
1742
|
-
|
1743
|
-
// code
|
1744
1818
|
// TODO: defer
|
1745
1819
|
if (!test.pending) {
|
1820
|
+
var h2 = el.getElementsByTagName('h2')[0];
|
1821
|
+
|
1822
|
+
on(h2, 'click', function(){
|
1823
|
+
pre.style.display = 'none' == pre.style.display
|
1824
|
+
? 'inline-block'
|
1825
|
+
: 'none';
|
1826
|
+
});
|
1827
|
+
|
1746
1828
|
var pre = fragment('<pre><code>%e</code></pre>', utils.clean(test.fn.toString()));
|
1747
1829
|
el.appendChild(pre);
|
1748
1830
|
pre.style.display = 'none';
|
@@ -1802,6 +1884,7 @@ function on(el, event, fn) {
|
|
1802
1884
|
el.attachEvent('on' + event, fn);
|
1803
1885
|
}
|
1804
1886
|
}
|
1887
|
+
|
1805
1888
|
}); // module: reporters/html.js
|
1806
1889
|
|
1807
1890
|
require.register("reporters/index.js", function(module, exports, require){
|
@@ -2192,14 +2275,14 @@ function Landing(runner) {
|
|
2192
2275
|
}
|
2193
2276
|
|
2194
2277
|
// render landing strip
|
2195
|
-
stream.write('\
|
2278
|
+
stream.write('\u001b[4F\n\n');
|
2196
2279
|
stream.write(runway());
|
2197
2280
|
stream.write('\n ');
|
2198
2281
|
stream.write(color('runway', Array(col).join('⋅')));
|
2199
2282
|
stream.write(plane)
|
2200
2283
|
stream.write(color('runway', Array(width - col).join('⋅') + '\n'));
|
2201
2284
|
stream.write(runway());
|
2202
|
-
stream.write('\
|
2285
|
+
stream.write('\u001b[0m');
|
2203
2286
|
});
|
2204
2287
|
|
2205
2288
|
runner.on('end', function(){
|
@@ -2409,9 +2492,9 @@ function Min(runner) {
|
|
2409
2492
|
|
2410
2493
|
runner.on('start', function(){
|
2411
2494
|
// clear screen
|
2412
|
-
process.stdout.write('\
|
2495
|
+
process.stdout.write('\u001b[2J');
|
2413
2496
|
// set cursor position
|
2414
|
-
process.stdout.write('\
|
2497
|
+
process.stdout.write('\u001b[1;3H');
|
2415
2498
|
});
|
2416
2499
|
|
2417
2500
|
runner.on('end', this.epilogue.bind(this));
|
@@ -2516,7 +2599,7 @@ NyanCat.prototype.drawScoreboard = function(){
|
|
2516
2599
|
|
2517
2600
|
function draw(color, n) {
|
2518
2601
|
write(' ');
|
2519
|
-
write('\
|
2602
|
+
write('\u001b[' + color + 'm' + n + '\u001b[0m');
|
2520
2603
|
write('\n');
|
2521
2604
|
}
|
2522
2605
|
|
@@ -2555,7 +2638,7 @@ NyanCat.prototype.drawRainbow = function(){
|
|
2555
2638
|
var self = this;
|
2556
2639
|
|
2557
2640
|
this.trajectories.forEach(function(line, index) {
|
2558
|
-
write('\
|
2641
|
+
write('\u001b[' + self.scoreboardWidth + 'C');
|
2559
2642
|
write(line.join(''));
|
2560
2643
|
write('\n');
|
2561
2644
|
});
|
@@ -2575,7 +2658,7 @@ NyanCat.prototype.drawNyanCat = function(status) {
|
|
2575
2658
|
var startWidth = this.scoreboardWidth + this.trajectories[0].length;
|
2576
2659
|
|
2577
2660
|
[0, 1, 2, 3].forEach(function(index) {
|
2578
|
-
write('\
|
2661
|
+
write('\u001b[' + startWidth + 'C');
|
2579
2662
|
|
2580
2663
|
switch (index) {
|
2581
2664
|
case 0:
|
@@ -2623,7 +2706,7 @@ NyanCat.prototype.drawNyanCat = function(status) {
|
|
2623
2706
|
*/
|
2624
2707
|
|
2625
2708
|
NyanCat.prototype.cursorUp = function(n) {
|
2626
|
-
write('\
|
2709
|
+
write('\u001b[' + n + 'A');
|
2627
2710
|
};
|
2628
2711
|
|
2629
2712
|
/**
|
@@ -2634,7 +2717,7 @@ NyanCat.prototype.cursorUp = function(n) {
|
|
2634
2717
|
*/
|
2635
2718
|
|
2636
2719
|
NyanCat.prototype.cursorDown = function(n) {
|
2637
|
-
write('\
|
2720
|
+
write('\u001b[' + n + 'B');
|
2638
2721
|
};
|
2639
2722
|
|
2640
2723
|
/**
|
@@ -2670,7 +2753,7 @@ NyanCat.prototype.generateColors = function(){
|
|
2670
2753
|
NyanCat.prototype.rainbowify = function(str){
|
2671
2754
|
var color = this.rainbowColors[this.colorIndex % this.rainbowColors.length];
|
2672
2755
|
this.colorIndex += 1;
|
2673
|
-
return '\
|
2756
|
+
return '\u001b[38;5;' + color + 'm' + str + '\u001b[0m';
|
2674
2757
|
};
|
2675
2758
|
|
2676
2759
|
/**
|
@@ -2754,7 +2837,7 @@ function Progress(runner, options) {
|
|
2754
2837
|
, i = width - n;
|
2755
2838
|
|
2756
2839
|
cursor.CR();
|
2757
|
-
process.stdout.write('\
|
2840
|
+
process.stdout.write('\u001b[J');
|
2758
2841
|
process.stdout.write(color('progress', ' ' + options.open));
|
2759
2842
|
process.stdout.write(Array(n).join(options.complete));
|
2760
2843
|
process.stdout.write(Array(i).join(options.incomplete));
|
@@ -3051,7 +3134,11 @@ function XUnit(runner) {
|
|
3051
3134
|
, tests = []
|
3052
3135
|
, self = this;
|
3053
3136
|
|
3054
|
-
runner.on('
|
3137
|
+
runner.on('pass', function(test){
|
3138
|
+
tests.push(test);
|
3139
|
+
});
|
3140
|
+
|
3141
|
+
runner.on('fail', function(test){
|
3055
3142
|
tests.push(test);
|
3056
3143
|
});
|
3057
3144
|
|
@@ -3136,7 +3223,7 @@ require.register("runnable.js", function(module, exports, require){
|
|
3136
3223
|
*/
|
3137
3224
|
|
3138
3225
|
var EventEmitter = require('browser/events').EventEmitter
|
3139
|
-
, debug = require('browser/debug')('runnable');
|
3226
|
+
, debug = require('browser/debug')('mocha:runnable');
|
3140
3227
|
|
3141
3228
|
/**
|
3142
3229
|
* Save timer references to avoid Sinon interfering (see GH-237).
|
@@ -3332,7 +3419,7 @@ require.register("runner.js", function(module, exports, require){
|
|
3332
3419
|
*/
|
3333
3420
|
|
3334
3421
|
var EventEmitter = require('browser/events').EventEmitter
|
3335
|
-
, debug = require('browser/debug')('runner')
|
3422
|
+
, debug = require('browser/debug')('mocha:runner')
|
3336
3423
|
, Test = require('./test')
|
3337
3424
|
, utils = require('./utils')
|
3338
3425
|
, filter = utils.filter
|
@@ -3741,9 +3828,9 @@ Runner.prototype.runSuite = function(suite, fn){
|
|
3741
3828
|
*/
|
3742
3829
|
|
3743
3830
|
Runner.prototype.uncaught = function(err){
|
3744
|
-
debug('uncaught exception');
|
3831
|
+
debug('uncaught exception %s', err.message);
|
3745
3832
|
var runnable = this.currentRunnable;
|
3746
|
-
if ('failed' == runnable.state) return;
|
3833
|
+
if (!runnable || 'failed' == runnable.state) return;
|
3747
3834
|
runnable.clearTimeout();
|
3748
3835
|
err.uncaught = true;
|
3749
3836
|
this.fail(runnable, err);
|
@@ -3825,7 +3912,7 @@ require.register("suite.js", function(module, exports, require){
|
|
3825
3912
|
*/
|
3826
3913
|
|
3827
3914
|
var EventEmitter = require('browser/events').EventEmitter
|
3828
|
-
, debug = require('browser/debug')('suite')
|
3915
|
+
, debug = require('browser/debug')('mocha:suite')
|
3829
3916
|
, utils = require('./utils')
|
3830
3917
|
, Hook = require('./hook');
|
3831
3918
|
|
@@ -3851,6 +3938,7 @@ exports = module.exports = Suite;
|
|
3851
3938
|
exports.create = function(parent, title){
|
3852
3939
|
var suite = new Suite(title, parent.ctx);
|
3853
3940
|
suite.parent = parent;
|
3941
|
+
if (parent.pending) suite.pending = true;
|
3854
3942
|
title = suite.fullTitle();
|
3855
3943
|
parent.addSuite(suite);
|
3856
3944
|
return suite;
|
@@ -3870,6 +3958,7 @@ function Suite(title, ctx) {
|
|
3870
3958
|
this.ctx = ctx;
|
3871
3959
|
this.suites = [];
|
3872
3960
|
this.tests = [];
|
3961
|
+
this.pending = false;
|
3873
3962
|
this._beforeEach = [];
|
3874
3963
|
this._beforeAll = [];
|
3875
3964
|
this._afterEach = [];
|
@@ -3943,6 +4032,7 @@ Suite.prototype.bail = function(bail){
|
|
3943
4032
|
*/
|
3944
4033
|
|
3945
4034
|
Suite.prototype.beforeAll = function(fn){
|
4035
|
+
if (this.pending) return this;
|
3946
4036
|
var hook = new Hook('"before all" hook', fn);
|
3947
4037
|
hook.parent = this;
|
3948
4038
|
hook.timeout(this.timeout());
|
@@ -3961,6 +4051,7 @@ Suite.prototype.beforeAll = function(fn){
|
|
3961
4051
|
*/
|
3962
4052
|
|
3963
4053
|
Suite.prototype.afterAll = function(fn){
|
4054
|
+
if (this.pending) return this;
|
3964
4055
|
var hook = new Hook('"after all" hook', fn);
|
3965
4056
|
hook.parent = this;
|
3966
4057
|
hook.timeout(this.timeout());
|
@@ -3979,6 +4070,7 @@ Suite.prototype.afterAll = function(fn){
|
|
3979
4070
|
*/
|
3980
4071
|
|
3981
4072
|
Suite.prototype.beforeEach = function(fn){
|
4073
|
+
if (this.pending) return this;
|
3982
4074
|
var hook = new Hook('"before each" hook', fn);
|
3983
4075
|
hook.parent = this;
|
3984
4076
|
hook.timeout(this.timeout());
|
@@ -3997,6 +4089,7 @@ Suite.prototype.beforeEach = function(fn){
|
|
3997
4089
|
*/
|
3998
4090
|
|
3999
4091
|
Suite.prototype.afterEach = function(fn){
|
4092
|
+
if (this.pending) return this;
|
4000
4093
|
var hook = new Hook('"after each" hook', fn);
|
4001
4094
|
hook.parent = this;
|
4002
4095
|
hook.timeout(this.timeout());
|
@@ -4136,7 +4229,7 @@ require.register("utils.js", function(module, exports, require){
|
|
4136
4229
|
var fs = require('browser/fs')
|
4137
4230
|
, path = require('browser/path')
|
4138
4231
|
, join = path.join
|
4139
|
-
, debug = require('browser/debug')('watch');
|
4232
|
+
, debug = require('browser/debug')('mocha:watch');
|
4140
4233
|
|
4141
4234
|
/**
|
4142
4235
|
* Ignored directories.
|
@@ -11,15 +11,15 @@ var program = require('commander')
|
|
11
11
|
, vm = require('vm')
|
12
12
|
, resolve = path.resolve
|
13
13
|
, exists = fs.existsSync || path.existsSync
|
14
|
-
,
|
15
|
-
, utils =
|
16
|
-
, reporters =
|
17
|
-
, interfaces =
|
18
|
-
,
|
19
|
-
, Runner = mocha.Runner
|
20
|
-
, Suite = mocha.Suite
|
14
|
+
, Mocha = require('../')
|
15
|
+
, utils = Mocha.utils
|
16
|
+
, reporters = Mocha.reporters
|
17
|
+
, interfaces = Mocha.interfaces
|
18
|
+
, Base = reporters.Base
|
21
19
|
, join = path.join
|
22
|
-
,
|
20
|
+
, basename = path.basename
|
21
|
+
, cwd = process.cwd()
|
22
|
+
, mocha = new Mocha;
|
23
23
|
|
24
24
|
/**
|
25
25
|
* Save timer references to avoid Sinon interfering (see GH-237).
|
@@ -55,7 +55,7 @@ var images = {
|
|
55
55
|
// options
|
56
56
|
|
57
57
|
program
|
58
|
-
.version(
|
58
|
+
.version(JSON.parse(fs.readFileSync(__dirname + '/../package.json', 'utf8')).version)
|
59
59
|
.usage('[debug] [options] [files]')
|
60
60
|
.option('-r, --require <name>', 'require the given module')
|
61
61
|
.option('-R, --reporter <name>', 'specify the reporter to use', 'dot')
|
@@ -173,10 +173,11 @@ Error.stackTraceLimit = Infinity; // TODO: config
|
|
173
173
|
|
174
174
|
// reporter
|
175
175
|
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
176
|
+
mocha.reporter(program.reporter);
|
177
|
+
|
178
|
+
// interface
|
179
|
+
|
180
|
+
mocha.ui(program.ui);
|
180
181
|
|
181
182
|
// load reporter
|
182
183
|
|
@@ -207,11 +208,31 @@ if (program.slow) Base.slow = program.slow;
|
|
207
208
|
|
208
209
|
// --timeout
|
209
210
|
|
210
|
-
if (program.timeout) suite.timeout(program.timeout);
|
211
|
+
if (program.timeout) mocha.suite.timeout(program.timeout);
|
211
212
|
|
212
213
|
// --bail
|
213
214
|
|
214
|
-
suite.bail(program.bail);
|
215
|
+
mocha.suite.bail(program.bail);
|
216
|
+
|
217
|
+
// --grep
|
218
|
+
|
219
|
+
if (program.grep) mocha.grep(new RegExp(utils.escapeRegexp(program.grep)));
|
220
|
+
|
221
|
+
// --invert
|
222
|
+
|
223
|
+
if (program.invert) mocha.invert();
|
224
|
+
|
225
|
+
// --ignore-leaks
|
226
|
+
|
227
|
+
if (program.ignoreLeaks) mocha.ignoreLeaks();
|
228
|
+
|
229
|
+
// --growl
|
230
|
+
|
231
|
+
if (program.growl) mocha.growl();
|
232
|
+
|
233
|
+
// --globals
|
234
|
+
|
235
|
+
mocha.globals(globals);
|
215
236
|
|
216
237
|
// custom compiler support
|
217
238
|
|
@@ -259,21 +280,20 @@ if (program.watch) {
|
|
259
280
|
});
|
260
281
|
|
261
282
|
var frames = [
|
262
|
-
' \
|
263
|
-
, ' \
|
264
|
-
, ' \
|
265
|
-
, ' \
|
266
|
-
, ' \
|
267
|
-
, ' \
|
283
|
+
' \u001b[96m◜ \u001b[90mwatching\u001b[0m'
|
284
|
+
, ' \u001b[96m◠ \u001b[90mwatching\u001b[0m'
|
285
|
+
, ' \u001b[96m◝ \u001b[90mwatching\u001b[0m'
|
286
|
+
, ' \u001b[96m◞ \u001b[90mwatching\u001b[0m'
|
287
|
+
, ' \u001b[96m◡ \u001b[90mwatching\u001b[0m'
|
288
|
+
, ' \u001b[96m◟ \u001b[90mwatching\u001b[0m'
|
268
289
|
];
|
269
290
|
|
270
291
|
var watchFiles = utils.files(cwd);
|
271
292
|
|
272
293
|
function loadAndRun() {
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
});
|
294
|
+
mocha.files = files;
|
295
|
+
mocha.run(function(){
|
296
|
+
play(frames);
|
277
297
|
});
|
278
298
|
}
|
279
299
|
|
@@ -288,8 +308,8 @@ if (program.watch) {
|
|
288
308
|
utils.watch(watchFiles, function(){
|
289
309
|
purge();
|
290
310
|
stop()
|
291
|
-
suite = suite.clone();
|
292
|
-
ui
|
311
|
+
mocha.suite = mocha.suite.clone();
|
312
|
+
mocha.ui(program.ui);
|
293
313
|
loadAndRun();
|
294
314
|
});
|
295
315
|
|
@@ -298,36 +318,8 @@ if (program.watch) {
|
|
298
318
|
|
299
319
|
// load
|
300
320
|
|
301
|
-
|
302
|
-
|
303
|
-
});
|
304
|
-
|
305
|
-
// require test files before
|
306
|
-
// running the root suite
|
307
|
-
|
308
|
-
function load(files, fn) {
|
309
|
-
var pending = files.length;
|
310
|
-
files.forEach(function(file){
|
311
|
-
delete require.cache[file];
|
312
|
-
suite.emit('pre-require', global, file);
|
313
|
-
suite.emit('require', require(file), file);
|
314
|
-
suite.emit('post-require', global, file);
|
315
|
-
--pending || fn();
|
316
|
-
});
|
317
|
-
}
|
318
|
-
|
319
|
-
// run the given suite
|
320
|
-
|
321
|
-
function run(suite, fn) {
|
322
|
-
suite.emit('run');
|
323
|
-
var runner = new Runner(suite);
|
324
|
-
runner.globals(globals);
|
325
|
-
if (program.ignoreLeaks) runner.ignoreLeaks = true;
|
326
|
-
if (program.grep) runner.grep(new RegExp(utils.escapeRegexp(program.grep)), program.invert);
|
327
|
-
var reporter = new Reporter(runner);
|
328
|
-
if (program.growl) growl(runner, reporter);
|
329
|
-
runner.run(fn);
|
330
|
-
}
|
321
|
+
mocha.files = files;
|
322
|
+
mocha.run(process.exit);
|
331
323
|
|
332
324
|
// enable growl notifications
|
333
325
|
|
@@ -362,7 +354,7 @@ function list(str) {
|
|
362
354
|
*/
|
363
355
|
|
364
356
|
function hideCursor(){
|
365
|
-
process.stdout.write('\
|
357
|
+
process.stdout.write('\u001b[?25l');
|
366
358
|
};
|
367
359
|
|
368
360
|
/**
|
@@ -370,7 +362,7 @@ function hideCursor(){
|
|
370
362
|
*/
|
371
363
|
|
372
364
|
function showCursor(){
|
373
|
-
process.stdout.write('\
|
365
|
+
process.stdout.write('\u001b[?25h');
|
374
366
|
};
|
375
367
|
|
376
368
|
/**
|
@@ -378,7 +370,7 @@ function showCursor(){
|
|
378
370
|
*/
|
379
371
|
|
380
372
|
function stop() {
|
381
|
-
process.stdout.write('\
|
373
|
+
process.stdout.write('\u001b[2K');
|
382
374
|
clearInterval(play.timer);
|
383
375
|
}
|
384
376
|
|
@@ -400,7 +392,7 @@ function lookupFiles(path, recursive) {
|
|
400
392
|
if (recursive) files = files.concat(lookupFiles(file, recursive));
|
401
393
|
return
|
402
394
|
}
|
403
|
-
if (!stat.isFile() || !re.test(file)) return;
|
395
|
+
if (!stat.isFile() || !re.test(file) || basename(file)[0] == '.') return;
|
404
396
|
files.push(file);
|
405
397
|
});
|
406
398
|
|
@@ -22,6 +22,9 @@ process.argv.slice(2).forEach(function (arg) {
|
|
22
22
|
case '--expose-gc':
|
23
23
|
args.unshift('--expose-gc');
|
24
24
|
break;
|
25
|
+
case '--harmony-proxies':
|
26
|
+
args.unshift('--harmony-proxies');
|
27
|
+
break;
|
25
28
|
default:
|
26
29
|
if (0 == arg.indexOf('--trace')) args.unshift(arg);
|
27
30
|
else args.push(arg);
|