Skip to content

Commit

Permalink
chore: prepare 2.0.0 (#1228)
Browse files Browse the repository at this point in the history
* chore: release 2.0.0

* docs: cleanup some deno docs

* chore: update changelog
  • Loading branch information
hugocaillard authored Oct 31, 2023
1 parent 2b38545 commit 625e6e0
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 139 deletions.
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
#### [2.0.0](https://github.com/hirosystems/clarinet/compare/v1.8.0...v2.0.0) (2023-10-26)

##### New Features

* Introduce global ~/.clarinet/clarinetrc.toml (#1208) (bbe26ccf)
* Update clarinet generated template to use the sdk (#1209) (27f9bce0)
* Create clarinet-sdk testing boilerplate (#1158) (6f2e990d)
* Deployment apply -use-on-disk-deployment-plan (2cba2335)
* Allow stacks-network to be run as standalone chain coordinator (#1064) (55b03bbb)

##### Bug Fixes

* Detect trait dependencies in composite types (#1236) (2b385454)
* Detect dependencies defined in const (#1205) (6e8b69ab)
* Replace . with _ for contract names (#1202) (165bfb93)
* Avoid pulling undesired dependencies in stacks-rpc crate (#1115) (17d20584)
* Project manifest (de)serialization tag (#1150) (ce0881c9)
* Clarinet-deployments wasm build (#1144) (1ab57028)
* Command splits once and picks everything after as the expression to get costs from (#1112) (6b35ed75)

##### Refactors

* Clippy (#1223) (faa5a3eb)

##### Chores

* Use clarinet sdk in examples (#1204) (f88be03c)
* Remove deno (#1186) (dd905708)
* Update service names for k8s devnet assets (#1161) (e03b9416)

##### Documentation Changes

* Udpate hints (#1227) (763b4b64)
* Deprecation warnings for clarinet test and clarinet run (#1157) (edf98aa3)

#### [1.8.0](https://github.com/hirosystems/clarinet/compare/v1.7.1...v1.8.0) (2023-09-12)

##### Continuous Integration
Expand Down
26 changes: 13 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 1 addition & 52 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,59 +348,8 @@ This annotation tells the check-checker to consider the specified variables to b

### Execute a test suite

> Warning: `clarinet test` will soon be deprecated in favor of a new way of testing smart contracts. The new documentation is under construction. In the meantime, learn more [in the clarinet-sdk Readme](https://github.com/hirosystems/clarinet/blob/01da3550670f321a2f19fd3b0f8df0fb4b769b08/components/clarinet-sdk/README.md).
> Warning: `clarinet test` has been be deprecated in Clarinet 2 in favor of a new way of testing smart contracts Learn more in the [announcement blog post](https://www.hiro.so/blog/announcing-the-clarinet-sdk-a-javascript-programming-model-for-easy-smart-contract-testing) or [in the clarinet-sdk Readme](https://github.com/hirosystems/clarinet/blob/01da3550670f321a2f19fd3b0f8df0fb4b769b08/components/clarinet-sdk/README.md).
Clarinet provides a testing harness based on Deno that can enable you to create automated unit tests or pseudo-integration tests using Typescript.

```bash
clarinet test
```

For more information on how to create unit tests using Typescript, see the [Writing Unit Tests Using Typescript](https://www.youtube.com/watch?v=Z4YEHUxHWuE&list=PL5Ujm489LoJaAz9kUJm8lYUWdGJ2AnQTb&index=7) YouTube video.

When you use the `clarinet contract new foo` command to create a new contract, Clarinet will automatically create a unit test file for this new contract, `tests/foo_test.ts`. Other files under the `tests/_ directory` following the Deno test naming convention will also be included:

- named test.{ts, tsx, mts, js, mjs, jsx, cjs, cts},
- or ending with .test.{ts, tsx, mts, js, mjs, jsx, cjs, cts},
- or ending with \_test.{ts, tsx, mts, js, mjs, jsx, cjs, cts}

Within these tests, you can simulate mining a block containing transactions using your contract, and then examine the results of those transactions as well as the events generated by them.

See the [billboard example](examples/billboard/tests/billboard_test.ts) for sample unit tests.

**Note:** If you see an error in VS Code on the imports in the generated test file(s), that says, "An import path cannot end with a '.ts' extension" (an example is shown below), installing the [Deno extension](https://marketplace.visualstudio.com/items?itemName=denoland.vscode-deno) will resolve this error.

![VS Code deno error](docs/images/deno-error.png)

#### Measure and increase code coverage

To help maximize a smart contract's test coverage, Clarinet can produce a `lcov` report, using the following option:

```bash
clarinet test --coverage
```

From there, you can use the `lcov` tooling suite to produce HTML reports:

```bash
brew install lcov
genhtml --branch-coverage -o coverage coverage.lcov
open coverage/index.html
```

![lcov](docs/images/lcov.png)

### Cost optimizations

Clarinet can also be used to optimize costs. When executing a test suite, Clarinet will keep track of all the costs being computed when executing the `contract-call`, and display the most expensive ones in a table:

```bash
clarinet test --costs
```

The `--costs` option can be used in conjunction with `--watch` and filters to maximize productivity, as illustrated here:

![costs](docs/images/costs.gif)

### Load contracts in a console

Expand Down
2 changes: 1 addition & 1 deletion components/clarinet-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clarinet-cli"
version = "1.8.0"
version = "2.0.0"
authors = ["Ludo Galabru <[email protected]>", "Brice Dobry <[email protected]>"]
edition = "2021"
description = "Clarinet is a simple, modern and opinionated runtime for testing, integrating and deploying Clarity smart contracts."
Expand Down
3 changes: 0 additions & 3 deletions components/clarinet-cli/examples/.vscode/settings.json

This file was deleted.

63 changes: 0 additions & 63 deletions components/clarinet-cli/examples/counter/tests/counter_test.ts

This file was deleted.

5 changes: 3 additions & 2 deletions components/clarinet-files/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ serde = "1"
serde_derive = "1"
chainhook-types = "=1.1.0"
# chainhook-types = { version = "=1.1.0", path = "../../../chainhook/components/chainhook-types-rs" }
clarinet-utils = { version = "1", path = "../clarinet-utils" }
clarity-repl = { version = "1", path = "../clarity-repl", default-features = false, optional = true }
bip39 = { version = "1.0.1", default-features = false }
libsecp256k1 = "0.7.0"
toml = { version = "0.5.6", features = ["preserve_order"] }
url = { version = "2.2.2", features = ["serde"] }
tiny-hderive = "0.3.0"
bitcoin = { version = "0.29.2", optional = true }

clarinet-utils = { version = "1", path = "../clarinet-utils" }
clarity-repl = { version = "2", path = "../clarity-repl", default-features = false, optional = true }

# wasm
js-sys = { version = "0.3", optional = true }
serde-wasm-bindgen = { version = "0.6.0", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion components/clarity-repl/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clarity-repl"
version = "1.8.0"
version = "2.0.0"
description = "Clarity REPL"
authors = [
"Ludo Galabru <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion components/stacks-devnet-js/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "stacks-devnet-js"
version = "1.8.0"
version = "2.0.0"
license = "ISC"
edition = "2018"
exclude = ["index.node"]
Expand Down
2 changes: 1 addition & 1 deletion components/stacks-devnet-js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hirosystems/stacks-devnet-js",
"version": "1.8.0",
"version": "2.0.0",
"description": "stacks-devnet-js is a library for writing end to end tests for protocols interacting with the Stacks blockchain and the Bitcoin blockchain.",
"author": "Ludo Galabru",
"repository": "https://github.com/hirosystems/clarinet/tree/main/components/stacks-devnet-js",
Expand Down
2 changes: 1 addition & 1 deletion components/stacks-network/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "stacks-network"
version = "1.8.0"
version = "2.0.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
5 changes: 4 additions & 1 deletion components/stacks-rpc-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ edition = "2021"
serde = "1"
serde_json = "1"
serde_derive = "1"
clarity_repl = { version = "1", package = "clarity-repl", path = "../clarity-repl", default-features = false, features = ["sdk"] }
reqwest = { version = "0.11", default-features = false, features = [
"blocking",
"json",
Expand All @@ -20,3 +19,7 @@ pbkdf2 = { version = "0.11.0", features = ["simple"], default-features = false }
sha2 = "0.10.0"
tiny-hderive = { version = "0.3.0" }
libsecp256k1 = { version = "0.7.0" }

clarity_repl = { version = "2", package = "clarity-repl", path = "../clarity-repl", default-features = false, features = [
"sdk",
] }

0 comments on commit 625e6e0

Please sign in to comment.