Skip to content

Commit 517b2db

Browse files
committed
feat: check per page and unit code coverage on CI
1 parent f933e9d commit 517b2db

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

.circleci/config.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,9 @@ workflows:
1919
# print code coverage summary to the terminal
2020
# and make sure there the coverage is above certain limit
2121
- run: npx nyc report --check-coverage true --lines 80
22+
# make sure second page (about.html) has its JavaScript counted and covered
23+
- run: npx nyc report --check-coverage true --lines 100 --include cypress/about.js
24+
# make sure unit tests are covered
25+
- run: npx nyc report --check-coverage true --lines 100 --include cypress/unit.js
2226
# publish new version if necessary
2327
- run: npm run semantic-release

cypress/integration/spec.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,24 @@ const { fixSourcePathes } = require('../../utils')
88
context('Page test', () => {
99
beforeEach(() => {
1010
cy.visit('/', {
11-
onBeforeLoad (win) {
11+
onBeforeLoad(win) {
1212
cy.spy(win.console, 'log').as('log')
1313
}
1414
})
15-
16-
cy.contains('About').click()
1715
})
1816

19-
it('logs names', function () {
17+
it('logs names', function() {
2018
cy.get('@log')
2119
.should('have.been.calledOnce')
2220
.should('have.been.calledWith', 'just names', ['joe', 'mary'])
2321
})
22+
23+
it('loads About page', () => {
24+
cy.contains('About').click()
25+
cy.url().should('match', /\/about/)
26+
cy.contains('h2', 'About')
27+
cy.contains('Est. 2019')
28+
})
2429
})
2530

2631
context('Unit tests', () => {

0 commit comments

Comments
 (0)