diff --git a/index.js b/index.js index 3c433cbc..044c6992 100644 --- a/index.js +++ b/index.js @@ -11,13 +11,13 @@ module.exports = { }, environments: { globals: { - globals: Object.assign(globals.browser, globals.mocha, { + globals: Object.assign({ cy: false, Cypress: false, expect: false, assert: false, chai: false, - }), + }, globals.browser, globals.mocha), parserOptions: { ecmaVersion: 2019, sourceType: 'module', diff --git a/tests/config.js b/tests/config.js new file mode 100644 index 00000000..2bc9b2cd --- /dev/null +++ b/tests/config.js @@ -0,0 +1,25 @@ +'use strict' + +const globals = require('globals') +const config = require('../index.js') + +describe('environments globals', () => { + const env = config.environments.globals + + it('should not mutate globals', () => { + expect(globals.browser).not.toHaveProperty('cy') + expect(globals.mocha).not.toHaveProperty('cy') + }); + + it('should include other globals', () => { + expect(env.globals).toEqual(expect.objectContaining(globals.browser)) + expect(env.globals).toEqual(expect.objectContaining(globals.mocha)) + }); + + it('should include cypress globals', () => { + expect(env.globals).toEqual(expect.objectContaining({ + cy: false, + Cypress: false, + })) + }); +})