Migrate from truffle to test-environment (#2007)

* Sketch

* Migrate all tests to test-env

* Finish migration to test-env

* Add config

* Work on GSN tests

* Migrate to newer test-env version and loader syntax

* Add GSN setup

* Finish test-env migration

* Setup coverage using test-env

* Migrate to npm package

* Fix package.json

* Add compile step to CI

* Add comment on coverage setup

* Remove dependency on @truffle/contract

* Fix package-lock merge

* Fix linter errors

* Upgrade test-environment, depend locally on ganche-coverage

* Improve coverage script

* Improve sign.js API

* Move accounts destructuring to describe block

* Switch to prebuilt ethereumjs-vm package

* Upgrade test-enviroment version

* use workspace in circleci config

* remove unnecessary npx
This commit is contained in:
Nicolás Venturo
2019-11-28 15:46:42 -03:00
committed by Francisco Giordano
parent ca6a5dc8a2
commit 5f92adc2e7
87 changed files with 23947 additions and 890 deletions

View File

@ -1,6 +1,8 @@
const { contract } = require('@openzeppelin/test-environment');
const { BN, expectEvent } = require('@openzeppelin/test-helpers');
const ContextMock = artifacts.require('ContextMock');
const ContextMock = contract.fromArtifact('ContextMock');
function shouldBehaveLikeRegularContext (sender) {
describe('msgSender', function () {

View File

@ -1,11 +1,15 @@
const { accounts, contract } = require('@openzeppelin/test-environment');
require('@openzeppelin/test-helpers');
const ContextMock = artifacts.require('ContextMock');
const ContextMockCaller = artifacts.require('ContextMockCaller');
const ContextMock = contract.fromArtifact('ContextMock');
const ContextMockCaller = contract.fromArtifact('ContextMockCaller');
const { shouldBehaveLikeRegularContext } = require('./Context.behavior');
contract('Context', function ([_, sender]) {
describe('Context', function () {
const [ sender ] = accounts;
beforeEach(async function () {
this.context = await ContextMock.new();
this.caller = await ContextMockCaller.new();

View File

@ -1,12 +1,16 @@
const { accounts, contract, web3 } = require('@openzeppelin/test-environment');
const { constants, expectEvent } = require('@openzeppelin/test-helpers');
const { ZERO_ADDRESS } = constants;
const gsn = require('@openzeppelin/gsn-helpers');
const { fixSignature } = require('../helpers/sign');
const { utils: { toBN } } = require('web3');
const ERC721GSNRecipientMock = artifacts.require('ERC721GSNRecipientMock');
const ERC721GSNRecipientMock = contract.fromArtifact('ERC721GSNRecipientMock');
describe('ERC721GSNRecipient (integration)', function () {
const [ signer, sender ] = accounts;
contract('ERC721GSNRecipient (integration)', function ([_, signer, sender]) {
const tokenId = '42';
beforeEach(async function () {

View File

@ -1,3 +1,5 @@
const { accounts, contract, web3 } = require('@openzeppelin/test-environment');
const { balance, BN, constants, ether, expectEvent, expectRevert } = require('@openzeppelin/test-helpers');
const { ZERO_ADDRESS } = constants;
@ -5,12 +7,14 @@ const gsn = require('@openzeppelin/gsn-helpers');
const { expect } = require('chai');
const GSNRecipientMock = artifacts.require('GSNRecipientMock');
const ContextMockCaller = artifacts.require('ContextMockCaller');
const GSNRecipientMock = contract.fromArtifact('GSNRecipientMock');
const ContextMockCaller = contract.fromArtifact('ContextMockCaller');
const { shouldBehaveLikeRegularContext } = require('./Context.behavior');
contract('GSNRecipient', function ([_, payee, sender, newRelayHub]) {
describe('GSNRecipient', function () {
const [ payee, sender, newRelayHub ] = accounts;
beforeEach(async function () {
this.recipient = await GSNRecipientMock.new();
});

View File

@ -1,13 +1,17 @@
const { accounts, contract, web3 } = require('@openzeppelin/test-environment');
const { ether, expectEvent } = require('@openzeppelin/test-helpers');
const gsn = require('@openzeppelin/gsn-helpers');
const { expect } = require('chai');
const GSNRecipientERC20FeeMock = artifacts.require('GSNRecipientERC20FeeMock');
const ERC20Detailed = artifacts.require('ERC20Detailed');
const IRelayHub = artifacts.require('IRelayHub');
const GSNRecipientERC20FeeMock = contract.fromArtifact('GSNRecipientERC20FeeMock');
const ERC20Detailed = contract.fromArtifact('ERC20Detailed');
const IRelayHub = contract.fromArtifact('IRelayHub');
describe('GSNRecipientERC20Fee', function () {
const [ sender ] = accounts;
contract('GSNRecipientERC20Fee', function ([_, sender, other]) {
const name = 'FeeToken';
const symbol = 'FTKN';

View File

@ -1,12 +1,16 @@
const { accounts, contract, web3 } = require('@openzeppelin/test-environment');
const { expectEvent, expectRevert, constants } = require('@openzeppelin/test-helpers');
const gsn = require('@openzeppelin/gsn-helpers');
const { fixSignature } = require('../helpers/sign');
const { utils: { toBN } } = require('web3');
const { ZERO_ADDRESS } = constants;
const GSNRecipientSignatureMock = artifacts.require('GSNRecipientSignatureMock');
const GSNRecipientSignatureMock = contract.fromArtifact('GSNRecipientSignatureMock');
describe('GSNRecipientSignature', function () {
const [ signer, other ] = accounts;
contract('GSNRecipientSignature', function ([_, signer, other]) {
beforeEach(async function () {
this.recipient = await GSNRecipientSignatureMock.new(signer);
});