Hey, I’m using the open zeppelin test helpers, and I’ve repeatedly noticed a very strange behavior, which is that my test file seems to magically add a require statement at the top of my file if I type some special things. Specifically, I’ve seen that I typed latestBlock
and then ran my tests, and boom! The top of my file then contained const { latestBlock } = require('@openzeppelin/test-helpers/src/time');
. I 100% absolutely no questions asked did not add this import. I’ve also seen this happen with web3
as well. I can’t replicate every time, but I can confirm this has happened multiple times. ie. I remove the import, run my tests, and the import statement comes back.
Anyone run into this or know what’s going on? It almost seems like some pre-processor (perhaps from Buidler or Truffle) is running that looks for keywords from my test files and automatically adds imports if it can. Which if so, is insane, and I at least want to know it’s happening, and probably turn it off somehow.
Environment
I’m using OpenZeppelin test helpers 0.5.6
, Open Zeppelin contracts 3.1.0
, Buidler 1.4.3
. Also buidler-truffle5
of 1.3.4
, and truffle-contract
4.2.1
. When I run my tests, I use npx buidler test --show-stack-traces
, through npm test
. This is all just on my local Macbook Pro, on Catalina 10.15.6
Details
Code to reproduce