Add a light=true mode for running tests faster.
This commit is contained in:
Родитель
f988a11cfc
Коммит
8d99ecfa6c
14
Jakefile.js
14
Jakefile.js
|
@ -503,9 +503,9 @@ function cleanTestDirs() {
|
|||
}
|
||||
|
||||
// used to pass data from jake command line directly to run.js
|
||||
function writeTestConfigFile(tests, testConfigFile) {
|
||||
function writeTestConfigFile(tests, light, testConfigFile) {
|
||||
console.log('Running test(s): ' + tests);
|
||||
var testConfigContents = '{\n' + '\ttest: [\'' + tests + '\']\n}';
|
||||
var testConfigContents = JSON.stringify({ test: [tests], light: light });
|
||||
fs.writeFileSync('test.config', testConfigContents);
|
||||
}
|
||||
|
||||
|
@ -521,13 +521,14 @@ task("runtests", ["tests", builtLocalDirectory], function() {
|
|||
cleanTestDirs();
|
||||
host = "mocha"
|
||||
tests = process.env.test || process.env.tests || process.env.t;
|
||||
var light = process.env.light || false;
|
||||
var testConfigFile = 'test.config';
|
||||
if(fs.existsSync(testConfigFile)) {
|
||||
fs.unlinkSync(testConfigFile);
|
||||
}
|
||||
|
||||
if(tests) {
|
||||
writeTestConfigFile(tests, testConfigFile);
|
||||
if(tests || light) {
|
||||
writeTestConfigFile(tests, light, testConfigFile);
|
||||
}
|
||||
|
||||
if (tests && tests.toLocaleLowerCase() === "rwc") {
|
||||
|
@ -570,12 +571,13 @@ task("runtests-browser", ["tests", "browserify", builtLocalDirectory], function(
|
|||
port = process.env.port || process.env.p || '8888';
|
||||
browser = process.env.browser || process.env.b || "IE";
|
||||
tests = process.env.test || process.env.tests || process.env.t;
|
||||
var light = process.env.light || false;
|
||||
var testConfigFile = 'test.config';
|
||||
if(fs.existsSync(testConfigFile)) {
|
||||
fs.unlinkSync(testConfigFile);
|
||||
}
|
||||
if(tests) {
|
||||
writeTestConfigFile(tests, testConfigFile);
|
||||
if(tests || light) {
|
||||
writeTestConfigFile(tests, light, testConfigFile);
|
||||
}
|
||||
|
||||
tests = tests ? tests : '';
|
||||
|
|
|
@ -10934,7 +10934,10 @@ module ts {
|
|||
|
||||
function checkSourceFile(node: SourceFile) {
|
||||
let start = new Date().getTime();
|
||||
checkSourceFileWorker(node);
|
||||
let skipCheck = node.fileName.indexOf("lib.d.ts") >= 0 && compilerOptions.noLibCheck;
|
||||
if (!skipCheck) {
|
||||
checkSourceFileWorker(node);
|
||||
}
|
||||
checkTime += new Date().getTime() - start;
|
||||
}
|
||||
|
||||
|
|
|
@ -1677,6 +1677,10 @@ module ts {
|
|||
separateCompilation?: boolean;
|
||||
emitDecoratorMetadata?: boolean;
|
||||
/* @internal */ stripInternal?: boolean;
|
||||
|
||||
// Skip checking lib.d.ts to help speed up tests.
|
||||
/* @internal */ noLibCheck?: boolean;
|
||||
|
||||
[option: string]: string | number | boolean;
|
||||
}
|
||||
|
||||
|
|
|
@ -171,7 +171,6 @@ class CompilerBaselineRunner extends RunnerBase {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
it('Correct JS output for ' + fileName, () => {
|
||||
if (!ts.fileExtensionIs(lastUnit.name, '.d.ts') && this.emit) {
|
||||
if (result.files.length === 0 && result.errors.length === 0) {
|
||||
|
@ -259,7 +258,7 @@ class CompilerBaselineRunner extends RunnerBase {
|
|||
});
|
||||
|
||||
it('Correct type/symbol baselines for ' + fileName, () => {
|
||||
if (fileName.indexOf("APISample") >= 0) {
|
||||
if (fileName.indexOf("APISample") >= 0 || lightMode) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -800,7 +800,7 @@ module Harness {
|
|||
// Only set the parent nodes if we're asserting invariants. We don't need them otherwise.
|
||||
var result = ts.createSourceFile(fileName, sourceText, languageVersion, /*setParentNodes:*/ assertInvariants);
|
||||
if (assertInvariants) {
|
||||
Utils.assertInvariants(result, /*parent:*/ undefined);
|
||||
// Utils.assertInvariants(result, /*parent:*/ undefined);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -937,6 +937,9 @@ module Harness {
|
|||
options.target = options.target || ts.ScriptTarget.ES3;
|
||||
options.module = options.module || ts.ModuleKind.None;
|
||||
options.noErrorTruncation = true;
|
||||
if (lightMode) {
|
||||
options.noLibCheck = true;
|
||||
}
|
||||
|
||||
if (settingsCallback) {
|
||||
settingsCallback(null);
|
||||
|
|
|
@ -36,43 +36,54 @@ var testconfig = 'test.config';
|
|||
var testConfigFile =
|
||||
Harness.IO.fileExists(mytestconfig) ? Harness.IO.readFile(mytestconfig) :
|
||||
(Harness.IO.fileExists(testconfig) ? Harness.IO.readFile(testconfig) : '');
|
||||
var lightMode: boolean;
|
||||
|
||||
if (testConfigFile !== '') {
|
||||
// TODO: not sure why this is crashing mocha
|
||||
//var testConfig = JSON.parse(testConfigRaw);
|
||||
var testConfig = testConfigFile.match(/test:\s\['(.*)'\]/);
|
||||
var options = testConfig ? [testConfig[1]] : [];
|
||||
for (var i = 0; i < options.length; i++) {
|
||||
switch (options[i]) {
|
||||
case 'compiler':
|
||||
runners.push(new CompilerBaselineRunner(CompilerTestType.Conformance));
|
||||
runners.push(new CompilerBaselineRunner(CompilerTestType.Regressions));
|
||||
runners.push(new ProjectRunner());
|
||||
break;
|
||||
case 'conformance':
|
||||
runners.push(new CompilerBaselineRunner(CompilerTestType.Conformance));
|
||||
break;
|
||||
case 'project':
|
||||
runners.push(new ProjectRunner());
|
||||
break;
|
||||
case 'fourslash':
|
||||
runners.push(new FourSlashRunner(FourSlashTestType.Native));
|
||||
break;
|
||||
case 'fourslash-shims':
|
||||
runners.push(new FourSlashRunner(FourSlashTestType.Shims));
|
||||
break;
|
||||
case 'fourslash-server':
|
||||
runners.push(new FourSlashRunner(FourSlashTestType.Server));
|
||||
break;
|
||||
case 'fourslash-generated':
|
||||
runners.push(new GeneratedFourslashRunner(FourSlashTestType.Native));
|
||||
break;
|
||||
case 'rwc':
|
||||
runners.push(new RWCRunner());
|
||||
break;
|
||||
case 'test262':
|
||||
runners.push(new Test262BaselineRunner());
|
||||
break;
|
||||
var testConfig = JSON.parse(testConfigFile);
|
||||
//var testConfig = testConfigFile.match(/test:\s\['(.*)'\]/);
|
||||
//var options = testConfig ? [testConfig[1]] : [];
|
||||
if (testConfig.light) {
|
||||
lightMode = true;
|
||||
}
|
||||
|
||||
if (testConfig.test && testConfig.test.length > 0) {
|
||||
for (let option of testConfig.test) {
|
||||
if (!option) {
|
||||
continue;
|
||||
}
|
||||
ts.sys.write("Option: " + option + "\r\n");
|
||||
switch (option) {
|
||||
case 'compiler':
|
||||
runners.push(new CompilerBaselineRunner(CompilerTestType.Conformance));
|
||||
runners.push(new CompilerBaselineRunner(CompilerTestType.Regressions));
|
||||
runners.push(new ProjectRunner());
|
||||
break;
|
||||
case 'conformance':
|
||||
runners.push(new CompilerBaselineRunner(CompilerTestType.Conformance));
|
||||
break;
|
||||
case 'project':
|
||||
runners.push(new ProjectRunner());
|
||||
break;
|
||||
case 'fourslash':
|
||||
runners.push(new FourSlashRunner(FourSlashTestType.Native));
|
||||
break;
|
||||
case 'fourslash-shims':
|
||||
runners.push(new FourSlashRunner(FourSlashTestType.Shims));
|
||||
break;
|
||||
case 'fourslash-server':
|
||||
runners.push(new FourSlashRunner(FourSlashTestType.Server));
|
||||
break;
|
||||
case 'fourslash-generated':
|
||||
runners.push(new GeneratedFourslashRunner(FourSlashTestType.Native));
|
||||
break;
|
||||
case 'rwc':
|
||||
runners.push(new RWCRunner());
|
||||
break;
|
||||
case 'test262':
|
||||
runners.push(new Test262BaselineRunner());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче