Comparing version
@@ -52,4 +52,2 @@ "use strict"; | ||
}); | ||
// Error.stackTraceLimit = 0; | ||
const traceStatement = ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("Error"), "stackTraceLimit"), ts.createLiteral(0))); | ||
const errors = containedDiagnostics.map(diagnostic => { | ||
@@ -65,6 +63,5 @@ const errorExpression = ts.createNew(ts.createIdentifier("Error"), [], [ts.createLiteral(typeof diagnostic.messageText === "string" ? | ||
const returnStatement = ts.createReturn(ts.createArrayLiteral([], true)); | ||
const throwStatement = ts.createThrow(ts.createElementAccess(ts.createArrayLiteral(errors, true), ts.createLiteral(0))); | ||
return ts.createBlock((errors.length ? [traceStatement, throwStatement] : [returnStatement]), true); | ||
return ts.createBlock([returnStatement], true); | ||
} | ||
} | ||
exports.BlockTransformer = BlockTransformer; |
@@ -30,8 +30,11 @@ "use strict"; | ||
expectToCompile() { | ||
if (this.errors.length) | ||
throw this.errors[0].message; | ||
if (this.errors.length) { | ||
Error.stackTraceLimit = 0; | ||
throw this.errors[0]; | ||
} | ||
}, | ||
expectToFail() { | ||
if (!this.errors.length) { | ||
`No semantic failures`; | ||
Error.stackTraceLimit = 0; | ||
throw new Error(`No semantic failures`); | ||
} | ||
@@ -41,6 +44,8 @@ }, | ||
if (!this.errors.length) { | ||
`No matching semantic failures, expected "${msg}"!`; | ||
Error.stackTraceLimit = 0; | ||
throw new Error(`No matching semantic failures, expected "${msg}"!`); | ||
} | ||
else if (this.errors.filter(e => RegExp(msg).test(e.message)).length === 0) { | ||
`Expected failure "${msg}", got failure "${this.errors[0]}"!`; | ||
Error.stackTraceLimit = 0; | ||
throw new Error(`Expected failure "${msg}", got failure "${this.errors[0]}"!`); | ||
} | ||
@@ -47,0 +52,0 @@ } |
@@ -6,3 +6,3 @@ { | ||
"license": "ISC", | ||
"version": "0.3.7", | ||
"version": "0.3.8", | ||
"main": "./dist/index.js", | ||
@@ -9,0 +9,0 @@ "types": "./dist/index.d.ts", |
341
0.59%17568
-0.88%