Skip to content

Commit bdddd27

Browse files
add plugins test
1 parent d7b534b commit bdddd27

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

packages/driver/cypress/integration/commands/task_spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ describe('src/cy/commands/task', () => {
210210
expect(lastLog.get('error')).to.eq(err)
211211
expect(lastLog.get('state')).to.eq('failed')
212212

213-
expect(err.message).to.eq(`\`cy.task('bar')\` failed with the following error:\n\nThe task 'bar' was not handled in the plugins file. The following tasks are registered: return:arg, arg:is:undefined, wait, create:long:file\n\nFix this in your plugins file here:\n${Cypress.config('pluginsFile')}`)
213+
expect(err.message).to.eq(`\`cy.task('bar')\` failed with the following error:\n\nThe task 'bar' was not handled in the plugins file. The following tasks are registered: return:arg, cypress:env, arg:is:undefined, wait, create:long:file\n\nFix this in your plugins file here:\n${Cypress.config('pluginsFile')}`)
214214

215215
done()
216216
})
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
describe('CYPRESS env var', () => {
2+
it('checks that the CYPRESS env var exists in the plugin file', () => {
3+
cy.task('cypress:env').should('eq', 'true')
4+
})
5+
})

packages/driver/cypress/plugins/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ module.exports = (on) => {
3838
'return:arg' (arg) {
3939
return arg
4040
},
41+
'cypress:env' () {
42+
return process.env['CYPRESS']
43+
},
4144
'arg:is:undefined' (arg) {
4245
if (arg === undefined) {
4346
return 'arg was undefined'

0 commit comments

Comments
 (0)