diff --git a/client/.eslintignore b/client/.eslintignore index 26eb60661..24669a700 100644 --- a/client/.eslintignore +++ b/client/.eslintignore @@ -1,3 +1,3 @@ build/*.js config/*.js -node_modules +client/dist diff --git a/client/.eslintrc.js b/client/.eslintrc.js index 73caba79e..ff41b8c6d 100644 --- a/client/.eslintrc.js +++ b/client/.eslintrc.js @@ -1,7 +1,7 @@ module.exports = { root: true, extends: ["airbnb", "plugin:jest/recommended"], - plugins: ["jest", "cypress"], + plugins: ["jest", "cypress", "chai-friendly"], settings: { "import/resolver": "webpack" }, @@ -56,5 +56,9 @@ module.exports = { }], "no-else-return": ["error", {"allowElseIf": true}], "object-curly-newline": ["error", {"consistent": true}], + // needed for cypress tests + "func-names": "off", + "no-unused-expressions": 0, + "chai-friendly/no-unused-expressions": 2 } }; diff --git a/client/app/components/dashboards/widget.js b/client/app/components/dashboards/widget.js index 0f2d83dc1..76db96f1e 100644 --- a/client/app/components/dashboards/widget.js +++ b/client/app/components/dashboards/widget.js @@ -19,6 +19,7 @@ const WidgetDialog = { }, }; + const EditTextBoxComponent = { template: editTextBoxTemplate, bindings: { diff --git a/client/cypress/integration/dashboard/dashboard_spec.js b/client/cypress/integration/dashboard/dashboard_spec.js index afb25a0ee..cdb74061a 100644 --- a/client/cypress/integration/dashboard/dashboard_spec.js +++ b/client/cypress/integration/dashboard/dashboard_spec.js @@ -131,7 +131,7 @@ describe('Dashboard', () => { }); }); - it('archives dashboard', function () { + it('archives dashboard', () => { createNewDashboardByAPI('Foo Bar').then(({ slug }) => { cy.visit(`/dashboard/${slug}`); @@ -201,6 +201,7 @@ describe('Dashboard', () => { }); }); + // eslint-disable-next-line jest/no-disabled-tests it.skip('allows opening menu after removal', function () { let elTestId1; addTextboxByAPI('txb 1', this.dashboardId) diff --git a/client/cypress/integration/query/search_query_spec.js b/client/cypress/integration/query/search_query_spec.js index 9244bfcf2..f5a9959ff 100644 --- a/client/cypress/integration/query/search_query_spec.js +++ b/client/cypress/integration/query/search_query_spec.js @@ -1,24 +1,24 @@ -describe("Search Query", () => { +describe('Search Query', () => { beforeEach(() => { cy.login(); - cy.request("POST", "api/queries", { - name: "Users Count", + cy.request('POST', 'api/queries', { + name: 'Users Count', data_source_id: 1, - query: "SELECT 1" + query: 'SELECT 1', }); - cy.request("POST", "api/queries", { - name: "Dashboards Count", + cy.request('POST', 'api/queries', { + name: 'Dashboards Count', data_source_id: 1, - query: "SELECT 1" + query: 'SELECT 1', }); - cy.visit("/"); + cy.visit('/'); }); - it("finds queries by name", () => { - cy.getByTestId("AppHeaderSearch").type("Users{enter}"); - cy.contains("Users Count"); + it('finds queries by name', () => { + cy.getByTestId('AppHeaderSearch').type('Users{enter}'); + cy.contains('Users Count'); }); }); diff --git a/package-lock.json b/package-lock.json index b5806d642..437983243 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5511,6 +5511,12 @@ } } }, + "eslint-plugin-chai-friendly": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-chai-friendly/-/eslint-plugin-chai-friendly-0.4.1.tgz", + "integrity": "sha512-hkpLN7VVoGGsofZjUhcQ+sufC3FgqMJwD0DvAcRfxY1tVRyQyVsqpaKnToPHJQOrRo0FQ0fSEDwW2gr4rsNdGA==", + "dev": true + }, "eslint-plugin-cypress": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/eslint-plugin-cypress/-/eslint-plugin-cypress-2.2.1.tgz", diff --git a/package.json b/package.json index 3e3917600..06332083b 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,8 @@ "watch": "webpack --watch --progress --colors -d", "analyze": "npm run clean && BUNDLE_ANALYZER=on webpack", "analyze:build": "npm run clean && NODE_ENV=production BUNDLE_ANALYZER=on webpack", - "lint": "npm run lint:base -- --ext .js --ext .jsx ./client/app", - "lint:base": "eslint --config ./client/.eslintrc.js", + "lint": "npm run lint:base -- --ext .js --ext .jsx ./client", + "lint:base": "eslint --config ./client/.eslintrc.js --ignore-path ./client/.eslintignore", "test": "TZ=Africa/Khartoum jest", "test:watch": "jest --watch", "cypress:install": "npm install --no-save cypress@^3.1.5 @percy/cypress@^0.2.3 atob@2.1.2", @@ -102,6 +102,7 @@ "eslint-config-airbnb": "^17.1.0", "eslint-import-resolver-webpack": "^0.8.3", "eslint-loader": "^2.1.1", + "eslint-plugin-chai-friendly": "^0.4.1", "eslint-plugin-cypress": "^2.0.1", "eslint-plugin-import": "^2.14.0", "eslint-plugin-jest": "^22.2.2", @@ -159,7 +160,6 @@ "npm run lint:base", "npm run test -- --bail --findRelatedTests" ] - }, - "ignore": ["client/dist/*"] + } } }