Deployed the page to Github Pages.
This commit is contained in:
parent
1d79754e93
commit
2c89899458
62797 changed files with 6551425 additions and 15279 deletions
246
node_modules/jasmine/lib/command.js
generated
vendored
Normal file
246
node_modules/jasmine/lib/command.js
generated
vendored
Normal file
|
@ -0,0 +1,246 @@
|
|||
var path = require('path'),
|
||||
fs = require('fs');
|
||||
|
||||
exports = module.exports = Command;
|
||||
|
||||
var subCommands = {
|
||||
init: {
|
||||
description: 'initialize jasmine',
|
||||
action: initJasmine
|
||||
},
|
||||
examples: {
|
||||
description: 'install examples',
|
||||
action: installExamples
|
||||
},
|
||||
help: {
|
||||
description: 'show help',
|
||||
action: help,
|
||||
alias: '-h'
|
||||
},
|
||||
version: {
|
||||
description: 'show jasmine and jasmine-core versions',
|
||||
action: version,
|
||||
alias: '-v'
|
||||
}
|
||||
};
|
||||
|
||||
function Command(projectBaseDir, examplesDir, print) {
|
||||
this.projectBaseDir = projectBaseDir;
|
||||
this.specDir = path.join(projectBaseDir, 'spec');
|
||||
|
||||
var command = this;
|
||||
|
||||
this.run = function(jasmine, commands) {
|
||||
setEnvironmentVariables(commands);
|
||||
|
||||
var commandToRun;
|
||||
Object.keys(subCommands).forEach(function(cmd) {
|
||||
var commandObject = subCommands[cmd];
|
||||
if (commands.indexOf(cmd) >= 0) {
|
||||
commandToRun = commandObject;
|
||||
} else if(commandObject.alias && commands.indexOf(commandObject.alias) >= 0) {
|
||||
commandToRun = commandObject;
|
||||
}
|
||||
});
|
||||
|
||||
if (commandToRun) {
|
||||
commandToRun.action({jasmine: jasmine, projectBaseDir: command.projectBaseDir, specDir: command.specDir, examplesDir: examplesDir, print: print});
|
||||
} else {
|
||||
var env = parseOptions(commands);
|
||||
if (env.unknownOptions.length > 0) {
|
||||
print('Unknown options: ' + env.unknownOptions.join(', '));
|
||||
print('');
|
||||
help({print: print});
|
||||
} else {
|
||||
runJasmine(jasmine, env);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function isFileArg(arg) {
|
||||
return arg.indexOf('--') !== 0 && !isEnvironmentVariable(arg);
|
||||
}
|
||||
|
||||
function parseOptions(argv) {
|
||||
var files = [],
|
||||
helpers = [],
|
||||
unknownOptions = [],
|
||||
color = process.stdout.isTTY || false,
|
||||
configPath,
|
||||
filter,
|
||||
stopOnFailure,
|
||||
random,
|
||||
seed;
|
||||
|
||||
argv.forEach(function(arg) {
|
||||
if (arg === '--no-color') {
|
||||
color = false;
|
||||
} else if (arg.match("^--filter=")) {
|
||||
filter = arg.match("^--filter=(.*)")[1];
|
||||
} else if (arg.match("^--helper=")) {
|
||||
helpers.push(arg.match("^--helper=(.*)")[1]);
|
||||
} else if (arg.match("^--stop-on-failure=")) {
|
||||
stopOnFailure = arg.match("^--stop-on-failure=(.*)")[1] === 'true';
|
||||
} else if (arg.match("^--random=")) {
|
||||
random = arg.match("^--random=(.*)")[1] === 'true';
|
||||
} else if (arg.match("^--seed=")) {
|
||||
seed = arg.match("^--seed=(.*)")[1];
|
||||
} else if (arg.match("^--config=")) {
|
||||
configPath = arg.match("^--config=(.*)")[1];
|
||||
} else if (isFileArg(arg)) {
|
||||
files.push(arg);
|
||||
} else if (!isEnvironmentVariable(arg)) {
|
||||
unknownOptions.push(arg);
|
||||
}
|
||||
});
|
||||
return {
|
||||
color: color,
|
||||
configPath: configPath,
|
||||
filter: filter,
|
||||
stopOnFailure: stopOnFailure,
|
||||
helpers: helpers,
|
||||
files: files,
|
||||
random: random,
|
||||
seed: seed,
|
||||
unknownOptions: unknownOptions
|
||||
};
|
||||
}
|
||||
|
||||
function runJasmine(jasmine, env) {
|
||||
jasmine.loadConfigFile(env.configPath || process.env.JASMINE_CONFIG_PATH);
|
||||
if (env.stopOnFailure !== undefined) {
|
||||
jasmine.stopSpecOnExpectationFailure(env.stopOnFailure);
|
||||
}
|
||||
if (env.seed !== undefined) {
|
||||
jasmine.seed(env.seed);
|
||||
}
|
||||
if (env.random !== undefined) {
|
||||
jasmine.randomizeTests(env.random);
|
||||
}
|
||||
if (env.helpers !== undefined && env.helpers.length) {
|
||||
jasmine.addHelperFiles(env.helpers);
|
||||
}
|
||||
jasmine.showColors(env.color);
|
||||
jasmine.execute(env.files, env.filter);
|
||||
}
|
||||
|
||||
function initJasmine(options) {
|
||||
var print = options.print;
|
||||
var specDir = options.specDir;
|
||||
makeDirStructure(path.join(specDir, 'support/'));
|
||||
if(!fs.existsSync(path.join(specDir, 'support/jasmine.json'))) {
|
||||
fs.writeFileSync(path.join(specDir, 'support/jasmine.json'), fs.readFileSync(path.join(__dirname, '../lib/examples/jasmine.json'), 'utf-8'));
|
||||
}
|
||||
else {
|
||||
print('spec/support/jasmine.json already exists in your project.');
|
||||
}
|
||||
}
|
||||
|
||||
function installExamples(options) {
|
||||
var specDir = options.specDir;
|
||||
var projectBaseDir = options.projectBaseDir;
|
||||
var examplesDir = options.examplesDir;
|
||||
|
||||
makeDirStructure(path.join(specDir, 'support'));
|
||||
makeDirStructure(path.join(specDir, 'jasmine_examples'));
|
||||
makeDirStructure(path.join(specDir, 'helpers', 'jasmine_examples'));
|
||||
makeDirStructure(path.join(projectBaseDir, 'lib', 'jasmine_examples'));
|
||||
|
||||
copyFiles(
|
||||
path.join(examplesDir, 'spec', 'helpers', 'jasmine_examples'),
|
||||
path.join(specDir, 'helpers', 'jasmine_examples'),
|
||||
new RegExp(/[Hh]elper\.js/)
|
||||
);
|
||||
|
||||
copyFiles(
|
||||
path.join(examplesDir, 'lib', 'jasmine_examples'),
|
||||
path.join(projectBaseDir, 'lib', 'jasmine_examples'),
|
||||
new RegExp(/\.js/)
|
||||
);
|
||||
|
||||
copyFiles(
|
||||
path.join(examplesDir, 'spec', 'jasmine_examples'),
|
||||
path.join(specDir, 'jasmine_examples'),
|
||||
new RegExp(/[Ss]pec.js/)
|
||||
);
|
||||
}
|
||||
|
||||
function help(options) {
|
||||
var print = options.print;
|
||||
print('Usage: jasmine [command] [options] [files]');
|
||||
print('');
|
||||
print('Commands:');
|
||||
Object.keys(subCommands).forEach(function(cmd) {
|
||||
var commandNameText = cmd;
|
||||
if(subCommands[cmd].alias) {
|
||||
commandNameText = commandNameText + ',' + subCommands[cmd].alias;
|
||||
}
|
||||
print('%s\t%s', lPad(commandNameText, 10), subCommands[cmd].description);
|
||||
});
|
||||
print('');
|
||||
print('If no command is given, jasmine specs will be run');
|
||||
print('');
|
||||
print('');
|
||||
|
||||
print('Options:');
|
||||
print('%s\tturn off color in spec output', lPad('--no-color', 18));
|
||||
print('%s\tfilter specs to run only those that match the given string', lPad('--filter=', 18));
|
||||
print('%s\tload helper files that match the given string', lPad('--helper=', 18));
|
||||
print('%s\t[true|false] stop spec execution on expectation failure', lPad('--stop-on-failure=', 18));
|
||||
print('%s\tpath to your optional jasmine.json', lPad('--config=', 18));
|
||||
print('');
|
||||
print('The given arguments take precedence over options in your jasmine.json');
|
||||
print('The path to your optional jasmine.json can also be configured by setting the JASMINE_CONFIG_PATH environment variable');
|
||||
}
|
||||
|
||||
function version(options) {
|
||||
var print = options.print;
|
||||
print('jasmine v' + require('../package.json').version);
|
||||
print('jasmine-core v' + options.jasmine.coreVersion());
|
||||
}
|
||||
|
||||
function lPad(str, length) {
|
||||
if (str.length >= length) {
|
||||
return str;
|
||||
} else {
|
||||
return lPad(' ' + str, length);
|
||||
}
|
||||
}
|
||||
|
||||
function copyFiles(srcDir, destDir, pattern) {
|
||||
var srcDirFiles = fs.readdirSync(srcDir);
|
||||
srcDirFiles.forEach(function(file) {
|
||||
if (file.search(pattern) !== -1) {
|
||||
fs.writeFileSync(path.join(destDir, file), fs.readFileSync(path.join(srcDir, file)));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function makeDirStructure(absolutePath) {
|
||||
var splitPath = absolutePath.split(path.sep);
|
||||
splitPath.forEach(function(dir, index) {
|
||||
if(index > 1) {
|
||||
var fullPath = path.join(splitPath.slice(0, index).join('/'), dir);
|
||||
if (!fs.existsSync(fullPath)) {
|
||||
fs.mkdirSync(fullPath);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function isEnvironmentVariable(command) {
|
||||
var envRegExp = /(.*)=(.*)/;
|
||||
return command.match(envRegExp);
|
||||
}
|
||||
|
||||
function setEnvironmentVariables(commands) {
|
||||
commands.forEach(function (command) {
|
||||
var regExpMatch = isEnvironmentVariable(command);
|
||||
if(regExpMatch) {
|
||||
var key = regExpMatch[1];
|
||||
var value = regExpMatch[2];
|
||||
process.env[key] = value;
|
||||
}
|
||||
});
|
||||
}
|
11
node_modules/jasmine/lib/examples/jasmine.json
generated
vendored
Normal file
11
node_modules/jasmine/lib/examples/jasmine.json
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"spec_dir": "spec",
|
||||
"spec_files": [
|
||||
"**/*[sS]pec.js"
|
||||
],
|
||||
"helpers": [
|
||||
"helpers/**/*.js"
|
||||
],
|
||||
"stopSpecOnExpectationFailure": false,
|
||||
"random": false
|
||||
}
|
17
node_modules/jasmine/lib/exit.js
generated
vendored
Normal file
17
node_modules/jasmine/lib/exit.js
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
module.exports = function(exitCode, platform, nodeVersion, exit, nodeExit) {
|
||||
if(isWindows(platform) && olderThan12(nodeVersion)) {
|
||||
nodeExit(exitCode);
|
||||
}
|
||||
else {
|
||||
exit(exitCode);
|
||||
}
|
||||
};
|
||||
|
||||
function isWindows(platform) {
|
||||
return /^win/.test(platform);
|
||||
}
|
||||
|
||||
function olderThan12(nodeVersion) {
|
||||
var version = nodeVersion.split('.');
|
||||
return parseInt(version[0].substr(1), 10) <= 0 && parseInt(version[1], 10) < 12;
|
||||
}
|
10
node_modules/jasmine/lib/filters/console_spec_filter.js
generated
vendored
Normal file
10
node_modules/jasmine/lib/filters/console_spec_filter.js
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
module.exports = exports = ConsoleSpecFilter;
|
||||
|
||||
function ConsoleSpecFilter(options) {
|
||||
var filterString = options && options.filterString;
|
||||
var filterPattern = new RegExp(filterString);
|
||||
|
||||
this.matches = function(specName) {
|
||||
return filterPattern.test(specName);
|
||||
};
|
||||
}
|
201
node_modules/jasmine/lib/jasmine.js
generated
vendored
Normal file
201
node_modules/jasmine/lib/jasmine.js
generated
vendored
Normal file
|
@ -0,0 +1,201 @@
|
|||
var path = require('path'),
|
||||
util = require('util'),
|
||||
glob = require('glob'),
|
||||
exit = require('./exit'),
|
||||
CompletionReporter = require('./reporters/completion_reporter'),
|
||||
ConsoleSpecFilter = require('./filters/console_spec_filter');
|
||||
|
||||
module.exports = Jasmine;
|
||||
module.exports.ConsoleReporter = require('./reporters/console_reporter');
|
||||
|
||||
function Jasmine(options) {
|
||||
options = options || {};
|
||||
var jasmineCore = options.jasmineCore || require('jasmine-core');
|
||||
this.jasmineCorePath = path.join(jasmineCore.files.path, 'jasmine.js');
|
||||
this.jasmine = jasmineCore.boot(jasmineCore);
|
||||
this.projectBaseDir = options.projectBaseDir || path.resolve();
|
||||
this.printDeprecation = options.printDeprecation || require('./printDeprecation');
|
||||
this.specDir = '';
|
||||
this.specFiles = [];
|
||||
this.helperFiles = [];
|
||||
this.env = this.jasmine.getEnv();
|
||||
this.reportersCount = 0;
|
||||
this.completionReporter = new CompletionReporter();
|
||||
this.onCompleteCallbackAdded = false;
|
||||
this.exit = exit;
|
||||
this.showingColors = true;
|
||||
this.reporter = new module.exports.ConsoleReporter();
|
||||
this.addReporter(this.reporter);
|
||||
this.defaultReporterConfigured = false;
|
||||
|
||||
var jasmineRunner = this;
|
||||
this.completionReporter.onComplete(function(passed) {
|
||||
jasmineRunner.exitCodeCompletion(passed);
|
||||
});
|
||||
this.checkExit = checkExit(this);
|
||||
|
||||
this.coreVersion = function() {
|
||||
return jasmineCore.version();
|
||||
};
|
||||
}
|
||||
|
||||
Jasmine.prototype.randomizeTests = function(value) {
|
||||
this.env.randomizeTests(value);
|
||||
};
|
||||
|
||||
Jasmine.prototype.seed = function(value) {
|
||||
this.env.seed(value);
|
||||
};
|
||||
|
||||
Jasmine.prototype.showColors = function(value) {
|
||||
this.showingColors = value;
|
||||
};
|
||||
|
||||
Jasmine.prototype.addSpecFile = function(filePath) {
|
||||
this.specFiles.push(filePath);
|
||||
};
|
||||
|
||||
Jasmine.prototype.addReporter = function(reporter) {
|
||||
this.env.addReporter(reporter);
|
||||
this.reportersCount++;
|
||||
};
|
||||
|
||||
Jasmine.prototype.clearReporters = function() {
|
||||
this.env.clearReporters();
|
||||
this.reportersCount = 0;
|
||||
};
|
||||
|
||||
Jasmine.prototype.provideFallbackReporter = function(reporter) {
|
||||
this.env.provideFallbackReporter(reporter);
|
||||
};
|
||||
|
||||
Jasmine.prototype.configureDefaultReporter = function(options) {
|
||||
options.timer = options.timer || new this.jasmine.Timer();
|
||||
options.print = options.print || function() {
|
||||
process.stdout.write(util.format.apply(this, arguments));
|
||||
};
|
||||
options.showColors = options.hasOwnProperty('showColors') ? options.showColors : true;
|
||||
options.jasmineCorePath = options.jasmineCorePath || this.jasmineCorePath;
|
||||
|
||||
if(options.onComplete) {
|
||||
this.printDeprecation('Passing in an onComplete function to configureDefaultReporter is deprecated.');
|
||||
}
|
||||
this.reporter.setOptions(options);
|
||||
this.defaultReporterConfigured = true;
|
||||
};
|
||||
|
||||
Jasmine.prototype.addMatchers = function(matchers) {
|
||||
this.jasmine.Expectation.addMatchers(matchers);
|
||||
};
|
||||
|
||||
Jasmine.prototype.loadSpecs = function() {
|
||||
this.specFiles.forEach(function(file) {
|
||||
require(file);
|
||||
});
|
||||
};
|
||||
|
||||
Jasmine.prototype.loadHelpers = function() {
|
||||
this.helperFiles.forEach(function(file) {
|
||||
require(file);
|
||||
});
|
||||
};
|
||||
|
||||
Jasmine.prototype.loadConfigFile = function(configFilePath) {
|
||||
try {
|
||||
var absoluteConfigFilePath = path.resolve(this.projectBaseDir, configFilePath || 'spec/support/jasmine.json');
|
||||
var config = require(absoluteConfigFilePath);
|
||||
this.loadConfig(config);
|
||||
} catch (e) {
|
||||
if(configFilePath || e.code != 'MODULE_NOT_FOUND') { throw e; }
|
||||
}
|
||||
};
|
||||
|
||||
Jasmine.prototype.loadConfig = function(config) {
|
||||
this.specDir = config.spec_dir || this.specDir;
|
||||
this.env.throwOnExpectationFailure(config.stopSpecOnExpectationFailure);
|
||||
this.env.randomizeTests(config.random);
|
||||
|
||||
if(config.helpers) {
|
||||
this.addHelperFiles(config.helpers);
|
||||
}
|
||||
|
||||
if(config.spec_files) {
|
||||
this.addSpecFiles(config.spec_files);
|
||||
}
|
||||
};
|
||||
|
||||
Jasmine.prototype.addHelperFiles = addFiles('helperFiles');
|
||||
Jasmine.prototype.addSpecFiles = addFiles('specFiles');
|
||||
|
||||
function addFiles(kind) {
|
||||
return function (files) {
|
||||
var jasmineRunner = this;
|
||||
var fileArr = this[kind];
|
||||
|
||||
files.forEach(function(file) {
|
||||
if(!(path.isAbsolute && path.isAbsolute(file))) {
|
||||
file = path.join(jasmineRunner.projectBaseDir, jasmineRunner.specDir, file);
|
||||
}
|
||||
var filePaths = glob.sync(file);
|
||||
filePaths.forEach(function(filePath) {
|
||||
if(fileArr.indexOf(filePath) === -1) {
|
||||
fileArr.push(filePath);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
Jasmine.prototype.onComplete = function(onCompleteCallback) {
|
||||
this.completionReporter.onComplete(onCompleteCallback);
|
||||
};
|
||||
|
||||
Jasmine.prototype.stopSpecOnExpectationFailure = function(value) {
|
||||
this.env.throwOnExpectationFailure(value);
|
||||
};
|
||||
|
||||
Jasmine.prototype.exitCodeCompletion = function(passed) {
|
||||
if(passed) {
|
||||
this.exit(0, process.platform, process.version, process.exit, require('exit'));
|
||||
}
|
||||
else {
|
||||
this.exit(1, process.platform, process.version, process.exit, require('exit'));
|
||||
}
|
||||
};
|
||||
|
||||
var checkExit = function(jasmineRunner) {
|
||||
return function() {
|
||||
if (!jasmineRunner.completionReporter.isComplete()) {
|
||||
process.exitCode = 4;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Jasmine.prototype.execute = function(files, filterString) {
|
||||
process.on('exit', this.checkExit);
|
||||
|
||||
this.loadHelpers();
|
||||
if (!this.defaultReporterConfigured) {
|
||||
this.configureDefaultReporter({ showColors: this.showingColors });
|
||||
}
|
||||
|
||||
if(filterString) {
|
||||
var specFilter = new ConsoleSpecFilter({
|
||||
filterString: filterString
|
||||
});
|
||||
this.env.specFilter = function(spec) {
|
||||
return specFilter.matches(spec.getFullName());
|
||||
};
|
||||
}
|
||||
|
||||
if (files && files.length > 0) {
|
||||
this.specDir = '';
|
||||
this.specFiles = [];
|
||||
this.addSpecFiles(files);
|
||||
}
|
||||
|
||||
this.loadSpecs();
|
||||
|
||||
this.addReporter(this.completionReporter);
|
||||
this.env.execute();
|
||||
};
|
3
node_modules/jasmine/lib/printDeprecation.js
generated
vendored
Normal file
3
node_modules/jasmine/lib/printDeprecation.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
module.exports = function(message) {
|
||||
console.warn('Deprecation warning: ' + message);
|
||||
};
|
240
node_modules/jasmine/lib/reporters/console_reporter.js
generated
vendored
Normal file
240
node_modules/jasmine/lib/reporters/console_reporter.js
generated
vendored
Normal file
|
@ -0,0 +1,240 @@
|
|||
module.exports = exports = ConsoleReporter;
|
||||
|
||||
var noopTimer = {
|
||||
start: function(){},
|
||||
elapsed: function(){ return 0; }
|
||||
};
|
||||
|
||||
function ConsoleReporter() {
|
||||
var print = function() {},
|
||||
showColors = false,
|
||||
timer = noopTimer,
|
||||
jasmineCorePath = null,
|
||||
printDeprecation = function() {},
|
||||
specCount,
|
||||
executableSpecCount,
|
||||
failureCount,
|
||||
failedSpecs = [],
|
||||
pendingSpecs = [],
|
||||
ansi = {
|
||||
green: '\x1B[32m',
|
||||
red: '\x1B[31m',
|
||||
yellow: '\x1B[33m',
|
||||
none: '\x1B[0m'
|
||||
},
|
||||
failedSuites = [],
|
||||
stackFilter = defaultStackFilter,
|
||||
onComplete = function() {};
|
||||
|
||||
this.setOptions = function(options) {
|
||||
if (options.print) {
|
||||
print = options.print;
|
||||
}
|
||||
showColors = options.showColors || false;
|
||||
if (options.timer) {
|
||||
timer = options.timer;
|
||||
}
|
||||
if (options.jasmineCorePath) {
|
||||
jasmineCorePath = options.jasmineCorePath;
|
||||
}
|
||||
if (options.printDeprecation) {
|
||||
printDeprecation = options.printDeprecation;
|
||||
}
|
||||
if (options.stackFilter) {
|
||||
stackFilter = options.stackFilter;
|
||||
}
|
||||
|
||||
if(options.onComplete) {
|
||||
printDeprecation('Passing in an onComplete function to the ConsoleReporter is deprecated.');
|
||||
onComplete = options.onComplete;
|
||||
}
|
||||
};
|
||||
|
||||
this.jasmineStarted = function(options) {
|
||||
specCount = 0;
|
||||
executableSpecCount = 0;
|
||||
failureCount = 0;
|
||||
if (options && options.order && options.order.random) {
|
||||
print('Randomized with seed ' + options.order.seed);
|
||||
printNewline();
|
||||
}
|
||||
print('Started');
|
||||
printNewline();
|
||||
timer.start();
|
||||
};
|
||||
|
||||
this.jasmineDone = function(result) {
|
||||
printNewline();
|
||||
printNewline();
|
||||
if(failedSpecs.length > 0) {
|
||||
print('Failures:');
|
||||
}
|
||||
for (var i = 0; i < failedSpecs.length; i++) {
|
||||
specFailureDetails(failedSpecs[i], i + 1);
|
||||
}
|
||||
|
||||
if (pendingSpecs.length > 0) {
|
||||
print("Pending:");
|
||||
}
|
||||
for(i = 0; i < pendingSpecs.length; i++) {
|
||||
pendingSpecDetails(pendingSpecs[i], i + 1);
|
||||
}
|
||||
|
||||
if(specCount > 0) {
|
||||
printNewline();
|
||||
|
||||
if(executableSpecCount !== specCount) {
|
||||
print('Ran ' + executableSpecCount + ' of ' + specCount + plural(' spec', specCount));
|
||||
printNewline();
|
||||
}
|
||||
var specCounts = executableSpecCount + ' ' + plural('spec', executableSpecCount) + ', ' +
|
||||
failureCount + ' ' + plural('failure', failureCount);
|
||||
|
||||
if (pendingSpecs.length) {
|
||||
specCounts += ', ' + pendingSpecs.length + ' pending ' + plural('spec', pendingSpecs.length);
|
||||
}
|
||||
|
||||
print(specCounts);
|
||||
} else {
|
||||
print('No specs found');
|
||||
}
|
||||
|
||||
printNewline();
|
||||
var seconds = timer.elapsed() / 1000;
|
||||
print('Finished in ' + seconds + ' ' + plural('second', seconds));
|
||||
printNewline();
|
||||
|
||||
for(i = 0; i < failedSuites.length; i++) {
|
||||
suiteFailureDetails(failedSuites[i]);
|
||||
}
|
||||
|
||||
if (result && result.failedExpectations) {
|
||||
suiteFailureDetails(result);
|
||||
}
|
||||
|
||||
if (result && result.order && result.order.random) {
|
||||
print('Randomized with seed ' + result.order.seed);
|
||||
printNewline();
|
||||
}
|
||||
|
||||
onComplete(failureCount === 0);
|
||||
};
|
||||
|
||||
this.specDone = function(result) {
|
||||
specCount++;
|
||||
|
||||
if (result.status == 'pending') {
|
||||
pendingSpecs.push(result);
|
||||
executableSpecCount++;
|
||||
print(colored('yellow', '*'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (result.status == 'passed') {
|
||||
executableSpecCount++;
|
||||
print(colored('green', '.'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (result.status == 'failed') {
|
||||
failureCount++;
|
||||
failedSpecs.push(result);
|
||||
executableSpecCount++;
|
||||
print(colored('red', 'F'));
|
||||
}
|
||||
};
|
||||
|
||||
this.suiteDone = function(result) {
|
||||
if (result.failedExpectations && result.failedExpectations.length > 0) {
|
||||
failureCount++;
|
||||
failedSuites.push(result);
|
||||
}
|
||||
};
|
||||
|
||||
return this;
|
||||
|
||||
function printNewline() {
|
||||
print('\n');
|
||||
}
|
||||
|
||||
function colored(color, str) {
|
||||
return showColors ? (ansi[color] + str + ansi.none) : str;
|
||||
}
|
||||
|
||||
function plural(str, count) {
|
||||
return count == 1 ? str : str + 's';
|
||||
}
|
||||
|
||||
function repeat(thing, times) {
|
||||
var arr = [];
|
||||
for (var i = 0; i < times; i++) {
|
||||
arr.push(thing);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
function indent(str, spaces) {
|
||||
var lines = (str || '').split('\n');
|
||||
var newArr = [];
|
||||
for (var i = 0; i < lines.length; i++) {
|
||||
newArr.push(repeat(' ', spaces).join('') + lines[i]);
|
||||
}
|
||||
return newArr.join('\n');
|
||||
}
|
||||
|
||||
function defaultStackFilter(stack) {
|
||||
if (!stack) {
|
||||
return '';
|
||||
}
|
||||
|
||||
var filteredStack = stack.split('\n').filter(function(stackLine) {
|
||||
return stackLine.indexOf(jasmineCorePath) === -1;
|
||||
}).join('\n');
|
||||
return filteredStack;
|
||||
}
|
||||
|
||||
function specFailureDetails(result, failedSpecNumber) {
|
||||
printNewline();
|
||||
print(failedSpecNumber + ') ');
|
||||
print(result.fullName);
|
||||
|
||||
for (var i = 0; i < result.failedExpectations.length; i++) {
|
||||
var failedExpectation = result.failedExpectations[i];
|
||||
printNewline();
|
||||
print(indent('Message:', 2));
|
||||
printNewline();
|
||||
print(colored('red', indent(failedExpectation.message, 4)));
|
||||
printNewline();
|
||||
print(indent('Stack:', 2));
|
||||
printNewline();
|
||||
print(indent(stackFilter(failedExpectation.stack), 4));
|
||||
}
|
||||
|
||||
printNewline();
|
||||
}
|
||||
|
||||
function suiteFailureDetails(result) {
|
||||
for (var i = 0; i < result.failedExpectations.length; i++) {
|
||||
printNewline();
|
||||
print(colored('red', 'An error was thrown in an afterAll'));
|
||||
printNewline();
|
||||
print(colored('red', 'AfterAll ' + result.failedExpectations[i].message));
|
||||
|
||||
}
|
||||
printNewline();
|
||||
}
|
||||
|
||||
function pendingSpecDetails(result, pendingSpecNumber) {
|
||||
printNewline();
|
||||
printNewline();
|
||||
print(pendingSpecNumber + ') ');
|
||||
print(result.fullName);
|
||||
printNewline();
|
||||
var pendingReason = "No reason given";
|
||||
if (result.pendingReason && result.pendingReason !== '') {
|
||||
pendingReason = result.pendingReason;
|
||||
}
|
||||
print(indent(colored('yellow', pendingReason), 2));
|
||||
printNewline();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue