-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Support return array #22
base: main
Are you sure you want to change the base?
Changes from all commits
079141b
bdaf944
add4b0a
31576cd
0b5479a
24cd179
c78dea9
6475b09
813f9d1
946dde5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
**/node_modules | ||
build | ||
build | ||
integrationTests/__fixtures__ | ||
generator/fixtures |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,7 +73,17 @@ const createRunner = (runPath, { getExtraOptions } = {}) => { | |
return runner(baseOptions); | ||
}); | ||
}) | ||
.then(result => onResult(test, result)) | ||
.then(testResult => { | ||
if (Array.isArray(testResult)) { | ||
testResult.forEach(result => | ||
result.numFailingTests > 0 | ||
? onFailure(test, new Error(result.errorMessage)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this correct? I thought Could you show an example of how this is used in a runner and how it looks when used in Jest? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are correct, onFailure is when the framework errors out. It is passed a SerializableError I am working on this jest-python. It would be good to see if it was at all possible to simplify its implementation with this library. |
||
: onResult(test, result), | ||
); | ||
return; | ||
} | ||
onResult(test, testResult); | ||
}) | ||
.catch(err => onFailure(test, err)), | ||
), | ||
Promise.resolve(), | ||
|
@@ -142,8 +152,18 @@ const createRunner = (runPath, { getExtraOptions } = {}) => { | |
const runAllTests = Promise.all( | ||
tests.map(test => | ||
runTestInWorker(test) | ||
.then(testResult => onResult(test, testResult)) | ||
.catch(error => onError(error, test)), | ||
.then(testResult => { | ||
if (Array.isArray(testResult)) { | ||
testResult.forEach(result => | ||
result.numFailingTests > 0 | ||
? onError(new Error(result.errorMessage), test) | ||
: onResult(test, result), | ||
); | ||
return; | ||
} | ||
onResult(test, testResult); | ||
}) | ||
.catch(err => onError(err, test)), | ||
), | ||
); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you do an
if
rather than the ternary?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, soon maybe cuz I'm not active in the past year.