-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI should fail when something went wrong. (#5779)
* Added unit test script wrapper. * Removed bin-up to make lint-coffee fail. * Made mocha tests return non-zero value on failure for reporter and runner * Added empty space to test ci failure. * remove extra whitespace * use Promise.delay instead of hand-rolled sleep function * include root-level tests * exit with number of failures
- Loading branch information
1 parent
e313f8c
commit e19bcc0
Showing
5 changed files
with
36 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// This file exists because mocha doesn't return non-zero value when there is a failed test. | ||
// When https://github.com/mochajs/mocha/issues/3893 is fixed, it will be removed. | ||
|
||
const { spawn } = require('child_process') | ||
const Promise = require('bluebird') | ||
|
||
// Test result on console. | ||
let log = '' | ||
const proc = spawn(`node`, ['./node_modules/.bin/mocha', 'src/**/*.spec.*'], {}) | ||
|
||
proc.stdout.on('data', (data) => { | ||
log += data | ||
}) | ||
|
||
proc.stdout.on('end', async () => { | ||
await Promise.delay(500) | ||
|
||
const result = log.match(/\d+ passing.*\n\s*(\d+) failing/) | ||
const numFailing = result && parseInt(result[1], 10) | ||
|
||
if (!isNaN(numFailing)) { | ||
process.exit(numFailing) | ||
} | ||
|
||
process.exit(0) | ||
}) | ||
|
||
// Show result on console. | ||
spawn(`node`, ['./node_modules/.bin/mocha', '"src/*.spec.*" "src/**/*.spec.*"'], { | ||
stdio: 'inherit', | ||
shell: true, | ||
}) |
e19bcc0
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.
AppVeyor has built the
win32 ia32
version of the Test Runner.You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.
You will need to use custom
CYPRESS_INSTALL_BINARY
url and install Cypress using an url instead of the version.e19bcc0
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.
AppVeyor has built the
win32 x64
version of the Test Runner.You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.
You will need to use custom
CYPRESS_INSTALL_BINARY
url and install Cypress using an url instead of the version.e19bcc0
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.
Circle has built the
linux x64
version of the Test Runner.You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.
You will need to use custom
CYPRESS_INSTALL_BINARY
url and install Cypress using an url instead of the version.e19bcc0
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.
Circle has built the
darwin x64
version of the Test Runner.You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.
You will need to use custom
CYPRESS_INSTALL_BINARY
url and install Cypress using an url instead of the version.