Skip to content

Commit

Permalink
Update warning to call Cypress.moment deprecated as opposed to invoke…
Browse files Browse the repository at this point in the history
…d Cypress.moment()
  • Loading branch information
jennifer-shehane committed Dec 4, 2020
1 parent f36a0c0 commit c9e4644
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/driver/cypress/integration/util/moment_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ context('#moment', () => {
cy.stub(Cypress.utils, 'warning')

Cypress.moment()
expect(Cypress.utils.warning).to.be.calledWith('`Cypress.moment()` has been deprecated and will be replaced in a future release. Consider migrating to a different datetime formatter.')
expect(Cypress.utils.warning).to.be.calledWith('`Cypress.moment` has been deprecated and will be replaced in a future release. Consider migrating to a different datetime formatter.')
})

it('still has other moment properties', () => {
Expand All @@ -16,13 +16,13 @@ context('#moment', () => {
cy.stub(Cypress.utils, 'warning')

Cypress.moment.duration()
expect(Cypress.utils.warning).to.be.calledWith('`Cypress.moment()` has been deprecated and will be replaced in a future release. Consider migrating to a different datetime formatter.')
expect(Cypress.utils.warning).to.be.calledWith('`Cypress.moment` has been deprecated and will be replaced in a future release. Consider migrating to a different datetime formatter.')
})

it('logs deprecation warning when using isDate', () => {
cy.stub(Cypress.utils, 'warning')

Cypress.moment.isDate()
expect(Cypress.utils.warning).to.be.calledWith('`Cypress.moment()` has been deprecated and will be replaced in a future release. Consider migrating to a different datetime formatter.')
expect(Cypress.utils.warning).to.be.calledWith('`Cypress.moment` has been deprecated and will be replaced in a future release. Consider migrating to a different datetime formatter.')
})
})
2 changes: 1 addition & 1 deletion packages/driver/src/cypress/error_messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@ module.exports = {
},

moment: {
deprecated: `\`Cypress.moment()\` has been deprecated and will be replaced in a future release. Consider migrating to a different datetime formatter.`,
deprecated: `\`Cypress.moment\` has been deprecated and will be replaced in a future release. Consider migrating to a different datetime formatter.`,
},

navigation: {
Expand Down

0 comments on commit c9e4644

Please sign in to comment.