Fix remaining debug failures.
This commit is contained in:
parent
734f161cdc
commit
46e4c632ff
124
Jakefile.js
124
Jakefile.js
|
@ -675,14 +675,24 @@ function cleanTestDirs() {
|
|||
|
||||
// used to pass data from jake command line directly to run.js
|
||||
function writeTestConfigFile(testConfigFile, tests, light, stackTraceLimit) {
|
||||
console.log('Running test(s): ' + tests);
|
||||
var testConfig = { test: [tests], light: light };
|
||||
if (/^(\d+|full)$/.test(stackTraceLimit)) {
|
||||
testConfig.stackTraceLimit = stackTraceLimit;
|
||||
var testConfig;
|
||||
if (tests) {
|
||||
console.log('Running test(s): ' + tests);
|
||||
(testConfig || (testConfig = {})).tests = [tests];
|
||||
}
|
||||
|
||||
var testConfigContents = JSON.stringify(testConfig);
|
||||
fs.writeFileSync('test.config', testConfigContents);
|
||||
if (light) {
|
||||
(testConfig || (testConfig = {})).light = light;
|
||||
}
|
||||
|
||||
if (/^(\d+|full)$/.test(stackTraceLimit)) {
|
||||
(testConfig || (testConfig = {})).stackTraceLimit = stackTraceLimit;
|
||||
}
|
||||
|
||||
if (testConfig) {
|
||||
var testConfigContents = JSON.stringify(testConfig);
|
||||
fs.writeFileSync(testConfigFile, testConfigContents);
|
||||
}
|
||||
}
|
||||
|
||||
function deleteTemporaryProjectOutput() {
|
||||
|
@ -700,9 +710,7 @@ function runTestsAndWriteOutput(file) {
|
|||
fs.unlinkSync(testConfigFile);
|
||||
}
|
||||
|
||||
if (tests || light) {
|
||||
writeTestConfigFile(testConfigFile, tests, light, 10);
|
||||
}
|
||||
writeTestConfigFile(testConfigFile, tests, light, 10);
|
||||
|
||||
if (tests && tests.toLocaleLowerCase() === "rwc") {
|
||||
testTimeout = 100000;
|
||||
|
@ -719,11 +727,16 @@ function runTestsAndWriteOutput(file) {
|
|||
|
||||
var cmd = "mocha " + args.join(" ");
|
||||
console.log(cmd);
|
||||
var ex = jake.createExec([cmd], { windowsVerbatimArguments: true });
|
||||
var p = child_process.spawn(
|
||||
process.platform === "win32" ? "cmd" : "/bin/sh",
|
||||
process.platform === "win32" ? ["/c", cmd] : ["-c", cmd], {
|
||||
windowsVerbatimArguments: true
|
||||
});
|
||||
|
||||
var out = fs.createWriteStream(file);
|
||||
var tapRange = /^(\d+)\.\.(\d+)(?:$|\r\n?|\n)/;
|
||||
var tapOk = /^ok\s/;
|
||||
var tapNotOk = /^not\sok/;
|
||||
var tapNotOk = /^not\sok\s/;
|
||||
var tapComment = /^#/;
|
||||
var typeError = /^\s+TypeError:/;
|
||||
var debugError = /^\s+Error:\sDebug\sFailure\./;
|
||||
|
@ -736,38 +749,9 @@ function runTestsAndWriteOutput(file) {
|
|||
var typeErrorCount = 0;
|
||||
var debugErrorCount = 0;
|
||||
|
||||
ex.addListener("stdout", function (output) {
|
||||
var m = tapRange.exec(output);
|
||||
if (m) {
|
||||
expectedTestCount = parseInt(m[2]);
|
||||
return;
|
||||
}
|
||||
|
||||
out.write(output);
|
||||
|
||||
if (tapOk.test(output)) {
|
||||
successCount++;
|
||||
}
|
||||
else if (tapNotOk.test(output)) {
|
||||
failureCount++;
|
||||
}
|
||||
else {
|
||||
if (tapComment.test(output)) {
|
||||
comments.push(output.toString().trim());
|
||||
}
|
||||
else if (typeError.test(output)) {
|
||||
typeErrorCount++;
|
||||
}
|
||||
else if (debugError.test(output)) {
|
||||
debugErrorCount++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
testCount++;
|
||||
|
||||
var percentComplete = testCount * 100 / expectedTestCount;
|
||||
updateProgress(percentComplete);
|
||||
var rl = readline.createInterface({
|
||||
input: p.stdout,
|
||||
terminal: false
|
||||
});
|
||||
|
||||
function updateProgress(percentComplete) {
|
||||
|
@ -781,22 +765,42 @@ function runTestsAndWriteOutput(file) {
|
|||
);
|
||||
}
|
||||
|
||||
ex.addListener("stderr", function (output) {
|
||||
progress.hide();
|
||||
process.stderr.write(output.toString().trim() + os.EOL);
|
||||
progress.show();
|
||||
});
|
||||
ex.addListener("cmdEnd", function () {
|
||||
if (progress.visible) {
|
||||
updateProgress(100);
|
||||
process.stdout.write("done." + os.EOL);
|
||||
rl.on("line", function (line) {
|
||||
var m = tapRange.exec(line);
|
||||
if (m) {
|
||||
expectedTestCount = parseInt(m[2]);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(comments.join(os.EOL));
|
||||
deleteTemporaryProjectOutput();
|
||||
complete();
|
||||
if (tapOk.test(line)) {
|
||||
out.write(line.replace(/^ok\s+\d+\s+/, "ok ") + os.EOL);
|
||||
successCount++;
|
||||
}
|
||||
else if (tapNotOk.test(line)) {
|
||||
out.write(line.replace(/^not\s+ok\s+\d+\s+/, "not ok ") + os.EOL);
|
||||
failureCount++;
|
||||
}
|
||||
else {
|
||||
out.write(line + os.EOL);
|
||||
if (tapComment.test(line)) {
|
||||
comments.push(line);
|
||||
}
|
||||
else if (typeError.test(line)) {
|
||||
typeErrorCount++;
|
||||
}
|
||||
else if (debugError.test(line)) {
|
||||
debugErrorCount++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
testCount++;
|
||||
|
||||
var percentComplete = testCount * 100 / expectedTestCount;
|
||||
updateProgress(percentComplete);
|
||||
});
|
||||
ex.addListener("error", function (e, status) {
|
||||
|
||||
p.on("exit", function (status) {
|
||||
if (progress.visible) {
|
||||
updateProgress(100);
|
||||
process.stdout.write("done." + os.EOL);
|
||||
|
@ -813,9 +817,13 @@ function runTestsAndWriteOutput(file) {
|
|||
}
|
||||
|
||||
deleteTemporaryProjectOutput();
|
||||
fail("Process exited with code " + status);
|
||||
if (status) {
|
||||
fail("Process exited with code " + status);
|
||||
}
|
||||
else {
|
||||
complete();
|
||||
}
|
||||
});
|
||||
ex.run();
|
||||
}
|
||||
|
||||
function runConsoleTests(defaultReporter, defaultSubsets) {
|
||||
|
|
|
@ -88,6 +88,9 @@ namespace ts {
|
|||
|
||||
function visitJavaScript(node: Node): VisitResult<Node> {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ExportKeyword:
|
||||
return node;
|
||||
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
return visitClassDeclaration(<ClassDeclaration>node);
|
||||
|
||||
|
@ -169,12 +172,19 @@ namespace ts {
|
|||
case SyntaxKind.SuperKeyword:
|
||||
return visitSuperKeyword(<PrimaryExpression>node);
|
||||
|
||||
case SyntaxKind.YieldExpression:
|
||||
// `yield` will be handled by a generators transform.
|
||||
return visitEachChild(node, visitor, context);
|
||||
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
return visitMethodDeclaration(<MethodDeclaration>node);
|
||||
|
||||
case SyntaxKind.SourceFile:
|
||||
return visitSourceFileNode(<SourceFile>node);
|
||||
|
||||
case SyntaxKind.VariableStatement:
|
||||
return visitEachChild(node, visitor, context);
|
||||
|
||||
default:
|
||||
Debug.failBadSyntaxKind(node);
|
||||
return visitEachChild(node, visitor, context);
|
||||
|
@ -437,7 +447,11 @@ namespace ts {
|
|||
* @param node A ParameterDeclaration node.
|
||||
*/
|
||||
function visitParameter(node: ParameterDeclaration): ParameterDeclaration {
|
||||
if (isBindingPattern(node.name)) {
|
||||
if (node.dotDotDotToken) {
|
||||
// rest parameters are elided
|
||||
return undefined;
|
||||
}
|
||||
else if (isBindingPattern(node.name)) {
|
||||
// Binding patterns are converted into a generated name and are
|
||||
// evaluated inside the function body.
|
||||
return createParameter(
|
||||
|
@ -454,10 +468,6 @@ namespace ts {
|
|||
/*location*/ node
|
||||
);
|
||||
}
|
||||
else if (node.dotDotDotToken) {
|
||||
// rest parameters are elided
|
||||
return undefined;
|
||||
}
|
||||
else {
|
||||
return node;
|
||||
}
|
||||
|
@ -826,7 +836,7 @@ namespace ts {
|
|||
}
|
||||
|
||||
const expression = createFunctionExpression(
|
||||
/*asteriskToken*/ undefined,
|
||||
node.asteriskToken,
|
||||
name,
|
||||
visitNodes(node.parameters, visitor, isParameter),
|
||||
transformFunctionBody(node),
|
||||
|
|
|
@ -38,6 +38,9 @@ namespace ts {
|
|||
case SyntaxKind.JsxSelfClosingElement:
|
||||
return visitJsxSelfClosingElement(<JsxSelfClosingElement>node);
|
||||
|
||||
case SyntaxKind.JsxExpression:
|
||||
return visitJsxExpression(<JsxExpression>node);
|
||||
|
||||
default:
|
||||
Debug.failBadSyntaxKind(node);
|
||||
return undefined;
|
||||
|
@ -116,12 +119,25 @@ namespace ts {
|
|||
|
||||
function transformJsxAttributeToObjectLiteralElement(node: JsxAttribute) {
|
||||
const name = getAttributeName(node);
|
||||
const expression = node.initializer
|
||||
? visitNode(node.initializer, visitor, isExpression)
|
||||
: createLiteral(true);
|
||||
const expression = transformJsxAttributeInitializer(node.initializer);
|
||||
return createPropertyAssignment(name, expression);
|
||||
}
|
||||
|
||||
function transformJsxAttributeInitializer(node: StringLiteral | JsxExpression) {
|
||||
if (node === undefined) {
|
||||
return createLiteral(true);
|
||||
}
|
||||
else if (node.kind === SyntaxKind.StringLiteral) {
|
||||
return node;
|
||||
}
|
||||
else if (node.kind === SyntaxKind.JsxExpression) {
|
||||
return visitJsxExpression(<JsxExpression>node);
|
||||
}
|
||||
else {
|
||||
Debug.failBadSyntaxKind(node);
|
||||
}
|
||||
}
|
||||
|
||||
function visitJsxText(node: JsxText) {
|
||||
const text = getTextOfNode(node, /*includeTrivia*/ true);
|
||||
let parts: Expression[];
|
||||
|
|
|
@ -752,11 +752,12 @@ namespace ts {
|
|||
|
||||
function createRequireCall(importNode: ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration) {
|
||||
const moduleName = getExternalModuleNameLiteral(importNode);
|
||||
Debug.assert(isDefined(moduleName));
|
||||
return createCall(
|
||||
createIdentifier("require"),
|
||||
[moduleName]
|
||||
);
|
||||
const args: Expression[] = [];
|
||||
if (isDefined(moduleName)) {
|
||||
args.push(moduleName);
|
||||
}
|
||||
|
||||
return createCall(createIdentifier("require"), args);
|
||||
}
|
||||
|
||||
function createExportAssignment(name: Identifier, value: Expression) {
|
||||
|
|
|
@ -243,14 +243,16 @@ namespace ts {
|
|||
case SyntaxKind.StringKeyword:
|
||||
case SyntaxKind.NumberKeyword:
|
||||
case SyntaxKind.VoidKeyword:
|
||||
case SyntaxKind.SymbolKeyword:
|
||||
case SyntaxKind.ConstructorType:
|
||||
case SyntaxKind.FunctionType:
|
||||
case SyntaxKind.TypeQuery:
|
||||
case SyntaxKind.TypeReference:
|
||||
case SyntaxKind.UnionType:
|
||||
case SyntaxKind.IntersectionType:
|
||||
case SyntaxKind.StringLiteralType:
|
||||
case SyntaxKind.ParenthesizedType:
|
||||
case SyntaxKind.ThisType:
|
||||
case SyntaxKind.StringLiteralType:
|
||||
// TypeScript type nodes are elided.
|
||||
|
||||
case SyntaxKind.IndexSignature:
|
||||
|
@ -2048,15 +2050,18 @@ namespace ts {
|
|||
*
|
||||
* This function will be called when one of the following conditions are met:
|
||||
* - The node has an accessibility modifier.
|
||||
* - The node has a questionToken.
|
||||
*
|
||||
* @param node The parameter declaration node.
|
||||
*/
|
||||
function visitParameter(node: ParameterDeclaration) {
|
||||
Debug.assert(!node.dotDotDotToken);
|
||||
return createParameter(
|
||||
visitNode(node.name, visitor, isBindingName),
|
||||
visitNode(node.initializer, visitor, isExpression)
|
||||
);
|
||||
const clone = getMutableClone(node);
|
||||
clone.decorators = undefined;
|
||||
clone.modifiers = undefined;
|
||||
clone.questionToken = undefined;
|
||||
clone.type = undefined;
|
||||
aggregateTransformFlags(clone);
|
||||
return visitEachChild(clone, visitor, context);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1070,7 +1070,7 @@ namespace ts {
|
|||
export interface JsxAttribute extends Node {
|
||||
name: Identifier;
|
||||
/// JSX attribute initializers are optional; <X y /> is sugar for <X y={true} />
|
||||
initializer?: Expression;
|
||||
initializer?: StringLiteral | JsxExpression;
|
||||
}
|
||||
|
||||
// @kind(SyntaxKind.JsxSpreadAttribute)
|
||||
|
|
|
@ -3408,7 +3408,8 @@ namespace ts {
|
|||
|| kind === SyntaxKind.ImportDeclaration
|
||||
|| kind === SyntaxKind.ImportEqualsDeclaration
|
||||
|| kind === SyntaxKind.ExportDeclaration
|
||||
|| kind === SyntaxKind.ExportAssignment;
|
||||
|| kind === SyntaxKind.ExportAssignment
|
||||
|| kind === SyntaxKind.GlobalModuleExportDeclaration;
|
||||
}
|
||||
|
||||
function isStatementKindButNotDeclarationKind(kind: SyntaxKind) {
|
||||
|
@ -3495,6 +3496,12 @@ namespace ts {
|
|||
return node.kind === SyntaxKind.JsxAttribute;
|
||||
}
|
||||
|
||||
export function isStringLiteralOrJsxExpression(node: Node): node is StringLiteral | JsxExpression {
|
||||
const kind = node.kind;
|
||||
return kind === SyntaxKind.StringLiteral
|
||||
|| kind === SyntaxKind.JsxExpression;
|
||||
}
|
||||
|
||||
// Clauses
|
||||
|
||||
export function isCaseOrDefaultClause(node: Node): node is CaseOrDefaultClause {
|
||||
|
|
|
@ -400,7 +400,7 @@ namespace ts {
|
|||
],
|
||||
[SyntaxKind.JsxAttribute]: [
|
||||
{ name: "name", test: isIdentifier },
|
||||
{ name: "initializer", test: isExpression, optional: true },
|
||||
{ name: "initializer", test: isStringLiteralOrJsxExpression, optional: true },
|
||||
],
|
||||
[SyntaxKind.JsxSpreadAttribute]: [
|
||||
{ name: "expression", test: isExpression },
|
||||
|
|
|
@ -34,8 +34,7 @@ class StringIterator {
|
|||
//// [iteratorSpreadInCall12.js]
|
||||
new Foo(...[...new SymbolIterator, ...[...new StringIterator]]);
|
||||
class Foo {
|
||||
constructor(...s) {
|
||||
}
|
||||
constructor(...s) { }
|
||||
}
|
||||
class SymbolIterator {
|
||||
next() {
|
||||
|
|
|
@ -34,8 +34,7 @@ class StringIterator {
|
|||
//// [iteratorSpreadInCall8.js]
|
||||
new Foo(...new SymbolIterator, ...new StringIterator);
|
||||
class Foo {
|
||||
constructor(...s) {
|
||||
}
|
||||
constructor(...s) { }
|
||||
}
|
||||
class SymbolIterator {
|
||||
next() {
|
||||
|
|
|
@ -34,8 +34,7 @@ class StringIterator {
|
|||
//// [iteratorSpreadInCall9.js]
|
||||
new Foo(...new SymbolIterator, ...[...new StringIterator]);
|
||||
class Foo {
|
||||
constructor(...s) {
|
||||
}
|
||||
constructor(...s) { }
|
||||
}
|
||||
class SymbolIterator {
|
||||
next() {
|
||||
|
|
Loading…
Reference in a new issue