Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests run twice if you change compiler version #1306

Closed
2 tasks done
leonardoalt opened this issue Apr 14, 2022 · 2 comments · Fixed by #1635
Closed
2 tasks done

Tests run twice if you change compiler version #1306

leonardoalt opened this issue Apr 14, 2022 · 2 comments · Fixed by #1635
Labels
C-forge Command: forge Cmd-forge-build Command: forge build Cmd-forge-test Command: forge test T-bug Type: bug

Comments

@leonardoalt
Copy link

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (e85435a 2022-04-14T00:06:25.800261822+00:00)

What command(s) is the bug in?

forge test

Operating System

Linux

Describe the bug

Steps:

  1. Run forge init

  2. Change the Solidity pragma version to >=0.8.10 in src/Contract.sol and src/test/Contract.t.sol

  3. Add solc = "0.8.10" to foundry.toml

  4. Run forge test -vvvv, you'll see

Running 1 test for src/test/Contract.t.sol:ContractTest
[PASS] testExample() (gas: 190)
Traces:
  [190] ContractTest::testExample() 
    └─ ← ()
  1. Replace the solc version in foundry.toml by solc = "0.8.13"

  2. Run forge test -vvvv, you'll now see

Running 1 test for src/test/Contract.t.sol:ContractTest
[PASS] testExample() (gas: 190)
Traces:
  [190] ContractTest::testExample() 
    └─ ← ()

Test result: ok. 1 passed; 0 failed; finished in 566.01µs

Running 1 test for src/test/Contract.t.sol:ContractTest
[PASS] testExample() (gas: 190)
Traces:
  [190] ContractTest::testExample() 
    └─ ← ()

So it looks like the tests are running twice, I think once with each compiler version from the two mentioned above. Not sure if this behavior is intended, but I'd guess not.

@leonardoalt leonardoalt added the T-bug Type: bug label Apr 14, 2022
@onbjerg onbjerg added Cmd-forge-test Command: forge test C-forge Command: forge Cmd-forge-build Command: forge build labels Apr 14, 2022
@onbjerg
Copy link
Member

onbjerg commented Apr 30, 2022

@mattsse Maybe this is because we have a cached version of the test file, and a new non-cached version of the test file and we see both and run both?

@mattsse
Copy link
Member

mattsse commented May 2, 2022

that could be it, working a repro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-forge Command: forge Cmd-forge-build Command: forge build Cmd-forge-test Command: forge test T-bug Type: bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants