-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Batch coverage data sent to combineCoverage to prevent timeouts (#877)
- Loading branch information
Showing
17 changed files
with
814 additions
and
7 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,3 @@ | ||
{ | ||
"plugins": ["istanbul"] | ||
} |
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,4 @@ | ||
# Test Case: Batch Send Coverage | ||
This test app tests that all expected files are covered when using | ||
the `sendCoverageBatchSize` environment variable in the Cypress | ||
configuration file. |
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,14 @@ | ||
const { defineConfig } = require('cypress') | ||
|
||
module.exports = defineConfig({ | ||
fixturesFolder: false, | ||
env: { | ||
sendCoverageBatchSize: 1 | ||
}, | ||
e2e: { | ||
setupNodeEvents(on, config) { | ||
return require('./cypress/plugins/index.js')(on, config) | ||
}, | ||
baseUrl: 'http://localhost:1234' | ||
} | ||
}) |
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,24 @@ | ||
/// <reference types="cypress" /> | ||
it('works', () => { | ||
cy.visit('/') | ||
cy.contains('Page body') | ||
|
||
cy.window() | ||
.invoke('reverse', 'super') | ||
.should('equal', 'repus') | ||
|
||
cy.window() | ||
.invoke('numsTimesTwo', [1, 2, 3]) | ||
.should('deep.equal', [2, 4, 6]) | ||
|
||
cy.window() | ||
.invoke('add', 2, 3) | ||
.should('equal', 5) | ||
|
||
cy.window() | ||
.invoke('sub', 5, 2) | ||
.should('equal', 3) | ||
|
||
// application's code should be instrumented | ||
cy.window().should('have.property', '__coverage__') | ||
}) |
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,4 @@ | ||
module.exports = (on, config) => { | ||
require('@cypress/code-coverage/task')(on, config) | ||
return config | ||
} |
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 @@ | ||
import '@cypress/code-coverage/support' |
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 @@ | ||
require('./commands') |
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,17 @@ | ||
<body> | ||
Page body | ||
<script src="main.js"></script> | ||
<script src="second.js"></script> | ||
<script src="third.js"></script> | ||
// use functions creates in "main.js" | ||
if (add(2, 3) !== 5) { | ||
throw new Error('wrong addition') | ||
} | ||
if (sub(2, 3) !== -1) { | ||
throw new Error('wrong subtraction') | ||
} | ||
if (reverse('foo') !== 'oof') { | ||
throw new Error('wrong string reverse') | ||
} | ||
</script> | ||
</body> |
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,3 @@ | ||
window.add = (a, b) => a + b | ||
|
||
window.sub = (a, b) => a - b |
Oops, something went wrong.