Update mocha.js
This commit is contained in:
parent
f0ca9cfbe6
commit
433257ab19
|
|
@ -1,13 +1,13 @@
|
||||||
var fs = require("fs");
|
let fs = require("fs");
|
||||||
|
|
||||||
var config = {
|
let config = {
|
||||||
timeout: function(limit) {
|
timeout: function(limit) {
|
||||||
this.limit = limit + lag;
|
this.limit = limit + lag;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
var lag = +process.env["UGLIFY_GITHUB_LAG"] || 0;
|
let lag = +process.env["UGLIFY_GITHUB_LAG"] || 0;
|
||||||
var tasks = [];
|
let tasks = [];
|
||||||
var titles = [];
|
let titles = [];
|
||||||
config.timeout(10000);
|
config.timeout(10000);
|
||||||
describe = function(title, fn) {
|
describe = function(title, fn) {
|
||||||
config = Object.create(config);
|
config = Object.create(config);
|
||||||
|
|
@ -31,9 +31,9 @@ it = function(title, fn) {
|
||||||
});
|
});
|
||||||
|
|
||||||
function log_titles(log, current, marker) {
|
function log_titles(log, current, marker) {
|
||||||
var indent = "";
|
let indent = "";
|
||||||
var writing = false;
|
let writing = false;
|
||||||
for (var i = 0; i < current.length; i++, indent += " ") {
|
for (let i = 0; i < current.length; i++, indent += " ") {
|
||||||
if (titles[i] != current[i]) writing = true;
|
if (titles[i] != current[i]) writing = true;
|
||||||
if (writing) log(indent + (i == current.length - 1 && marker || "") + current[i]);
|
if (writing) log(indent + (i == current.length - 1 && marker || "") + current[i]);
|
||||||
}
|
}
|
||||||
|
|
@ -48,15 +48,15 @@ function green(text) {
|
||||||
return "\u001B[32m" + text + "\u001B[39m";
|
return "\u001B[32m" + text + "\u001B[39m";
|
||||||
}
|
}
|
||||||
|
|
||||||
var errors = [];
|
let errors = [];
|
||||||
var total = tasks.length;
|
let total = tasks.length;
|
||||||
titles = [];
|
titles = [];
|
||||||
process.nextTick(function run() {
|
process.nextTick(function run() {
|
||||||
var task = tasks.shift();
|
let task = tasks.shift();
|
||||||
if (task) try {
|
if (task) try {
|
||||||
var elapsed = Date.now();
|
let elapsed = Date.now();
|
||||||
var timer;
|
let timer;
|
||||||
var done = function() {
|
let done = function() {
|
||||||
elapsed = Date.now() - elapsed;
|
elapsed = Date.now() - elapsed;
|
||||||
if (elapsed > task.limit) {
|
if (elapsed > task.limit) {
|
||||||
throw new Error("Timed out: " + elapsed + "ms > " + task.limit + "ms");
|
throw new Error("Timed out: " + elapsed + "ms > " + task.limit + "ms");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user