jest-runner-tsd
Advanced tools
Comparing version 1.0.1 to 1.1.0
{ | ||
"name": "jest-runner-tsd", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "A Jest runner that tests typescript typings using tsd under the hood", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -1,19 +0,20 @@ | ||
// @ts-check | ||
const { toTestResult } = require('./toTestResult'); | ||
const { toMultipleTestResults } = require('./toMultipleTestResults'); | ||
module.exports.fail = ({ start, end, test, errorMessage, numFailed, numPassed }) => { | ||
const stats = { | ||
failures: numFailed, | ||
passes: numPassed, | ||
pending: 0, | ||
todo: 0, | ||
end, | ||
start, | ||
}; | ||
module.exports.fail = ({ start, end, failures, numPassed }) => { | ||
return toMultipleTestResults({ | ||
stats: { | ||
failures: failures.length, | ||
pending: 0, | ||
passes: numPassed, | ||
todo: 0, | ||
start, | ||
end, | ||
}, | ||
tests: failures, | ||
jestTestPath: failures[0].path, | ||
skipped: false, | ||
return toTestResult({ | ||
stats, | ||
title: 'Type Checks', | ||
errorMessage: errorMessage.join('\n'), | ||
tests: [{duration: end - start, ...test}], | ||
jestTestPath: test.path, | ||
}); | ||
} | ||
}; |
@@ -1,5 +0,5 @@ | ||
const { toMultipleTestResults } = require('./toMultipleTestResults'); | ||
const { toTestResult } = require('./toTestResult'); | ||
module.exports.pass = ({ start, end, test, numPassed }) => { | ||
return toMultipleTestResults({ | ||
return toTestResult({ | ||
stats: { | ||
@@ -6,0 +6,0 @@ failures: 0, |
@@ -46,13 +46,17 @@ // @ts-check | ||
if (numFailed > 0) { | ||
const failures = failedTests.map((test) => ({ | ||
path: test.fileName, | ||
errorMessage: test.message, | ||
title: `${testFile}:${test.line}:${test.column} - ${test.severity} - ${test.message}` | ||
})); | ||
let errorMessage = []; | ||
failedTests.forEach(test => { | ||
errorMessage.push(`${testFile}:${test.line}:${test.column} - ${test.severity} - ${test.message}`); | ||
}); | ||
return fail({ | ||
start, | ||
end: +new Date(), | ||
failures, | ||
numPassed | ||
test: { | ||
path: testPath | ||
}, | ||
numFailed, | ||
numPassed, | ||
errorMessage, | ||
}); | ||
@@ -59,0 +63,0 @@ } |
6155
137