Skip to content

Batch coverage data sent to combineCoverage to prevent timeouts #877

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add test-app package for testing usage of the sendCoverageBatchSize e…
…nvironment variable
  • Loading branch information
aantes-st committed Oct 2, 2024
commit 60797e52e714ca755f99b87131eaff28d5860235
2 changes: 2 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ workflows:
jobname:
- all-files
- backend
- batch-send-coverage
- before-all-visit
- before-each-visit
- cra-e2e-and-ct
Expand Down Expand Up @@ -174,6 +175,7 @@ workflows:
- test-code-coverage-plugin
- test-all-files
- test-backend
- test-batch-send-coverage
- test-before-all-visit
- test-before-each-visit
- test-cra-e2e-and-ct
Expand Down
3 changes: 3 additions & 0 deletions test-apps/batch-send-coverage/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"plugins": ["istanbul"]
}
4 changes: 4 additions & 0 deletions test-apps/batch-send-coverage/README.md
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.
14 changes: 14 additions & 0 deletions test-apps/batch-send-coverage/cypress.config.js
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'
}
})
24 changes: 24 additions & 0 deletions test-apps/batch-send-coverage/cypress/e2e/spec.cy.js
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__')
})
4 changes: 4 additions & 0 deletions test-apps/batch-send-coverage/cypress/plugins/index.js
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
}
1 change: 1 addition & 0 deletions test-apps/batch-send-coverage/cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '@cypress/code-coverage/support'
1 change: 1 addition & 0 deletions test-apps/batch-send-coverage/cypress/support/e2e.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require('./commands')
17 changes: 17 additions & 0 deletions test-apps/batch-send-coverage/index.html
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>
3 changes: 3 additions & 0 deletions test-apps/batch-send-coverage/main.js
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
Loading
Loading