OpenZeppelin Test Environment global web3 not defined error

Hi @leckylao,

I wasn’t sure what you were trying to do here.

The GnosisSafe tests (at least general.js from utils) use web3 (being provided by Truffle).

I assume you would need to first convert the tests and the utility scripts to OpenZeppelin Test Environment. I was able to get the script running by starting this process.

general.js

I created a local copy of general.js and added in the require for OpenZeppelin Test Environment

// test/general.js
const { accounts, contract, web3 } = require('@openzeppelin/test-environment');

const util = require('util');
const solc = require('solc')
const lightwallet = require('eth-lightwallet')
const abi = require("ethereumjs-abi")

...

testGnosisSafeModule.js

I obtained web3 from OpenZeppelin Test Environment, used the local general.js and updated the fromArtifact to obtain the artifacts once I compiled them.

const { accounts, contract, web3 } = require('@openzeppelin/test-environment');
const [ owner ] = accounts;

describe('GnosisSafeModule', function () {
  const utils = require('./general.js');
  const GnosisSafe = contract.fromArtifact("GnosisSafe");
  const ProxyFactory = contract.fromArtifact("GnosisSafeProxyFactory");
  const GnosisSafeModule = contract.fromArtifact("GnosisSafeModule");
});