fix: set status property on the module API resolved object (#8799)

This commit is contained in:
Gleb Bahmutov
2020-10-19 04:50:52 -04:00
committed by GitHub
parent 7d658ad029
commit 3ce20beee4
4 changed files with 26 additions and 0 deletions
+1
View File
@@ -41,6 +41,7 @@ const cypressModuleApi = {
.then((output) => {
if (!output) {
return {
status: 'failed',
failures: failedTests,
message: 'Could not find Cypress test run results',
}
+18
View File
@@ -68,6 +68,24 @@ describe('cypress', function () {
})
})
context('.run fails to write results file', function () {
it('resolves with error object', function () {
const outputPath = path.join(os.tmpdir(), 'cypress/monorepo/cypress_spec/output.json')
sinon.stub(tmp, 'fileAsync').resolves(outputPath)
sinon.stub(run, 'start').resolves(2)
sinon.stub(fs, 'readJsonAsync').withArgs(outputPath).resolves()
return cypress.run().then((result) => {
expect(result).to.deep.equal({
status: 'failed',
failures: 2,
message: 'Could not find Cypress test run results',
})
})
})
})
context('.run', function () {
let outputPath