Skip to content

Commit b4a7a85

Browse files
committed
feat: fixes tests.yaml_final_final; Updates readme and contributing for testing changes
1 parent 38ef1d0 commit b4a7a85

3 files changed

Lines changed: 21 additions & 9 deletions

File tree

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
run: pnpm i
2828

2929
- name: Install Playwright Browsers
30-
run: pnpm exec playwright install chromium
30+
run: pnpm --filter tests exec playwright install chromium
3131

3232
- name: Build SolidStart
3333
run: pnpm --filter @solidjs/start build

CONTRIBUTING.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,23 @@ We recommend using the `create-solid` package with the **basic** setting.
5454

5555
You can also fork this repository and go to `apps/tests`.
5656
There we have an app with all default configurations and many routes.
57-
Create a new route, a Cypress assertion to it and open a PR with the failing test-case.
57+
Create a new route, a Vitest or Playwright assertion (as appropriate) to it and open a PR with the failing test-case.
5858

5959
Once the PR is there, **create an issue** and link the PR (mention the PR as you'd mention a person in the issue description and vice versa).
6060

61+
##### On testing
62+
63+
- If what you'd like to change needs e2e testing (i.e. you need a working build to test your feature), use playwright (see the `/app/tests/e2e` directory for examples).
64+
- If what you'd like to change is specific to a component, function (i.e. you need a unit test), use Vitest. You can find examples in the `/app/tests/` directory, look for the .tests.ts/.test.tsx files.
65+
- Note: Vitest is also set-up to test individual components - have a look at `/app/tests/routes/(basic).browser.test.tsx` for an example.
66+
67+
#### Testing conventions:
68+
69+
- For e2e test, simply place them in the `apps/tests/e2e` directory. The project is configured to run anything found in that directory via playwright as an e2e test.
70+
- For unit tests, co-locate them in the same place as the component or function they test:
71+
- E.g. If you're testing `/app/tests/MyComponent.tsx`, create a file named `/app/tests/MyComponent.test.browser.tsx` in the same directory. Note the `.browser` part - that's important to tell Vitest that this test should run in a browser environment.
72+
- For server-side unit tests, use the same placement conventions as described for components, but create a file named `/app/tests/myfeature.test.server.ts` in the same directory. Using `.server` in the filename tells Vitest that this test should run in a node environment.
73+
6174
> [!IMPORTANT]
6275
> Mark the **allow edit by the maintainers** so we can more easily investigate the failing test and propose a fix. Otherwise we may need to close your PR and cherry-pick your commit.
6376

README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ SolidStart is a pnpm-based monorepo with nested workspaces. Key directories incl
3131

3232
- **`packages/start`**: The core `@solidjs/start` package.
3333
- **`apps/landing-page`**: The official landing page.
34-
- **`apps/tests`**: Unit and end-to-end (E2E) tests using Vitest and Cypress.
34+
- **`apps/tests`**: Unit and end-to-end (E2E) tests using Vitest and Playwright.
3535
- **`apps/fixtures`**: Fixture projects for testing.
3636

3737
Use pnpm filters (e.g. `pnpm --filter @solidjs/start ...`) to target specific packages.
@@ -76,10 +76,10 @@ Then reinstall dependencies and rebuild.
7676

7777
End-to-end tests are located in `apps/tests` projects. For manual testing and development use the `apps/fixtures` apps, and finally, integration and unit tests live inside their respective packages.
7878

79-
1. Install the Cypress binary (required only once)
79+
1. Install the Chromium for Playwright binary (required only once)
8080

8181
```bash
82-
pnpm --filter tests exec cypress install
82+
pnpm --filter tests exec playwright install chromium
8383
```
8484

8585
2. For unit tests that check build artifacts, build the test app first
@@ -88,7 +88,7 @@ End-to-end tests are located in `apps/tests` projects. For manual testing and de
8888
pnpm --filter tests run build
8989
```
9090

91-
3. Run unit tests
91+
3. Run unit tests (puts vitest in watch mode)
9292

9393
```bash
9494
pnpm --filter tests run unit
@@ -100,11 +100,10 @@ End-to-end tests are located in `apps/tests` projects. For manual testing and de
100100
4. Run E2E tests
101101

102102
```bash
103-
pnpm --filter tests run tests:run
103+
pnpm --filter tests run e2e
104104
```
105105

106-
- Interactive mode: `pnpm --filter tests run tests:open`
107-
- With dev server: `pnpm --filter tests run tests`
106+
- UI mode: `pnpm --filter tests run e2e:ui`
108107

109108
5. Clean test artifacts
110109
```bash

0 commit comments

Comments
 (0)