mirror of
https://github.com/FuelLabs/sway.git
synced 2025-08-10 05:39:05 +00:00

## Description
closes #5136.
We build contract projects twice, once without tests to get contract
bytecode for forc-test's deployment step. (Since contract project's unit
tests needs to make contract calls, we need the contract deployed to
local vm instance.) And once with the tests included if the user
executes `forc test`. This is only needed for contract projects as we
only need to deploy them for testing.
Module cache addition in 255350ec50
only
takes path into account for key. But same source file with and without
tests enabled creates different AST's and thus we should also take
`include_tests` variable into account.
We were missing contract tests because we could not build them with
tests. 1st run were building them correctly without the tests and
populated the cache, only taking `Path` into account. Second time,
although we passed `include_tests = true`, (thus the resulting AST is
going to be different for the same file) rather than creating the AST
with the tests, we were using the cached version. This was causing
contract's to lose tests entries.
8 lines
172 B
TOML
8 lines
172 B
TOML
[project]
|
|
authors = ["Fuel Labs <contact@fuel.sh>"]
|
|
entry = "main.sw"
|
|
license = "Apache-2.0"
|
|
name = "test_script"
|
|
|
|
[dependencies]
|
|
std = { path = "../../../sway-lib-std/" }
|