2016-10-23 16:37:15 -04:00
|
|
|
/**
|
|
|
|
* @license
|
|
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
*/
|
|
|
|
|
2016-11-12 08:08:58 -05:00
|
|
|
/* tslint:disable:no-var-keyword */
|
|
|
|
|
2016-05-03 12:24:09 -04:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var glob = require('glob');
|
2016-08-19 15:10:53 -04:00
|
|
|
require('zone.js/dist/zone-node.js');
|
2016-05-03 12:24:09 -04:00
|
|
|
var JasmineRunner = require('jasmine');
|
|
|
|
var path = require('path');
|
|
|
|
require('zone.js/dist/long-stack-trace-zone.js');
|
2016-08-19 17:35:26 -04:00
|
|
|
require('zone.js/dist/proxy.js');
|
2016-08-19 15:10:53 -04:00
|
|
|
require('zone.js/dist/sync-test.js');
|
2016-05-03 12:24:09 -04:00
|
|
|
require('zone.js/dist/async-test.js');
|
|
|
|
require('zone.js/dist/fake-async-test.js');
|
|
|
|
|
|
|
|
var jrunner = new JasmineRunner();
|
2016-08-19 15:10:53 -04:00
|
|
|
(global as any)['jasmine'] = jrunner.jasmine;
|
|
|
|
require('zone.js/dist/jasmine-patch.js');
|
2016-05-03 12:24:09 -04:00
|
|
|
var toolsDir = process.cwd() + '/dist/tools';
|
2016-01-22 13:51:16 -05:00
|
|
|
function toolsDirRequire(moduleId: string) {
|
2016-05-03 12:24:09 -04:00
|
|
|
return require(path.join(toolsDir, moduleId));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Tun on full stack traces in errors to help debugging
|
2016-01-22 13:51:16 -05:00
|
|
|
(<any>Error)['stackTraceLimit'] = Infinity;
|
2016-05-03 12:24:09 -04:00
|
|
|
|
|
|
|
jrunner.jasmine.DEFAULT_TIMEOUT_INTERVAL = 100;
|
|
|
|
|
|
|
|
// Support passing multiple globs
|
|
|
|
var globsIndex = process.argv.indexOf('--');
|
2016-01-22 13:51:16 -05:00
|
|
|
var args: string[];
|
2016-05-03 12:24:09 -04:00
|
|
|
if (globsIndex < 0) {
|
|
|
|
args = [process.argv[2]];
|
|
|
|
} else {
|
|
|
|
args = process.argv.slice(globsIndex + 1);
|
|
|
|
}
|
|
|
|
|
2016-01-22 13:51:16 -05:00
|
|
|
var specFiles = args.map(function(globstr: string) { return glob.sync(globstr, {cwd: toolsDir}); })
|
2016-05-26 13:45:37 -04:00
|
|
|
.reduce((specFiles: string[], paths: string[]) => specFiles.concat(paths), []);
|
2016-05-03 12:24:09 -04:00
|
|
|
|
|
|
|
jasmine.DEFAULT_TIMEOUT_INTERVAL = 100;
|
|
|
|
|
|
|
|
jrunner.configureDefaultReporter({showColors: process.argv.indexOf('--no-color') === -1});
|
|
|
|
|
2016-01-22 13:51:16 -05:00
|
|
|
jrunner.onComplete(function(passed: boolean) { process.exit(passed ? 0 : 1); });
|
2016-05-03 12:24:09 -04:00
|
|
|
jrunner.projectBaseDir = path.resolve(__dirname, '../../');
|
|
|
|
jrunner.specDir = '';
|
2016-01-22 13:51:16 -05:00
|
|
|
specFiles.forEach((file: string) => { toolsDirRequire(file); });
|
2016-05-03 12:24:09 -04:00
|
|
|
jrunner.execute();
|