Skip to content

Commit

Permalink
fix eslint for fixture specs (cypress-io#5176)
Browse files Browse the repository at this point in the history
* update eslint to lint files within 'fixtures' in support files

- ignore some edge cases like jquery, jsx and obvious js files we wrote
with broken code

* Fixes from eslint to 'fixtures' files
  • Loading branch information
jennifer-shehane authored and grabartley committed Oct 6, 2019
1 parent 1f87fa5 commit 3fe7fb1
Show file tree
Hide file tree
Showing 21 changed files with 55 additions and 31 deletions.
7 changes: 6 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
**/dist
**/dist-test
**/node_modules
**/support/fixtures
**/support/fixtures/*
!**/support/fixtures/projects
**/support/fixtures/projects/**/_fixtures/*
**/support/fixtures/projects/**/*.jsx
**/support/fixtures/projects/**/jquery.js
**/support/fixtures/projects/**/fail.js
**/test/fixtures
**/vendor

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import "./does/not/exist"
import './does/not/exist'
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/* eslint-disable mocha/no-global-tests */
it('works', () => {})
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import "../../lib/fail"
import '../../lib/fail'
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ describe('https passthru retries', () => {
img.onload = () => {
reject(new Error('onload event fired, but should not have. expected onerror to fire.'))
}

img.onerror = resolve
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ describe('network error handling', function () {
})
.get('input[type=text]')
.type('bar')

cy.get('input[type=submit]')
.click()

cy.contains('{"foo":"bar"}')
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ module.exports = (on) => {

'record:fast_visit_spec' ({ percentiles, url, browser, currentRetry }) {
percentiles.forEach(([percent, percentile]) => {
// eslint-disable-next-line no-console
console.log(`${percent}%\t of visits to ${url} finished in less than ${percentile}ms`)
})

Expand All @@ -110,8 +111,9 @@ module.exports = (on) => {
currentRetry,
...percentiles.reduce((acc, pair) => {
acc[pair[0]] = pair[1]

return acc
}, {})
}, {}),
}

return performance.track('fast_visit_spec percentiles', data)
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
console.log("bar")
/* eslint-disable no-console */
console.log('bar')
4 changes: 2 additions & 2 deletions packages/server/test/support/fixtures/projects/e2e/lib/bar.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import baz from "./baz"
import baz from './baz'

export default baz
export default baz
4 changes: 2 additions & 2 deletions packages/server/test/support/fixtures/projects/e2e/lib/baz.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default () => {
return "baz"
}
return 'baz'
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-console */
module.exports = function Reporter (runner) {
runner.on('test end', function (test) {
console.log(test.title)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
context("some context[i9w]", function(){
context('some context[i9w]', function () {
it('tests[abc]')
})
})
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import "./dom.jsx"
import './dom.jsx'
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
module.exports = (on) => {
on('task', {
'one' () { return 'one' },
'two' () { return 'two' },
'one' () {
return 'one'
},
'two' () {
return 'two'
},
})

on('task', {
'two' () { return 'two again' },
'three' () { return 'three' },
'two' () {
return 'two again'
},
'three' () {
return 'three'
},
})
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
beforeEach(function(){
beforeEach(function () {

});
})
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
it("tests without a server", function(){
/* eslint-disable mocha/no-global-tests */
it('tests without a server', function () {

});
})
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* global document */

const el = document.getElementById('extension')

if (el) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,22 @@
"version": "0",
"description": "tests adding user extension into Cypress",
"permissions": [
"tabs", "webNavigation", "<all_urls>"
"tabs",
"webNavigation",
"<all_urls>"
],
"content_scripts": [
{
"matches": ["<all_urls>"],
"matches": [
"<all_urls>"
],
"exclude_matches": [
"*://*/__cypress/*",
"*://*/__/*"
],
"js": ["background.js"],
"js": [
"background.js"
],
"run_at": "document_end",
"all_frames": true
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* global Promise */

module.exports = (on) => {
on('file:preprocessor', () => {
return new Promise(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
it("is truthy", function(){
/* eslint-disable mocha/no-global-tests */
it('is truthy', function () {
expect(true).to.be.true
})
})
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* global it, expect */

/* eslint-disable mocha/no-global-tests */
it('is another spec', () => {
expect(false).to.be.false
})

0 comments on commit 3fe7fb1

Please sign in to comment.