Makes sure code quality stays high by checking that code is linted & formatted in CI. ### Reason Frustration — so that [things like this](https://github.com/webrecorder/browsertrix-cloud/pull/1500#issuecomment-1920087667) don't happen in the future. I tried to merge `main` into a branch to get it up to date with main, and main isn't totally formatted or linted properly, and then formatting the codebase introduced a whole bunch of unrelated changes. Running a formatter or linter shouldn't cause unrelated code changes, and `main` should always be in a correct state in terms of linting and formatting. ### Testing - [x] Test run with failing lint checks errors: https://github.com/webrecorder/browsertrix-cloud/actions/runs/7733354321/job/21085236200 - [x] Test run with failing formatting check errors: https://github.com/webrecorder/browsertrix-cloud/actions/runs/7733501666/job/21085717519 - [x] Test run with both passing lint & formatting checks passes: https://github.com/webrecorder/browsertrix-cloud/actions/runs/7733529142/job/21085796727
53 lines
1.1 KiB
Markdown
53 lines
1.1 KiB
Markdown
# Running Tests Locally
|
|
|
|
This guide will show you how to run tests locally for a frontend application using `yarn start` and `npx playwright test`.
|
|
|
|
## Prerequisites
|
|
|
|
Before getting started, you should have the following installed on your computer:
|
|
|
|
- Node.js
|
|
- Yarn
|
|
|
|
## Step 1: Clone the repository
|
|
|
|
Begin by cloning the repository to your local machine.
|
|
|
|
`git clone git@github.com:webrecorder/browsertrix-cloud.git`
|
|
|
|
## Step 2: Change directory to frontend
|
|
|
|
Navigate to the frontend directory:
|
|
|
|
`cd frontend`
|
|
|
|
## Step 3: Install dependencies
|
|
|
|
Install the project's dependencies:
|
|
|
|
`yarn install`
|
|
|
|
## Step 4: Add `.env`
|
|
|
|
Add a `.env` file by copying the sample:
|
|
|
|
`cp sample.env.local .env`
|
|
|
|
## Step 5: Start the application
|
|
|
|
Start the application:
|
|
|
|
`yarn start`
|
|
|
|
This will open the application in your browser at `http://localhost:5173`.
|
|
|
|
## Step 5: Open a new terminal tab
|
|
|
|
Open a new terminal tab so that the first one continues to run the application.
|
|
|
|
## Step 6: Run tests
|
|
|
|
Run the tests in the new terminal tab using `npx playwright test`.
|
|
|
|
This will run the tests and output the results in the terminal.
|