GithubHelp home page GithubHelp logo

Comments (9)

lgalabru avatar lgalabru commented on May 13, 2024 1

I think that an accurate version to test this would be with something like this:

$ clarinet test
$ echo $?

from clarinet.

whoabuddy avatar whoabuddy commented on May 13, 2024

Here is an example where we included clarinet check as a step before clarinet test and both succeeded when they shouldn't have:

https://github.com/citycoins/citycoin/runs/2786873970?check_suite_focus=true

from clarinet.

LNow avatar LNow commented on May 13, 2024

Unfortunately #34 is not fixed.

Executing following commands should results with upss printed to the screen when we test invalid contract, yet in both cases all we see is output from clarinet.

$ clarinet check || echo 'upss'
$ clarinet test || echo 'upss'

I'm using last version available in crates.io.

[lnow@localhost citycoin]$ cargo install clarinet
    Updating crates.io index
     Ignored package `clarinet v0.10.0` is already installed, use --force to override

from clarinet.

whoabuddy avatar whoabuddy commented on May 13, 2024

Trying that locally leads to the same result, exit code is 0.

$ clarinet check
Analysis error: use of unresolved variable 'this-will-cause-an-error'
;; CityCoins on Stacks, simulating PoX in a smart contract
this-will-cause-an-error
;; error codes
(define-constant ERR-NO-WINNER u0)
(define-constant ERR-NO-SUCH-MINER u1)
(define-constant ERR-IMMATURE-TOKEN-REWARD u2)
(define-constant ERR-UNAUTHORIZED u3)
...(output truncated)...
$ echo $?
0

The same goes for clarinet test:

$ clarinet test
Analysis error: use of unresolved variable 'this-will-cause-an-error'
;; CityCoins on Stacks, simulating PoX in a smart contract
this-will-cause-an-error
;; error codes
(define-constant ERR-NO-WINNER u0)
(define-constant ERR-NO-SUCH-MINER u1)
(define-constant ERR-IMMATURE-TOKEN-REWARD u2)
(define-constant ERR-UNAUTHORIZED u3)
...(output truncated)...
$ echo $?
0

Now if I change the contract code so that its valid, but instead fail a test in our sequence, the exit code is updated as expected.

$ clarinet test
running 100 tests
test [CityCoin] SIP-010: transfer() succeeds with no memo supplied ... FAILED (440ms)

failures:

[CityCoin] SIP-010: transfer() succeeds with no memo supplied
Error: Expected ok, got (err u1)
    at consume (https://deno.land/x/[email protected]/index.ts:366:11)
    at String.expectOk (https://deno.land/x/[email protected]/index.ts:379:10)
    at file:///home/whoabuddy/citycoin/tests/citycoin_test.ts:85:34
    at fn (https://deno.land/x/[email protected]/test_suite.ts:457:17)
    at async Object.exitSanitizer [as fn] (deno:deno_runtime-0.9.3/js/40_testing.js:101:9)
    at async TestRunner.[Symbol.asyncIterator] (deno:deno_runtime-0.9.3/js/40_testing.js:275:13)
    at async Object.runTests (deno:deno_runtime-0.9.3/js/40_testing.js:352:22)
    at async file:///home/whoabuddy/citycoin/$deno$test.ts:3:1

failures:

        [CityCoin] SIP-010: transfer() succeeds with no memo supplied

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out (440ms)
$ echo $?
1

from clarinet.

lgalabru avatar lgalabru commented on May 13, 2024

Should be addressed with latest, can you close this issue once confirmed on your end? Thanks!

from clarinet.

lgalabru avatar lgalabru commented on May 13, 2024

(will update here once the docker image has been updated)

from clarinet.

whoabuddy avatar whoabuddy commented on May 13, 2024

I'm still seeing this issue with version clarinet v0.10.0, where invalid code doesn't change the exit code for clarinet check or clarinet test.

from clarinet.

whoabuddy avatar whoabuddy commented on May 13, 2024

Confirming this is working correctly in clarinet 0.13.0, for both clarinet check and clarinet test - thank you!

from clarinet.

lgalabru avatar lgalabru commented on May 13, 2024

Thanks @whoabuddy!

from clarinet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.