Hi everyone,
I'll ask my question here too, because it's related.
I have an upgradeable contract, and I want to test it using test-environment. My test looks like this
const { accounts, contract, web3 } = require("@openzeppelin/test-environment");
const { deployer, deployProxy } = require("@openzeppelin/truffle-upgrades");
const { expect } = require("chai");
require("chai").should();
const Contract = contract.fromArtifact("Executor");
let c: any = null
describe('contract', async () => {
beforeEach(async () => {
c = await deployProxy(Contract, {initializer: "__init_Executor" });
})
it("should execute contract", async () => {
//whatever
});
})
My package.json
{
"name": "te",
"version": "1.0.0",
"description": "",
"main": "index.ts",
"scripts": {
"test": "ts-mocha --exit --recursive test/**.test.ts"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@openzeppelin/contracts": "^3.3.0-solc-0.7",
"@openzeppelin/contracts-upgradeable": "^3.3.0",
"@openzeppelin/test-environment": "^0.1.9",
"@openzeppelin/truffle-upgrades": "^1.3.1",
"@truffle/hdwallet-provider": "^1.2.0",
"@types/chai": "^4.2.14",
"@types/mocha": "^8.2.0",
"chai": "^4.2.0",
"dotenv": "^8.2.0",
"mocha": "^8.2.1",
"solc": "^0.7.5",
"truffle": "^5.1.58",
"ts-mocha": "^8.0.0",
"ts-node": "^9.1.1",
"typescript": "^4.1.3"
}
}
Whatever I do, I also get this
Error: Global Truffle config not found: Truffle >=5.1.35 is required. Truffle exec not yet supported
I don't have truffle installed globally (only got npm and npx) and I have no idea what to do to make it work. Please help