Skip to content

Commit

Permalink
chore: exit successfully when test report directory doesn't exist (#2…
Browse files Browse the repository at this point in the history
  • Loading branch information
astone123 authored Oct 6, 2023
1 parent 9659e18 commit 92cc6da
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
10 changes: 10 additions & 0 deletions scripts/unit/verify-mocha-results-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ if (process.platform !== 'win32') {
describe('verify-mocha-results', () => {
let cachedEnv = { ...process.env }

let fsAccessStub

afterEach(() => {
sinon.restore()
Object.assign(process.env, cachedEnv)
Expand All @@ -19,11 +21,19 @@ if (process.platform !== 'win32') {
Dispatched: { TaskInfo: { Environment: { somekey: 'someval' } } },
}))

fsAccessStub = sinon.stub(fs, 'access').withArgs('/tmp/cypress/junit').resolves()

sinon.stub(fs, 'readdir').withArgs('/tmp/cypress/junit').resolves([
'report.xml',
])
})

it('exits normally when report directory does not exist', async () => {
fsAccessStub.rejects()

await verifyMochaResults()
})

it('does not fail with normal report', async () => {
fs.readFile
.withArgs('/tmp/cypress/junit/report.xml')
Expand Down
8 changes: 8 additions & 0 deletions scripts/verify-mocha-results.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ async function checkReportFiles (filenames) {

async function verifyMochaResults () {
try {
try {
await fs.access(REPORTS_PATH)
} catch {
console.log('Reports directory does not exist - assuming no tests ran')

return
}

const filenames = await fs.readdir(REPORTS_PATH)

const resultCount = filenames.length
Expand Down

5 comments on commit 92cc6da

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 92cc6da Oct 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.3.1/linux-arm64/develop-92cc6da75861011650372d77e73cb6c3e7b8c2a4/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 92cc6da Oct 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.3.1/linux-x64/develop-92cc6da75861011650372d77e73cb6c3e7b8c2a4/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 92cc6da Oct 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.3.1/darwin-x64/develop-92cc6da75861011650372d77e73cb6c3e7b8c2a4/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 92cc6da Oct 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.3.1/darwin-arm64/develop-92cc6da75861011650372d77e73cb6c3e7b8c2a4/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 92cc6da Oct 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the win32 x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.3.1/win32-x64/develop-92cc6da75861011650372d77e73cb6c3e7b8c2a4/cypress.tgz

Please sign in to comment.