Skip to content

Commit

Permalink
fix: avoid mutating eslint browser environment
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbreiding committed Aug 1, 2019
2 parents a66873e + 0bd34ab commit 63812a5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Expand Up @@ -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',
Expand Down
25 changes: 25 additions & 0 deletions 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,
}))
});
})

0 comments on commit 63812a5

Please sign in to comment.