Skip to content

Commit 32dd32f

Browse files
committed
Prepare workflow to run on CI
1 parent c7ef7dc commit 32dd32f

8 files changed

Lines changed: 42 additions & 9 deletions

File tree

.eslintignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
playwright-ct.config.ts
2+
playwright/
3+
14
lint-staged.config.js
25
jest.config.js
36
babel.config.js
7+
48
coverage/
59
dist/
610
docs/

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
{
4747
"files": ["*.spec.*"],
4848
"rules": {
49+
"import/no-unresolved": "off",
4950
"jest/no-standalone-expect": "off",
5051
"@typescript-eslint/no-unsafe-member-access": "off",
5152
"@typescript-eslint/no-unsafe-call": "off"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Visual Regression Tests
2+
3+
on: pull_request
4+
5+
jobs:
6+
visual-regression-tests:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- name: Docker Compose Action
11+
uses: isbang/compose-action@v1.4.1
12+
with:
13+
up-flags: "--exit-code-from playwright --abort-on-container-exit"

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ RUN apt-get update && apt-get -y install libnss3 libatk-bridge2.0-0 libdrm-dev l
44

55
WORKDIR /app
66
COPY package.json .
7-
RUN npm install
7+
RUN npm install --quiet

jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module.exports = {
22
collectCoverageFrom: [
33
'src/**/*.{ts,tsx,js,jsx}',
4+
'!**/*.spec.{js,jsx,ts,tsx}',
45
'!**/*.stories.{js,jsx,ts,tsx}',
56
'!**/*storybook*.{js,jsx,ts,tsx}',
67
],

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"scripts": {
2828
"postinstall": "patch-package",
2929
"setup": "npm install && npm run validate",
30-
"validate": "npm run lint && npm run type-check && npm run test",
30+
"validate": "npm run lint && npm run type-check && npm run test && npm run visual-tests",
3131
"start": "tsdx watch --onSuccess \"./scripts/organize-styles.sh\"",
3232
"build-all": "npm run build && npm run build:storybook",
3333
"build": "scripts/build.sh",
@@ -41,7 +41,7 @@
4141
"storybook": "start-storybook -p 6006",
4242
"prettify": "prettier --write \"./**/*.{js,jsx,ts,tsx,json,css,scss,less,md,mdx}\"",
4343
"test-ct": "playwright test -c playwright-ct.config.ts",
44-
"visual-tests": "docker compose up"
44+
"visual-tests": "docker compose up --exit-code-from playwright"
4545
},
4646
"peerDependencies": {
4747
"classnames": "^2.2.5",

playwright-ct.config.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import type { PlaywrightTestConfig } from '@playwright/experimental-ct-react'
21
import { devices } from '@playwright/experimental-ct-react'
32

3+
import type { PlaywrightTestConfig } from '@playwright/experimental-ct-react'
4+
45
/**
56
* See https://playwright.dev/docs/test-configuration.
67
*/
@@ -32,9 +33,22 @@ const config: PlaywrightTestConfig = {
3233

3334
/* Configure projects for major browsers */
3435
projects: [
35-
{ name: 'chromium', use: { ...devices['Desktop Chrome'] } },
36-
{ name: 'firefox', use: { ...devices['Desktop Firefox'] } },
37-
{ name: 'webkit', use: { ...devices['Desktop Safari'] } },
36+
{
37+
name: 'chromium',
38+
use: { ...devices['Desktop Chrome'] },
39+
},
40+
41+
{
42+
name: 'webkit',
43+
use: { ...devices['Desktop Safari'] },
44+
},
45+
46+
//
47+
// Firefox tests are disabled, hopefully temporarily. For some reason they only work when
48+
// running tests locally on macOS, but they get stuck without failing or passing when
49+
// running locally on Windows, or when tests are run on CI.
50+
//
51+
// { name: 'firefox', use: { ...devices['Desktop Firefox'] } },
3852
],
3953
}
4054

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"extends": "@doist/tsconfig",
3-
"include": ["src", "types", "*.config.ts", "playwright"],
3+
"include": ["src", "types"],
44
"compilerOptions": {
55
"allowJs": true,
66
"module": "esnext",
77
"lib": ["dom", "esnext"],
88
"importHelpers": true,
99
"declaration": true,
1010
"sourceMap": true,
11-
"rootDir": "./",
11+
"rootDir": "src",
1212
"noUnusedLocals": true,
1313
"noUnusedParameters": true,
1414
"moduleResolution": "node",

0 commit comments

Comments
 (0)