From 3db19843e29c574f781abe1b61db43b6035deec5 Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Tue, 30 Mar 2021 10:35:18 -0700 Subject: [PATCH] chore: add eslint plugin for jest-playwright --- .eslintrc.yaml | 11 ++++++++++- package.json | 1 + test/jest.e2e.config.ts | 8 +++++++- yarn.lock | 5 +++++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/.eslintrc.yaml b/.eslintrc.yaml index 63515520a..b889a5e7f 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -16,6 +16,9 @@ extends: - plugin:import/typescript - plugin:prettier/recommended - prettier # Removes eslint rules that conflict with prettier. + # Recommended by jest-playwright + # https://github.com/playwright-community/jest-playwright#globals + - plugin:jest-playwright/recommended rules: # Sometimes you need to add args to implement a function signature even @@ -32,7 +35,13 @@ rules: "@typescript-eslint/no-extra-semi": off eqeqeq: error import/order: - [error, { alphabetize: { order: "asc" }, groups: [["builtin", "external", "internal"], "parent", "sibling"] }] + [ + error, + { + alphabetize: { order: "asc" }, + groups: [["builtin", "external", "internal"], "parent", "sibling"], + }, + ] no-async-promise-executor: off # This isn't a real module, just types, which apparently doesn't resolve. import/no-unresolved: [error, { ignore: ["express-serve-static-core"] }] diff --git a/package.json b/package.json index 059c53375..0d94c3aa0 100644 --- a/package.json +++ b/package.json @@ -61,6 +61,7 @@ "eslint-config-prettier": "^8.1.0", "eslint-import-resolver-alias": "^1.1.2", "eslint-plugin-import": "^2.18.2", + "eslint-plugin-jest-playwright": "^0.2.1", "eslint-plugin-prettier": "^3.1.0", "istanbul-badges-readme": "^1.2.0", "leaked-handles": "^5.2.0", diff --git a/test/jest.e2e.config.ts b/test/jest.e2e.config.ts index e2a7a1448..6f0fa73a7 100644 --- a/test/jest.e2e.config.ts +++ b/test/jest.e2e.config.ts @@ -7,7 +7,13 @@ const config: Config.InitialOptions = { "^.+\\.ts$": "/node_modules/ts-jest", }, globalSetup: "/utils/globalSetup.ts", - testEnvironment: "node", + testEnvironmentOptions: { + "jest-playwright": { + // TODO enable on webkit as well + // waiting on https://github.com/playwright-community/jest-playwright/issues/659 + browsers: ["chromium", "firefox"], + }, + }, testPathIgnorePatterns: ["/node_modules/", "/lib/", "/out/", "test/unit"], testTimeout: 30000, modulePathIgnorePatterns: [ diff --git a/yarn.lock b/yarn.lock index c96f175c2..0bb8e9de1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3164,6 +3164,11 @@ eslint-plugin-import@^2.18.2: resolve "^1.17.0" tsconfig-paths "^3.9.0" +eslint-plugin-jest-playwright@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest-playwright/-/eslint-plugin-jest-playwright-0.2.1.tgz#8778fee9d5915132a03d94370d3eea0a7ddd08f3" + integrity sha512-BicKUJUpVPsLbHN8c5hYaZn6pv8PCMjBGHXUfvlY1p75fh4APVfX2gTK14HuiR8/Bv3fKBQu5MTaqCro4E3OHg== + eslint-plugin-prettier@^3.1.0: version "3.3.1" resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.3.1.tgz#7079cfa2497078905011e6f82e8dd8453d1371b7"