3

devs. I am writing the e2e tests for my smart contracts using ink_e2e In contracts, I define the e2e-tests like this.

#[openbrush::contract]
pub mod controller {
    ...
    
    #[cfg(all(test, feature = "e2e-tests"))]
    mod e2e_tests {
    }
}

But I want to define tests like this.

#[cfg(all(test, feature = "e2e-tests"))]
mod e2e_tests {}

#[openbrush::contract]
pub mod controller {
    ...
}

In this case, I have noticed that e2e-tests feature is disabled. Anybody met this issue and solved it?

2
  • May be if you can follow this PR in order to resolve this.
    – go11li
    Commented Jun 30, 2023 at 8:03
  • Thanks for your comment. But It is still disabled. code is inactive due to #[cfg] directives: feature = "e2e-tests" is disabled
    – Wolf
    Commented Jun 30, 2023 at 14:03

1 Answer 1

0
#[cfg(all(test, feature = "e2e-tests"))]
mod e2e_tests {}

#[openbrush::contract]
pub mod controller {
    ...
}

This should work.

The tests should run with usual cargo test --features e2e-tests

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.