[Openzeppelin Test-Environment] setup ganache with a specific timestamp

I’m trying to test a time-based function and for the sake of making the tests more deterministic I want to force a specific timestamp for the starting block of the ganache instance.

Theoretically, I should be able to do it as Ganache allows it - https://github.com/trufflesuite/ganache-cli#options-1

But for some reason I cannot manage to set it up using the test-environment.config.js file, is this option available from the test-environment side ?

i.e I want to do something like:

module.exports = {
    node: {
        time: date,
    },
};

An alternative would be using the time utilities from the test-helpers and setup a time in the future with time.increaseTo() but I would rather make it work this way tbh.

Thanks in advance.

2 Likes

Hi @Madness,

I don’t think this is currently possible in OpenZeppelin Test Environment.
This is the list of what is supported at the moment:
https://docs.openzeppelin.com/test-environment/0.1/getting-started#advanced-options

So as a work around you would need to look at using OpenZeppelin Test Helpers.

1 Like

Hey @Madness. Unfortunately not at that moment. I’ve created an issue about it.

2 Likes

@abcoathup @ylv-io Thank you both for the answers.

For future reference, would you guys rather have these type of questions as an issue in the conrresponding git repo ? Or is the forum the right place for this?

1 Like

Hi @madness,

Thanks for asking :pray:

My preference is the forum. It means more of the community can easily find the question/discussion to contribute (or to find in future).

If an Issue is needed on the repository then we can do it afterwards.

Wiil keep that in mind, thx !

1 Like