Skip to content
Merged
Changes from 6 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
13 changes: 12 additions & 1 deletion docs/DEV_ENVIRONMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
export BOB_PASSPHRASE="also shoot benefit prefer juice shell elder veteran woman mimic image kidney"
export ALICE_PASSPHRASE="spice describe gravity federal blast come thank unfair canal monkey style afraid"
```
6. Run WASM tests
5. Run WASM tests
- for Linux users:
```
wasm-pack test --firefox --headless mm2src/mm2_main
Expand All @@ -66,5 +66,16 @@
CC=/opt/homebrew/opt/llvm/bin/clang AR=/opt/homebrew/opt/llvm/bin/llvm-ar wasm-pack test --firefox --headless mm2src/mm2_main
```
Please note `CC` and `AR` must be specified in the same line as `wasm-pack test mm2src/mm2_main`.
#### Running WASM tests with Cargo</br>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To me, the way this looks feels too much like "you can run tests with cargo without needing to setup things above".

@borngraced borngraced Sep 10, 2023

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm, I think this is mostly useful when you want to run a single or some specific wasm tests alone. While the other tries to run all tests

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My concern is this title can lead to confusions. Different title("example of running single test") would be more appropriate I guess.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand, but keep in mind that the command can also be used to run the full test just like wasm-pack..hence why I used the title as it's not just limited to running single/some tests

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know but I don't think anyone will think cargo can only do single test. Command explicitly contains flags that everyone can understand. I want to avoid the confusion of "there is an alternative way of running wasm tests that don't require prequests mentioned above".

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok got it. amended now

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we run single test using wasm-pack? If we can, we should use wasm-pack for "example of running single test", and find better title for cargo one probably.

@borngraced borngraced Sep 10, 2023

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I understood that, thanks.
but personally, I'm not sure if wasm-pack can perform same action tho

- Install `wasm-bindgen-cli`: </br>
Make sure you have wasm-bindgen-cli installed with a version that matches the one specified in your Cargo.toml file.
You can install it using Cargo with the following command:
```
cargo install -f wasm-bindgen-cli --version <wasm-bindgen-version>
```
- Run
```
cargo test --target wasm32-unknown-unknown --package coins --lib utxo::utxo_block_header_storage::wasm::indexeddb_block_header_storage
```

PS If you notice that this guide is outdated, please submit a PR.