Skip to content

Commit

Permalink
Update Running Tests docs section
Browse files Browse the repository at this point in the history
commit-id:9e36d3c9

Update docs (to rebase)
  • Loading branch information
tomek0123456789 committed Apr 19, 2024
1 parent 05cb474 commit aeee35d
Showing 1 changed file with 41 additions and 20 deletions.
61 changes: 41 additions & 20 deletions docs/src/development/environment-setup.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
# Environment Setup
> 💡 **Info**
>
> This tutorial is only relevant if you wish to contribute to Starknet Foundry.
> If you plan to only use it as a tool for your project, you can skip this part.

## Prerequisites

### Rust

Install the latest stable [Rust](https://www.rust-lang.org/tools/install) version.
If you already have Rust installed make sure to upgrade it by running
If you already have Rust installed make sure to upgrade it by running:

```shell
$ rustup update
```

### Scarb
You can read more about installing Scarb [here](https://docs.swmansion.com/scarb/download.html)

### Scarb
You can read more about installing Scarb [here](https://docs.swmansion.com/scarb/download.html).
Please make sure you're using Scarb installed via [asdf](https://asdf-vm.com/) - otherwise some tests may fail.
> To verify, run:
>
Expand All @@ -27,21 +29,16 @@ Please make sure you're using Scarb installed via [asdf](https://asdf-vm.com/) -
> ```shell
> $HOME/.asdf/shims/scarb
> ```
>
> If you previously installed scarb using official installer, you may need to remove this installation or modify your PATH to make sure asdf installed one is always used.
> ❗️ **Warning**
>
> If you haven't pushed your branch to the remote yet (you've been working only locally), two tests will fail:
>
> - `e2e::running::init_new_project_test`
> - `e2e::running::simple_package_with_git_dependency`
> 💡 **Info**
>
> After pushing the branch to the remote, those tests should pass.
> If you previously installed Scarb using official installer, you may need to remove that installation or modify your `PATH`
> to make sure the version installed by asdf is always used.
### Starknet Devnet
To install it run `./scripts/install_devnet.sh`
Install it by running `./scripts/install_devnet.sh`
To run `sncast` tests, it is required to set `SEPOLIA_RPC_URL` environment variable, which is
used to fork the Sepolia testnet network in the devnet tests. This variable can be set in the `.env` file.
Expand All @@ -50,30 +47,54 @@ used to fork the Sepolia testnet network in the devnet tests. This variable can
Install the latest [universal-sierra-compiler](https://github.com/software-mansion/universal-sierra-compiler) version.
### Environmental variables
Set `NODE_URL` environmental variable to a Sepolia testnet node URL:
- either manually in your shell
```shell
$ export NODE_URL="https://example.com"
```
- or inside `.env` file
```
NODE_URL="https://example.com"
```
Additionally, if you want to run your tests on GitHub Actions, you need to
[set a secret variable](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository)
`NODE_URL` to the same value in your `starknet-foundry` fork repository
## Running Tests
Tests can be run with:
After performing these steps, you can run tests with:
```shell
$ cargo test
```
> ❗️ **Warning**
>
> If you haven't pushed your branch to the remote yet (you've been working only locally), two tests will fail:
>
> - `e2e::running::init_new_project_test`
> - `e2e::running::simple_package_with_git_dependency`
>
> After pushing the branch to the remote, those tests should pass.
## Formatting and Lints
Starknet Foundry uses [rustfmt](https://github.com/rust-lang/rustfmt) for formatting. You can run the formatter with
Starknet Foundry uses [rustfmt](https://github.com/rust-lang/rustfmt) for formatting. You can run the formatter with:
```shell
$ cargo fmt
```
For linting, it uses [clippy](https://github.com/rust-lang/rust-clippy). You can run it with this command:
For linting, it uses [clippy](https://github.com/rust-lang/rust-clippy). You can run it with:
```shell
$ cargo clippy --all-targets --all-features -- --no-deps -W clippy::pedantic -A clippy::missing_errors_doc -A clippy::missing_panics_doc -A clippy::default_trait_access
```
Or using our defined alias
or using our defined alias:
```shell
$ cargo lint
Expand All @@ -83,13 +104,13 @@ $ cargo lint
Starknet Foundry uses [typos](https://github.com/marketplace/actions/typos-action) for spelling checks.
You can run the checker with
You can run the checker with:
```shell
$ typos
```
Some typos can be automatically fixed by running
Some typos can be automatically fixed by running:
```shell
$ typos -w
Expand Down

0 comments on commit aeee35d

Please sign in to comment.