Skip to content

Commit

Permalink
chore: updated rust test documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
nadr0 committed Sep 20, 2024
1 parent 5c433fe commit 285720a
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
38 changes: 36 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,13 +313,47 @@ For individual testing:
yarn test abstractSyntaxTree -t "unexpected closed curly brace" --silent=false
```

Which will run our suite of [Vitest unit](https://vitest.dev/) and [React Testing Library E2E](https://testing-library.com/docs/react-testing-library/intro/) tests, in interactive mode by default.
Which will run our suite of [Vitest unit](https://vitest.dev/) and [React Testing Library E2E](https://testing-library.com/docs/react-testing-library/intro/** tests, in interactive mode by default.

### Rust tests

**Dependencies**

- `KITTYCAD_API_TOKEN`
- `cargo-nextest`
- `just`

#### Setting KITTYCAD_API_TOKEN
Use the production zoo.dev token, set this environment variable before running the tests

#### Installing cargonextest

```
cd src/wasm-lib
cargo search cargo-nextest
cargo install cargo-nextest
```

#### just
install [`just`](https://github.com/casey/just?tab=readme-ov-file#pre-built-binaries)

#### Running the tests

```bash
# With just
# Make sure KITTYCAD_API_TOKEN=<prod zoo.dev token> is set
# Make sure you installed cargo-nextest
# Make sure you installed just
cd src/wasm-lib
just test
```

```bash
# Without just
# Make sure KITTYCAD_API_TOKEN=<prod zoo.dev token> is set
# Make sure you installed cargo-nextest
cd src/wasm-lib
cargo test
export RUST_BRACKTRACE="full" && cargo nextest run --workspace --test-threads=1
```

#### Some notes on CI
Expand Down
3 changes: 3 additions & 0 deletions src/wasm-lib/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ new-test name:

lint:
cargo clippy --all --tests --benches -- -D warnings

test:
export RUST_BRACKTRACE="full" && cargo nextest run --workspace --test-threads=1

0 comments on commit 285720a

Please sign in to comment.