add linting for cypress tests

This commit is contained in:
Sampo Riitala
2024-11-04 21:53:41 +02:00
parent 99d06248b7
commit 755029a60f
3 changed files with 944 additions and 21 deletions
+21
View File
@@ -0,0 +1,21 @@
import globals from 'globals'
import pluginJs from '@eslint/js'
import pluginCypress from 'eslint-plugin-cypress/flat'
import pluginPrettier from 'eslint-plugin-prettier/recommended'
// NOTE: This config is only used for running ESLint on the Cypress tests. Frontend and backend use their own configs.
/** @type {import('eslint').Linter.Config[]} */
export default [
{
languageOptions: { globals: globals.browser },
},
{
files: ['cypress/*.js'],
rules: pluginJs.configs.recommended.rules,
},
pluginCypress.configs.recommended,
pluginPrettier,
]
+913 -20
View File
File diff suppressed because it is too large Load Diff
+10 -1
View File
@@ -12,9 +12,11 @@
"dev": "docker compose -f docker-compose.dev.yml up", "dev": "docker compose -f docker-compose.dev.yml up",
"dev:down": "docker compose -f docker-compose.dev.yml down -v", "dev:down": "docker compose -f docker-compose.dev.yml down -v",
"anon:down": "docker compose -f docker-compose.anon.yml down -v", "anon:down": "docker compose -f docker-compose.anon.yml down -v",
"check": "echo \"Running checks for both services...\" && npm run check:frontend && npm run check:backend && echo \"All good! :)\"", "check": "echo \"Running checks for both services and cypress tests...\" && npm run check:frontend && npm run check:backend && npm run check:cypress && echo \"All good! :)\"",
"check:backend": "echo \"Running backend tsc ...\" && cd backend && npx tsc --noEmit && echo \"Running backend eslint ...\"&& npm run lint", "check:backend": "echo \"Running backend tsc ...\" && cd backend && npx tsc --noEmit && echo \"Running backend eslint ...\"&& npm run lint",
"check:frontend": "echo \"Running frontend tsc ...\" && cd frontend && npx tsc --noEmit && echo \"Running frontend eslint ...\" && npm run lint", "check:frontend": "echo \"Running frontend tsc ...\" && cd frontend && npx tsc --noEmit && echo \"Running frontend eslint ...\" && npm run lint",
"check:cypress": "echo \"Running cypress eslint ...\" && npm run lint:cypress",
"lint:cypress": "eslint --report-unused-disable-directives --max-warnings 0 cypress/e2e/**.cy.js",
"test:up": "docker compose -f docker-compose.test.yml up db-anon backend frontend", "test:up": "docker compose -f docker-compose.test.yml up db-anon backend frontend",
"test:down": "docker compose -f docker-compose.test.yml down -v", "test:down": "docker compose -f docker-compose.test.yml down -v",
"test:ci": "docker compose -f docker-compose.test.yml up", "test:ci": "docker compose -f docker-compose.test.yml up",
@@ -44,8 +46,15 @@
"author": "", "author": "",
"devDependencies": { "devDependencies": {
"@cypress/code-coverage": "^3.13.2", "@cypress/code-coverage": "^3.13.2",
"@eslint/js": "^9.14.0",
"@types/leaflet": "^1.9.12", "@types/leaflet": "^1.9.12",
"cypress": "^13.11.0", "cypress": "^13.11.0",
"eslint": "^9.14.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-cypress": "^4.1.0",
"eslint-plugin-prettier": "^5.2.1",
"globals": "^15.12.0",
"prettier": "^3.3.3",
"supertest": "^7.0.0" "supertest": "^7.0.0"
} }
} }