Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

3 changes: 1 addition & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"github.remotehub",
"circleci.circleci",
"stylelint.vscode-stylelint",
"Orta.vscode-jest",
"vitest.explorer",
"christian-kohler.path-intellisense",
"esbenp.prettier-vscode",
"avraammavridis.vsc-react-documentation",
Expand All @@ -65,7 +65,6 @@
],
"settings": {
"terminal.integrated.defaultProfile.linux": "zsh",
"jest.jestCommandLine": "yarn test",
"eslint.enable": true,
"eslint.validate": ["javascript", "javascriptreact"],
"stylelint.enable": true,
Expand Down
23 changes: 19 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
"root": true,
"extends": [
"react-app",
"react-app/jest",
"plugin:prettier/recommended"
],
"plugins": [
"prettier",
"react",
"jsx-a11y",
"jest"
"testing-library"
],
"settings": {
"react": {
Expand Down Expand Up @@ -54,16 +53,32 @@
},
{
"files": ["apps/scratch-frame/**/*.test.js", "apps/scratch-frame/**/*.test.jsx"],
"extends": ["plugin:testing-library/react"],
"globals": {
"vi": "readonly",
"test": "readonly",
"describe": "readonly"
"describe": "readonly",
"it": "readonly",
"expect": "readonly",
"beforeEach": "readonly",
"afterEach": "readonly",
"beforeAll": "readonly",
"afterAll": "readonly"
}
},
{
"files": ["src/**/__tests__/**/*.{js,jsx,ts,tsx}", "src/**/*.{spec,test}.{js,jsx,ts,tsx}"],
"extends": ["plugin:testing-library/react"],
"globals": {
"vi": "readonly"
"vi": "readonly",
"describe": "readonly",
"test": "readonly",
"it": "readonly",
"expect": "readonly",
"beforeEach": "readonly",
"afterEach": "readonly",
"beforeAll": "readonly",
"afterAll": "readonly"
}
}
]
Expand Down
12 changes: 1 addition & 11 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,10 @@ jobs:
run: yarn install --immutable

- name: Run tests
run: yarn run test --coverage --maxWorkers=4 --workerThreads=true --reporters=default --reporters=jest-junit --reporters=jest-github-actions-reporter
run: yarn test --run
env:
JEST_JUNIT_OUTPUT_DIR: ./coverage/
REACT_APP_API_ENDPOINT: http://localhost:3009
REACT_APP_SCRATCH_FRAME_URL: "http://scratch-frame.example.com"
- name: Run Vitest tests
run: yarn test:vitest
env:
REACT_APP_API_ENDPOINT: http://localhost:3009
REACT_APP_SCRATCH_FRAME_URL: "http://scratch-frame.example.com"
- name: Record coverage
run: ./.github/workflows/record_coverage
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Run Scratch Frame tests
run: yarn run test:scratch-frame

Expand Down
92 changes: 0 additions & 92 deletions .github/workflows/record_coverage

This file was deleted.

25 changes: 22 additions & 3 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
"version": "2.0.0",
"tasks": [
{
"label": "Test Current File (Jest)",
"label": "Test Current File (Vitest)",
"type": "shell",
"command": "yarn",
"args": [
"test",
"--runTestsByPath",
"--watchAll=false",
"--run",
"${file}"
],
"options": {
Expand All @@ -22,6 +21,26 @@
},
"problemMatcher": []
},
{
"label": "Test Current Line (Vitest)",
"type": "shell",
"command": "yarn",
"args": [
"test",
"--run",
"${file}:${lineNumber}"
],
"options": {
"cwd": "${workspaceFolder}"
},
"group": "test",
"presentation": {
"reveal": "always",
"panel": "dedicated",
"clear": true
},
"problemMatcher": []
},
{
"label": "Test Current File (Cypress Headless)",
"type": "shell",
Expand Down
11 changes: 4 additions & 7 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Project Overview
- Web component version of Raspberry Pi Code Editor, built with React and
Vite (migrated from an ejected-CRA webpack setup; the Jest test setup from
that era is unchanged, see Testing & CI below).
Vite (migrated from an ejected-CRA webpack setup).
- Primary entry is the web component bundle served by the dev server at
`http://localhost:3011`.
- Three Vite configs at the repo root, each producing one unhashed, classic
Expand All @@ -14,8 +13,7 @@
- `src/`: application code, redux, web component entrypoints.
- `public/`: static assets, Python/Skulpt libraries and shims.
- `cypress/`: end-to-end tests and fixtures.
- `config/`: Jest config and build helpers (CRA/webpack-era leftovers; not used
by the Vite build).
- `config/`: deploy helpers (e.g. `nginx.conf.erb`); not used by the Vite build.
- `.github/workflows/`: CI/CD and deploy pipelines.

## Quickstart Commands
Expand All @@ -38,8 +36,7 @@ yarn start
```
yarn install --immutable
yarn lint
yarn run test --coverage --maxWorkers=4 --workerThreads=true \
--reporters=default --reporters=jest-junit --reporters=jest-github-actions-reporter
yarn test --run
```
- Cypress in CI starts the app with `yarn start` and runs against
`http://localhost:3011` with `REACT_APP_API_ENDPOINT`, `PUBLIC_URL`,
Expand Down Expand Up @@ -93,7 +90,7 @@ yarn exec cypress open
Deploys are driven by `.github/workflows/deploy.yml`.

### Running tests
- Unit tests: `CI=true yarn test` (without `CI=true`, Jest enters interactive watch mode which hangs).
- Unit tests: `CI=true yarn test` (without `CI=true`, Vitest enters interactive watch mode which hangs).
- Lint: `yarn lint` (runs ESLint on `src/` and `cypress/`).
- Cypress e2e requires the dev server to be running first (`yarn start`).

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Getting Started

This project provides a web component containing the Raspberry Pi Code Editor for use on other sites. It was originally bootstrapped with [Create React App](https://github.com/facebook/create-react-app) and later ejected; the build now runs on [Vite](https://vite.dev) (see `vite.config.js`, `vite.html-renderer.config.js` and `vite.worker.config.js`), while tests still run on the Jest setup CRA generated.
This project provides a web component containing the Raspberry Pi Code Editor for use on other sites. It was originally bootstrapped with [Create React App](https://github.com/facebook/create-react-app) and later ejected; the build now runs on [Vite](https://vite.dev) (see `vite.config.js`, `vite.html-renderer.config.js` and `vite.worker.config.js`), and tests run on [Vitest](https://vitest.dev).

## Install dependencies

Expand Down Expand Up @@ -101,7 +101,7 @@ Note: Both eslint and stylelint are run as part of the CI pipeline.

## Testing

Automated unit tests can be run via the `yarn test` command. These unit tests are written using the JavaScript testing framework `Jest` and make use of the tools provided by the [React Testing Library](https://testing-library.com/docs/). Automated accessibility testing for components is available via the `jest-axe` library. This can be achieved using the `haveNoViolations` matcher provided by `jest-axe`, although this does not guarantee that the tested components have no accessibility issues.
Automated unit tests can be run via the `yarn test` command. These unit tests are written using the JavaScript testing framework [Vitest](https://vitest.dev) and make use of the tools provided by the [React Testing Library](https://testing-library.com/docs/). Automated accessibility testing for components is available via the `jest-axe` library. This can be achieved using the `haveNoViolations` matcher provided by `jest-axe`, although this does not guarantee that the tested components have no accessibility issues.

Integration testing is carried out via `cypress` and can be run using:

Expand Down
29 changes: 0 additions & 29 deletions config/jest/babelTransform.js

This file was deleted.

57 changes: 0 additions & 57 deletions jest.config.js

This file was deleted.

Loading
Loading