diff --git a/.eslintrc.json b/.eslintrc.json index 12015d814c8..e3a35a2bc18 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,8 +1,5 @@ { - "extends": [ - "@vkontakte/eslint-config/typescript/react", - "plugin:jest-playwright/recommended" - ], + "extends": ["@vkontakte/eslint-config/typescript/react"], "parserOptions": { "project": "./tsconfig.json", "ecmaVersion": 2018, // Allows for the parsing of modern ECMAScript features @@ -19,8 +16,7 @@ "env": { "es6": true, // Enable global es6 variables, like Set, Map, etc "browser": true, - "node": true, - "jest": true + "node": true }, "rules": { "@typescript-eslint/explicit-member-accessibility": "off", @@ -29,5 +25,17 @@ "@typescript-eslint/no-unused-vars": ["error", { "ignoreRestSiblings": true }] - } + }, + "overrides": [ + { + "files": ["src/**/*.{test,spec,e2e}.{ts,tsx}", "e2e/**/*", "src/testing/**/*"], + "env": { + "jest": true + } + }, + { + "files": ["src/**/*.e2e.{ts,tsx}", "e2e/**/*", "src/testing/**/*"], + "extends": ["plugin:jest-playwright/recommended"] + } + ] } diff --git a/e2e/browser/mount.ts b/e2e/browser/mount.ts index 9dc6a88125c..3933767df29 100644 --- a/e2e/browser/mount.ts +++ b/e2e/browser/mount.ts @@ -1,9 +1,9 @@ -import { ReactElement } from 'react' -import { currentPath } from './jest-mock' -import { testHandle } from './test-handle' +import { ReactElement } from 'react'; +import { currentPath } from './jest-mock'; +import { testHandle } from './test-handle'; export function mount(jsx: ReactElement) { testHandle.register(currentPath(), jsx); } -export const screenshot = mount; \ No newline at end of file +export const screenshot = mount; diff --git a/e2e/jest.e2e.config.js b/e2e/jest.e2e.config.js index 0e679ce9158..7208944480d 100644 --- a/e2e/jest.e2e.config.js +++ b/e2e/jest.e2e.config.js @@ -1,4 +1,4 @@ -const base = require('../jest.unit.config') +const base = require('../jest.unit.config'); const path = require('path'); const chalk = require('chalk'); const { canRunTests, useDocker } = require('./detectEnv'); @@ -10,7 +10,7 @@ const jestPlaywrightOptions = Object.assign({ width: 800, height: 600, }, - } + }, }, useDocker ? { connectOptions: { wsEndpoint: 'ws://localhost:9001/playwright', @@ -23,14 +23,14 @@ const config = { preset: 'jest-playwright-preset', collectCoverage: false, setupFilesAfterEnv: [ - ...(base.setupFilesAfterEnv || []), + ...base.setupFilesAfterEnv || [], path.join(__dirname, 'jest/matchers.ts'), ], globalSetup: path.join(__dirname, 'jest/globalSetup.ts'), globalTeardown: path.join(__dirname, 'jest/globalTeardown.ts'), testEnvironment: path.join(__dirname, 'jest/jsdomPlaywrightEnv.js'), testEnvironmentOptions: { - ...(base.testEnvironmentOptions || {}), + ...base.testEnvironmentOptions || {}, 'jest-playwright': jestPlaywrightOptions, }, moduleNameMapper: { diff --git a/package.json b/package.json index 99610961368..818d31b4ee4 100644 --- a/package.json +++ b/package.json @@ -122,7 +122,7 @@ "test:e2e": "jest --config e2e/jest.e2e.config.js", "test:code": "jest", - "lint:es": "eslint --ext .jsx,.js,.ts,.tsx src/ --cache --cache-location .cache/.eslintcache", + "lint:es": "eslint --ext .jsx,.js,.ts,.tsx src/ e2e/ --cache --cache-location .cache/.eslintcache", "lint:es:ci": "yarn lint:es -o lint-results.json -f json", "lint:style": "stylelint \"./src/**/*.css\" --cache --cache-location .cache/.stylelintcache", "typecheck": "tsc --incremental --emitDeclarationOnly --declaration --tsBuildInfoFile .cache/.tsbuildinfo --outDir .cache/ts", diff --git a/tsconfig.json b/tsconfig.json index 2943e37f5e2..c9dc63c8728 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -19,7 +19,7 @@ "@react-playwright": ["../e2e"] } }, - "include": ["src/**/*.ts", "src/**/*.tsx", "e2e/**/*.ts", "e2e/**/*.tsx"], + "include": ["src/**/*.ts", "src/**/*.tsx", "e2e/**/*.ts", "e2e/**/*.tsx", "e2e/**/*.js"], "files": [ "node_modules/jest-playwright-preset/types/global.d.ts", "node_modules/expect-playwright/global.d.ts"