From 13299158d1e22d1af1cd36434fc403a74743ecb1 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Sun, 4 Mar 2018 19:05:26 -0800 Subject: Add sol-cover implementation --- .../contracts/migrations/config/multisig_sample.ts | 10 +++ packages/contracts/migrations/config/token_info.ts | 40 ++++++++++ packages/contracts/migrations/index.ts | 20 +++++ packages/contracts/migrations/migrate.ts | 90 ++++++++++++++++++++++ packages/contracts/migrations/types.ts | 23 ++++++ packages/contracts/package.json | 10 ++- .../multisig/MultiSigWallet/MultiSigWallet.sol | 1 - packages/contracts/test/ether_token.ts | 5 +- packages/contracts/test/exchange/core.ts | 5 +- packages/contracts/test/exchange/helpers.ts | 5 +- packages/contracts/test/exchange/wrapper.ts | 5 +- packages/contracts/test/global_hooks.ts | 8 ++ .../contracts/test/multi_sig_with_time_lock.ts | 15 +--- ...i_sig_with_time_lock_except_remove_auth_addr.ts | 5 +- packages/contracts/test/token_registry.ts | 5 +- .../contracts/test/token_transfer_proxy/auth.ts | 5 +- .../test/token_transfer_proxy/transfer_from.ts | 5 +- packages/contracts/test/tutorials/arbitrage.ts | 5 +- .../contracts/test/unlimited_allowance_token.ts | 5 +- packages/contracts/test/utils/deployer.ts | 3 + packages/contracts/test/utils/web3_wrapper.ts | 5 ++ packages/contracts/test/zrx_token.ts | 5 +- 22 files changed, 233 insertions(+), 47 deletions(-) create mode 100644 packages/contracts/migrations/config/multisig_sample.ts create mode 100644 packages/contracts/migrations/config/token_info.ts create mode 100644 packages/contracts/migrations/index.ts create mode 100644 packages/contracts/migrations/migrate.ts create mode 100644 packages/contracts/migrations/types.ts create mode 100644 packages/contracts/test/global_hooks.ts create mode 100644 packages/contracts/test/utils/web3_wrapper.ts (limited to 'packages/contracts') diff --git a/packages/contracts/migrations/config/multisig_sample.ts b/packages/contracts/migrations/config/multisig_sample.ts new file mode 100644 index 000000000..bc2502fca --- /dev/null +++ b/packages/contracts/migrations/config/multisig_sample.ts @@ -0,0 +1,10 @@ +import { MultiSigConfigByNetwork } from '../types'; + +// Make a copy of this file named `multisig.js` and input custom params as needed +export const multiSig: MultiSigConfigByNetwork = { + kovan: { + owners: [], + confirmationsRequired: 0, + secondsRequired: 0, + }, +}; diff --git a/packages/contracts/migrations/config/token_info.ts b/packages/contracts/migrations/config/token_info.ts new file mode 100644 index 000000000..5fd3db144 --- /dev/null +++ b/packages/contracts/migrations/config/token_info.ts @@ -0,0 +1,40 @@ +import { constants } from '../../util/constants'; +import { Token } from '../types'; + +export const tokenInfo: Token[] = [ + { + name: 'Augur Reputation Token', + symbol: 'REP', + decimals: 18, + ipfsHash: constants.NULL_BYTES, + swarmHash: constants.NULL_BYTES, + }, + { + name: 'Digix DAO Token', + symbol: 'DGD', + decimals: 18, + ipfsHash: constants.NULL_BYTES, + swarmHash: constants.NULL_BYTES, + }, + { + name: 'Golem Network Token', + symbol: 'GNT', + decimals: 18, + ipfsHash: constants.NULL_BYTES, + swarmHash: constants.NULL_BYTES, + }, + { + name: 'MakerDAO', + symbol: 'MKR', + decimals: 18, + ipfsHash: constants.NULL_BYTES, + swarmHash: constants.NULL_BYTES, + }, + { + name: 'Melon Token', + symbol: 'MLN', + decimals: 18, + ipfsHash: constants.NULL_BYTES, + swarmHash: constants.NULL_BYTES, + }, +]; diff --git a/packages/contracts/migrations/index.ts b/packages/contracts/migrations/index.ts new file mode 100644 index 000000000..a44d011da --- /dev/null +++ b/packages/contracts/migrations/index.ts @@ -0,0 +1,20 @@ +import { Deployer } from '@0xproject/deployer'; +import { devConstants } from '@0xproject/dev-utils'; +import * as path from 'path'; + +import { constants } from '../util/constants'; + +import { runMigrationsAsync } from './migrate'; + +const deployerOpts = { + artifactsDir: path.resolve('src', 'artifacts'), + jsonrpcPort: devConstants.RPC_PORT, + networkId: constants.TESTRPC_NETWORK_ID, + defaults: { + gas: devConstants.GAS_ESTIMATE, + }, +}; + +export const deployer = new Deployer(deployerOpts); + +runMigrationsAsync(deployer).catch(console.log); diff --git a/packages/contracts/migrations/migrate.ts b/packages/contracts/migrations/migrate.ts new file mode 100644 index 000000000..d541c892e --- /dev/null +++ b/packages/contracts/migrations/migrate.ts @@ -0,0 +1,90 @@ +import { Deployer } from '@0xproject/deployer'; +import { BigNumber } from '@0xproject/utils'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import * as _ from 'lodash'; + +import { constants } from '../util/constants'; +import { ContractName } from '../util/types'; + +import { tokenInfo } from './config/token_info'; + +/** + * Custom migrations should be defined in this function. This will be called with the CLI 'migrate' command. + * Some operations might be completed in parallel, but we don't do that on purpose. + * That way the addresses are deterministic. + * @param deployer Deployer instance. + */ +export const runMigrationsAsync = async (deployer: Deployer) => { + const web3Wrapper: Web3Wrapper = deployer.web3Wrapper; + const accounts: string[] = await web3Wrapper.getAvailableAddressesAsync(); + + const tokenTransferProxy = await deployer.deployAndSaveAsync(ContractName.TokenTransferProxy); + const zrxToken = await deployer.deployAndSaveAsync(ContractName.ZRXToken); + const etherToken = await deployer.deployAndSaveAsync(ContractName.EtherToken); + const tokenReg = await deployer.deployAndSaveAsync(ContractName.TokenRegistry); + + const exchangeArgs = [zrxToken.address, tokenTransferProxy.address]; + const owners = [accounts[0], accounts[1]]; + const confirmationsRequired = new BigNumber(2); + const secondsRequired = new BigNumber(0); + const multiSigArgs = [owners, confirmationsRequired, secondsRequired, tokenTransferProxy.address]; + const exchange = await deployer.deployAndSaveAsync(ContractName.Exchange, exchangeArgs); + const multiSig = await deployer.deployAndSaveAsync( + ContractName.MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress, + multiSigArgs, + ); + + const owner = accounts[0]; + await tokenTransferProxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: owner }); + await tokenTransferProxy.transferOwnership.sendTransactionAsync(multiSig.address, { from: owner }); + const addTokenGasEstimate = await tokenReg.addToken.estimateGasAsync( + zrxToken.address, + tokenInfo[0].name, + tokenInfo[0].symbol, + tokenInfo[0].decimals, + tokenInfo[0].ipfsHash, + tokenInfo[0].swarmHash, + { from: owner }, + ); + await tokenReg.addToken.sendTransactionAsync( + zrxToken.address, + '0x Protocol Token', + 'ZRX', + 18, + constants.NULL_BYTES, + constants.NULL_BYTES, + { + from: owner, + gas: addTokenGasEstimate, + }, + ); + await tokenReg.addToken.sendTransactionAsync( + etherToken.address, + 'Ether Token', + 'WETH', + 18, + constants.NULL_BYTES, + constants.NULL_BYTES, + { + from: owner, + gas: addTokenGasEstimate, + }, + ); + for (const token of tokenInfo) { + const totalSupply = new BigNumber(0); + const args = [token.name, token.symbol, token.decimals, totalSupply]; + const dummyToken = await deployer.deployAsync(ContractName.DummyToken, args); + await tokenReg.addToken.sendTransactionAsync( + dummyToken.address, + token.name, + token.symbol, + token.decimals, + token.ipfsHash, + token.swarmHash, + { + from: owner, + gas: addTokenGasEstimate, + }, + ); + } +}; diff --git a/packages/contracts/migrations/types.ts b/packages/contracts/migrations/types.ts new file mode 100644 index 000000000..58d1e5b4f --- /dev/null +++ b/packages/contracts/migrations/types.ts @@ -0,0 +1,23 @@ +export interface MultiSigConfig { + owners: string[]; + confirmationsRequired: number; + secondsRequired: number; +} + +export interface MultiSigConfigByNetwork { + [networkName: string]: MultiSigConfig; +} + +export interface Token { + address?: string; + name: string; + symbol: string; + decimals: number; + ipfsHash: string; + swarmHash: string; +} + +export interface TokenInfoByNetwork { + development: Token[]; + live: Token[]; +} diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 3f7c70c02..7a75dd40a 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -13,13 +13,18 @@ "copy_artifacts": "copyfiles './src/artifacts/**/*' ./lib", "build": "tsc", "test": "run-s build run_mocha", - "run_mocha": "mocha 'lib/test/**/*.js' --timeout 10000 --bail --exit", + "test:coverage": "COVERAGE=true run-s build run_mocha coverage:report:text", + "run_mocha": "mocha 'lib/test/**/*.js' --timeout 10000000 --bail --exit", "compile:comment": "Yarn workspaces do not link binaries correctly so we need to reference them directly https://github.com/yarnpkg/yarn/issues/3846", "compile": "node ../deployer/lib/src/cli.js compile --contracts ${npm_package_config_contracts} --contracts-dir src/contracts --artifacts-dir src/artifacts", "clean": "shx rm -rf ./lib", "generate_contract_wrappers": "node ../abi-gen/lib/index.js --abis 'src/artifacts/@(DummyToken|TokenTransferProxy|Exchange|TokenRegistry|MultiSigWallet|MultiSigWalletWithTimeLock|MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress|TokenRegistry|ZRXToken|Arbitrage|EtherDelta|AccountLevels).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated --backend ethers && prettier --write 'src/contract_wrappers/generated/**.ts'", - "migrate": "node ../deployer/lib/src/cli.js migrate", + "migrate": "yarn build && yarn compile && node ./lib/migrations/index.js", "lint": "tslint --project . 'migrations/**/*.ts' 'test/**/*.ts' 'util/**/*.ts' 'deploy/**/*.ts'", + "coverage:report:text": "istanbul report text", + "coverage:report:html": "istanbul report html && open coverage/lcov-report/index.html", + "coverage:report:lcov": "istanbul report lcov", + "coverage:report:coveralls": "yarn coverage:report:lcov && cat coverage/lcov.info | coveralls", "test:circleci": "yarn test" }, "config": { @@ -49,6 +54,7 @@ "chai-bignumber": "^2.0.1", "chai-typescript-typings": "^0.0.4", "copyfiles": "^1.2.0", + "coveralls": "^3.0.0", "dirty-chai": "^2.0.1", "ethers-typescript-typings": "^0.0.2", "mocha": "^4.0.1", diff --git a/packages/contracts/src/contracts/current/multisig/MultiSigWallet/MultiSigWallet.sol b/packages/contracts/src/contracts/current/multisig/MultiSigWallet/MultiSigWallet.sol index 997bb86c0..79fd92029 100644 --- a/packages/contracts/src/contracts/current/multisig/MultiSigWallet/MultiSigWallet.sol +++ b/packages/contracts/src/contracts/current/multisig/MultiSigWallet/MultiSigWallet.sol @@ -363,4 +363,3 @@ contract MultiSigWallet { _transactionIds[i - from] = transactionIdsTemp[i]; } } - diff --git a/packages/contracts/test/ether_token.ts b/packages/contracts/test/ether_token.ts index 4c70534ee..6c7354c2b 100644 --- a/packages/contracts/test/ether_token.ts +++ b/packages/contracts/test/ether_token.ts @@ -9,12 +9,11 @@ import { ContractName } from '../util/types'; import { chaiSetup } from './utils/chai_setup'; import { deployer } from './utils/deployer'; +import { web3, web3Wrapper } from './utils/web3_wrapper'; chaiSetup.configure(); const expect = chai.expect; -const web3 = web3Factory.create(); -const web3Wrapper = new Web3Wrapper(web3.currentProvider); -const blockchainLifecycle = new BlockchainLifecycle(); +const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); describe('EtherToken', () => { let account: string; diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts index 710d6fe94..e276d11b3 100644 --- a/packages/contracts/test/exchange/core.ts +++ b/packages/contracts/test/exchange/core.ts @@ -22,12 +22,11 @@ import { OrderFactory } from '../../util/order_factory'; import { BalancesByOwner, ContractName, ExchangeContractErrs } from '../../util/types'; import { chaiSetup } from '../utils/chai_setup'; import { deployer } from '../utils/deployer'; +import { web3, web3Wrapper } from '../utils/web3_wrapper'; chaiSetup.configure(); const expect = chai.expect; -const web3 = web3Factory.create(); -const web3Wrapper = new Web3Wrapper(web3.currentProvider); -const blockchainLifecycle = new BlockchainLifecycle(); +const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); describe('Exchange', () => { let maker: string; diff --git a/packages/contracts/test/exchange/helpers.ts b/packages/contracts/test/exchange/helpers.ts index 625234729..080cbe5fd 100644 --- a/packages/contracts/test/exchange/helpers.ts +++ b/packages/contracts/test/exchange/helpers.ts @@ -17,13 +17,12 @@ import { OrderFactory } from '../../util/order_factory'; import { ContractName } from '../../util/types'; import { chaiSetup } from '../utils/chai_setup'; import { deployer } from '../utils/deployer'; +import { web3, web3Wrapper } from '../utils/web3_wrapper'; chaiSetup.configure(); const expect = chai.expect; -const web3 = web3Factory.create(); -const web3Wrapper = new Web3Wrapper(web3.currentProvider); -const blockchainLifecycle = new BlockchainLifecycle(); +const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); describe('Exchange', () => { let maker: string; diff --git a/packages/contracts/test/exchange/wrapper.ts b/packages/contracts/test/exchange/wrapper.ts index 239f13a4f..0d3e18711 100644 --- a/packages/contracts/test/exchange/wrapper.ts +++ b/packages/contracts/test/exchange/wrapper.ts @@ -22,12 +22,11 @@ import { OrderFactory } from '../../util/order_factory'; import { BalancesByOwner, ContractName } from '../../util/types'; import { chaiSetup } from '../utils/chai_setup'; import { deployer } from '../utils/deployer'; +import { web3, web3Wrapper } from '../utils/web3_wrapper'; chaiSetup.configure(); const expect = chai.expect; -const web3 = web3Factory.create(); -const web3Wrapper = new Web3Wrapper(web3.currentProvider); -const blockchainLifecycle = new BlockchainLifecycle(); +const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); describe('Exchange', () => { let maker: string; diff --git a/packages/contracts/test/global_hooks.ts b/packages/contracts/test/global_hooks.ts new file mode 100644 index 000000000..23a99b47c --- /dev/null +++ b/packages/contracts/test/global_hooks.ts @@ -0,0 +1,8 @@ +import { getCoverageSubprovider } from '@0xproject/dev-utils'; + +after('generate coverage report', async () => { + if (process.env.COVERAGE) { + const coverageSubprovider = getCoverageSubprovider(); + await coverageSubprovider.writeCoverageAsync(); + } +}); diff --git a/packages/contracts/test/multi_sig_with_time_lock.ts b/packages/contracts/test/multi_sig_with_time_lock.ts index a726814e4..d35efe9da 100644 --- a/packages/contracts/test/multi_sig_with_time_lock.ts +++ b/packages/contracts/test/multi_sig_with_time_lock.ts @@ -1,5 +1,5 @@ import { LogWithDecodedArgs, ZeroEx } from '0x.js'; -import { BlockchainLifecycle, RPC, web3Factory } from '@0xproject/dev-utils'; +import { BlockchainLifecycle, web3Factory } from '@0xproject/dev-utils'; import { AbiDecoder, BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; @@ -15,14 +15,12 @@ import { ContractName, SubmissionContractEventArgs } from '../util/types'; import { chaiSetup } from './utils/chai_setup'; import { deployer } from './utils/deployer'; +import { web3, web3Wrapper } from './utils/web3_wrapper'; const MULTI_SIG_ABI = artifacts.MultiSigWalletWithTimeLockArtifact.networks[constants.TESTRPC_NETWORK_ID].abi; chaiSetup.configure(); const expect = chai.expect; - -const web3 = web3Factory.create(); -const web3Wrapper = new Web3Wrapper(web3.currentProvider); -const blockchainLifecycle = new BlockchainLifecycle(); +const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); const zeroEx = new ZeroEx(web3.currentProvider, { networkId: constants.TESTRPC_NETWORK_ID }); const abiDecoder = new AbiDecoder([MULTI_SIG_ABI]); @@ -39,11 +37,6 @@ describe('MultiSigWalletWithTimeLock', () => { let multiSigWrapper: MultiSigWrapper; let txId: BigNumber; let initialSecondsTimeLocked: number; - let rpc: RPC; - - before(async () => { - rpc = new RPC(); - }); beforeEach(async () => { await blockchainLifecycle.startAsync(); }); @@ -192,7 +185,7 @@ describe('MultiSigWalletWithTimeLock', () => { }); it('should execute if it has enough confirmations and is past the time lock', async () => { - await rpc.increaseTimeAsync(SECONDS_TIME_LOCKED.toNumber()); + await web3Wrapper.increaseTimeAsync(SECONDS_TIME_LOCKED.toNumber()); await multiSig.executeTransaction.sendTransactionAsync(txId, { from: owners[0] }); const secondsTimeLocked = new BigNumber(await multiSig.secondsTimeLocked.callAsync()); diff --git a/packages/contracts/test/multi_sig_with_time_lock_except_remove_auth_addr.ts b/packages/contracts/test/multi_sig_with_time_lock_except_remove_auth_addr.ts index c0299e1e1..6d20a67f3 100644 --- a/packages/contracts/test/multi_sig_with_time_lock_except_remove_auth_addr.ts +++ b/packages/contracts/test/multi_sig_with_time_lock_except_remove_auth_addr.ts @@ -16,6 +16,7 @@ import { ContractName, SubmissionContractEventArgs, TransactionDataParams } from import { chaiSetup } from './utils/chai_setup'; import { deployer } from './utils/deployer'; +import { web3, web3Wrapper } from './utils/web3_wrapper'; const PROXY_ABI = artifacts.TokenTransferProxyArtifact.networks[constants.TESTRPC_NETWORK_ID].abi; const MUTISIG_WALLET_WITH_TIME_LOCK_EXCEPT_REMOVE_AUTHORIZED_ADDRESS_ABI = artifacts.MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddressArtifact.networks[constants.TESTRPC_NETWORK_ID] @@ -23,9 +24,7 @@ const MUTISIG_WALLET_WITH_TIME_LOCK_EXCEPT_REMOVE_AUTHORIZED_ADDRESS_ABI = chaiSetup.configure(); const expect = chai.expect; -const web3 = web3Factory.create(); -const web3Wrapper = new Web3Wrapper(web3.currentProvider); -const blockchainLifecycle = new BlockchainLifecycle(); +const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); const abiDecoder = new AbiDecoder([MUTISIG_WALLET_WITH_TIME_LOCK_EXCEPT_REMOVE_AUTHORIZED_ADDRESS_ABI]); describe('MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress', () => { diff --git a/packages/contracts/test/token_registry.ts b/packages/contracts/test/token_registry.ts index eee14ad9f..9dcc77b82 100644 --- a/packages/contracts/test/token_registry.ts +++ b/packages/contracts/test/token_registry.ts @@ -14,12 +14,11 @@ import { ContractName } from '../util/types'; import { chaiSetup } from './utils/chai_setup'; import { deployer } from './utils/deployer'; +import { web3, web3Wrapper } from './utils/web3_wrapper'; chaiSetup.configure(); const expect = chai.expect; -const web3 = web3Factory.create(); -const web3Wrapper = new Web3Wrapper(web3.currentProvider); -const blockchainLifecycle = new BlockchainLifecycle(); +const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); describe('TokenRegistry', () => { let owner: string; diff --git a/packages/contracts/test/token_transfer_proxy/auth.ts b/packages/contracts/test/token_transfer_proxy/auth.ts index 4f497dd0d..a1ccc6ff7 100644 --- a/packages/contracts/test/token_transfer_proxy/auth.ts +++ b/packages/contracts/test/token_transfer_proxy/auth.ts @@ -8,12 +8,11 @@ import { constants } from '../../util/constants'; import { ContractName } from '../../util/types'; import { chaiSetup } from '../utils/chai_setup'; import { deployer } from '../utils/deployer'; +import { web3, web3Wrapper } from '../utils/web3_wrapper'; chaiSetup.configure(); const expect = chai.expect; -const web3 = web3Factory.create(); -const web3Wrapper = new Web3Wrapper(web3.currentProvider); -const blockchainLifecycle = new BlockchainLifecycle(); +const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); describe('TokenTransferProxy', () => { let owner: string; diff --git a/packages/contracts/test/token_transfer_proxy/transfer_from.ts b/packages/contracts/test/token_transfer_proxy/transfer_from.ts index a77590288..415d068be 100644 --- a/packages/contracts/test/token_transfer_proxy/transfer_from.ts +++ b/packages/contracts/test/token_transfer_proxy/transfer_from.ts @@ -11,12 +11,11 @@ import { constants } from '../../util/constants'; import { ContractName } from '../../util/types'; import { chaiSetup } from '../utils/chai_setup'; import { deployer } from '../utils/deployer'; +import { web3, web3Wrapper } from '../utils/web3_wrapper'; chaiSetup.configure(); const expect = chai.expect; -const web3 = web3Factory.create(); -const web3Wrapper = new Web3Wrapper(web3.currentProvider); -const blockchainLifecycle = new BlockchainLifecycle(); +const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); describe('TokenTransferProxy', () => { let accounts: string[]; diff --git a/packages/contracts/test/tutorials/arbitrage.ts b/packages/contracts/test/tutorials/arbitrage.ts index 055fe9687..b2bbaf420 100644 --- a/packages/contracts/test/tutorials/arbitrage.ts +++ b/packages/contracts/test/tutorials/arbitrage.ts @@ -17,12 +17,11 @@ import { OrderFactory } from '../../util/order_factory'; import { BalancesByOwner, ContractName, ExchangeContractErrs } from '../../util/types'; import { chaiSetup } from '../utils/chai_setup'; import { deployer } from '../utils/deployer'; +import { web3, web3Wrapper } from '../utils/web3_wrapper'; chaiSetup.configure(); const expect = chai.expect; -const web3 = web3Factory.create(); -const web3Wrapper = new Web3Wrapper(web3.currentProvider); -const blockchainLifecycle = new BlockchainLifecycle(); +const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); describe('Arbitrage', () => { let coinbase: string; diff --git a/packages/contracts/test/unlimited_allowance_token.ts b/packages/contracts/test/unlimited_allowance_token.ts index 553178d80..c1c518adc 100644 --- a/packages/contracts/test/unlimited_allowance_token.ts +++ b/packages/contracts/test/unlimited_allowance_token.ts @@ -11,12 +11,11 @@ import { ContractName } from '../util/types'; import { chaiSetup } from './utils/chai_setup'; import { deployer } from './utils/deployer'; +import { web3, web3Wrapper } from './utils/web3_wrapper'; -const web3 = web3Factory.create(); -const web3Wrapper = new Web3Wrapper(web3.currentProvider); chaiSetup.configure(); const expect = chai.expect; -const blockchainLifecycle = new BlockchainLifecycle(); +const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); describe('UnlimitedAllowanceToken', () => { let owner: string; diff --git a/packages/contracts/test/utils/deployer.ts b/packages/contracts/test/utils/deployer.ts index 4e7f35c72..c1370f38c 100644 --- a/packages/contracts/test/utils/deployer.ts +++ b/packages/contracts/test/utils/deployer.ts @@ -4,7 +4,10 @@ import * as path from 'path'; import { constants } from '../../util/constants'; +import { web3 } from './web3_wrapper'; + const deployerOpts = { + web3Provider: web3.currentProvider, artifactsDir: path.resolve('src', 'artifacts'), jsonrpcPort: devConstants.RPC_PORT, networkId: constants.TESTRPC_NETWORK_ID, diff --git a/packages/contracts/test/utils/web3_wrapper.ts b/packages/contracts/test/utils/web3_wrapper.ts new file mode 100644 index 000000000..a8fe1532b --- /dev/null +++ b/packages/contracts/test/utils/web3_wrapper.ts @@ -0,0 +1,5 @@ +import { web3Factory } from '@0xproject/dev-utils'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; + +export const web3 = web3Factory.create(); +export const web3Wrapper = new Web3Wrapper(web3.currentProvider); diff --git a/packages/contracts/test/zrx_token.ts b/packages/contracts/test/zrx_token.ts index 4ccc66b36..a4cc3c2fc 100644 --- a/packages/contracts/test/zrx_token.ts +++ b/packages/contracts/test/zrx_token.ts @@ -11,12 +11,11 @@ import { ContractName } from '../util/types'; import { chaiSetup } from './utils/chai_setup'; import { deployer } from './utils/deployer'; +import { web3, web3Wrapper } from './utils/web3_wrapper'; chaiSetup.configure(); const expect = chai.expect; -const web3 = web3Factory.create(); -const web3Wrapper = new Web3Wrapper(web3.currentProvider); -const blockchainLifecycle = new BlockchainLifecycle(); +const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); describe('ZRXToken', () => { let owner: string; -- cgit v1.2.3 From 392fb42973de6a14892827b3b83e5bcf7bccf565 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 9 Mar 2018 14:34:17 +0100 Subject: Revert mocha timeout increase --- packages/contracts/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/contracts') diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 7a75dd40a..8f353d1a6 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -14,7 +14,7 @@ "build": "tsc", "test": "run-s build run_mocha", "test:coverage": "COVERAGE=true run-s build run_mocha coverage:report:text", - "run_mocha": "mocha 'lib/test/**/*.js' --timeout 10000000 --bail --exit", + "run_mocha": "mocha 'lib/test/**/*.js' --timeout 10000 --bail --exit", "compile:comment": "Yarn workspaces do not link binaries correctly so we need to reference them directly https://github.com/yarnpkg/yarn/issues/3846", "compile": "node ../deployer/lib/src/cli.js compile --contracts ${npm_package_config_contracts} --contracts-dir src/contracts --artifacts-dir src/artifacts", "clean": "shx rm -rf ./lib", -- cgit v1.2.3 From d991291f2af50f13110d487e1f354ff374cf7e00 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 9 Mar 2018 14:34:53 +0100 Subject: Use in-process Ganache in contracts --- packages/contracts/test/utils/web3_wrapper.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'packages/contracts') diff --git a/packages/contracts/test/utils/web3_wrapper.ts b/packages/contracts/test/utils/web3_wrapper.ts index a8fe1532b..74e56d502 100644 --- a/packages/contracts/test/utils/web3_wrapper.ts +++ b/packages/contracts/test/utils/web3_wrapper.ts @@ -1,5 +1,6 @@ import { web3Factory } from '@0xproject/dev-utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; -export const web3 = web3Factory.create(); +const web3ProviderConfig = { useInProcessGanache: true }; +export const web3 = web3Factory.create(web3ProviderConfig); export const web3Wrapper = new Web3Wrapper(web3.currentProvider); -- cgit v1.2.3 From 6eebf717d5f007d3e7193d6ec0116156da5eecaa Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 9 Mar 2018 15:14:01 +0100 Subject: Improve migrations comment --- packages/contracts/migrations/migrate.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'packages/contracts') diff --git a/packages/contracts/migrations/migrate.ts b/packages/contracts/migrations/migrate.ts index d541c892e..cff8af0ab 100644 --- a/packages/contracts/migrations/migrate.ts +++ b/packages/contracts/migrations/migrate.ts @@ -10,8 +10,8 @@ import { tokenInfo } from './config/token_info'; /** * Custom migrations should be defined in this function. This will be called with the CLI 'migrate' command. - * Some operations might be completed in parallel, but we don't do that on purpose. - * That way the addresses are deterministic. + * Migrations could be written to run in parallel, but if you want contract addresses to be created deterministically, + * the migration should be written to run synchronously. * @param deployer Deployer instance. */ export const runMigrationsAsync = async (deployer: Deployer) => { -- cgit v1.2.3 From 3b77e4ebf1d875ec1c1fdd91dec4e03e1ce5d391 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 9 Mar 2018 15:17:00 +0100 Subject: Rename getCoverageSubprovider to getCoverageSubproviderSingleton --- packages/contracts/test/global_hooks.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'packages/contracts') diff --git a/packages/contracts/test/global_hooks.ts b/packages/contracts/test/global_hooks.ts index 23a99b47c..670ac3bdf 100644 --- a/packages/contracts/test/global_hooks.ts +++ b/packages/contracts/test/global_hooks.ts @@ -1,8 +1,8 @@ -import { getCoverageSubprovider } from '@0xproject/dev-utils'; +import { getCoverageSubproviderSingleton } from '@0xproject/dev-utils'; after('generate coverage report', async () => { if (process.env.COVERAGE) { - const coverageSubprovider = getCoverageSubprovider(); + const coverageSubprovider = getCoverageSubproviderSingleton(); await coverageSubprovider.writeCoverageAsync(); } }); -- cgit v1.2.3 From c5afca53a4e94b51956f10f564c2e9db00012c8f Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 9 Mar 2018 15:39:50 +0100 Subject: Rename COVERAGE to SOLIDITY_COVERAGS --- packages/contracts/package.json | 2 +- packages/contracts/test/global_hooks.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'packages/contracts') diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 8f353d1a6..ba0b52e90 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -13,7 +13,7 @@ "copy_artifacts": "copyfiles './src/artifacts/**/*' ./lib", "build": "tsc", "test": "run-s build run_mocha", - "test:coverage": "COVERAGE=true run-s build run_mocha coverage:report:text", + "test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text", "run_mocha": "mocha 'lib/test/**/*.js' --timeout 10000 --bail --exit", "compile:comment": "Yarn workspaces do not link binaries correctly so we need to reference them directly https://github.com/yarnpkg/yarn/issues/3846", "compile": "node ../deployer/lib/src/cli.js compile --contracts ${npm_package_config_contracts} --contracts-dir src/contracts --artifacts-dir src/artifacts", diff --git a/packages/contracts/test/global_hooks.ts b/packages/contracts/test/global_hooks.ts index 670ac3bdf..b29e171d7 100644 --- a/packages/contracts/test/global_hooks.ts +++ b/packages/contracts/test/global_hooks.ts @@ -1,7 +1,7 @@ import { getCoverageSubproviderSingleton } from '@0xproject/dev-utils'; after('generate coverage report', async () => { - if (process.env.COVERAGE) { + if (process.env.SOLIDITY_COVERAGE) { const coverageSubprovider = getCoverageSubproviderSingleton(); await coverageSubprovider.writeCoverageAsync(); } -- cgit v1.2.3 From a9479b3c015961e93f396fb1e23dc61e261c6aef Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 9 Mar 2018 15:45:45 +0100 Subject: Make coverage a module instead of a function --- packages/contracts/test/global_hooks.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'packages/contracts') diff --git a/packages/contracts/test/global_hooks.ts b/packages/contracts/test/global_hooks.ts index b29e171d7..0440c871d 100644 --- a/packages/contracts/test/global_hooks.ts +++ b/packages/contracts/test/global_hooks.ts @@ -1,8 +1,8 @@ -import { getCoverageSubproviderSingleton } from '@0xproject/dev-utils'; +import { coverage } from '@0xproject/dev-utils'; after('generate coverage report', async () => { if (process.env.SOLIDITY_COVERAGE) { - const coverageSubprovider = getCoverageSubproviderSingleton(); + const coverageSubprovider = coverage.getCoverageSubproviderSingleton(); await coverageSubprovider.writeCoverageAsync(); } }); -- cgit v1.2.3 From 6c87ebac012953f214501e57f29318c03c174b3d Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 9 Mar 2018 15:46:34 +0100 Subject: Rename useInProcessGanache to shouldUseInProcessGanache --- packages/contracts/test/utils/web3_wrapper.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/contracts') diff --git a/packages/contracts/test/utils/web3_wrapper.ts b/packages/contracts/test/utils/web3_wrapper.ts index 74e56d502..35a8095a6 100644 --- a/packages/contracts/test/utils/web3_wrapper.ts +++ b/packages/contracts/test/utils/web3_wrapper.ts @@ -1,6 +1,6 @@ import { web3Factory } from '@0xproject/dev-utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; -const web3ProviderConfig = { useInProcessGanache: true }; +const web3ProviderConfig = { shouldUseInProcessGanache: true }; export const web3 = web3Factory.create(web3ProviderConfig); export const web3Wrapper = new Web3Wrapper(web3.currentProvider); -- cgit v1.2.3 From 4365350430f70de6488cb4927d315e0d72297a0a Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 9 Mar 2018 17:12:50 +0100 Subject: Don't do parallel calls --- packages/contracts/test/token_registry.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'packages/contracts') diff --git a/packages/contracts/test/token_registry.ts b/packages/contracts/test/token_registry.ts index 9dcc77b82..b3a420d31 100644 --- a/packages/contracts/test/token_registry.ts +++ b/packages/contracts/test/token_registry.ts @@ -142,10 +142,8 @@ describe('TokenRegistry', () => { await tokenReg.setTokenName.sendTransactionAsync(token1.address, token2.name, { from: owner, }); - const [newData, oldData] = await Promise.all([ - tokenRegWrapper.getTokenByNameAsync(token2.name), - tokenRegWrapper.getTokenByNameAsync(token1.name), - ]); + const newData = await tokenRegWrapper.getTokenByNameAsync(token2.name); + const oldData = await tokenRegWrapper.getTokenByNameAsync(token1.name); const expectedNewData = _.assign({}, token1, { name: token2.name }); const expectedOldData = nullToken; @@ -179,10 +177,8 @@ describe('TokenRegistry', () => { it('should change the token symbol when called by owner', async () => { await tokenReg.setTokenSymbol.sendTransactionAsync(token1.address, token2.symbol, { from: owner }); - const [newData, oldData] = await Promise.all([ - tokenRegWrapper.getTokenBySymbolAsync(token2.symbol), - tokenRegWrapper.getTokenBySymbolAsync(token1.symbol), - ]); + const newData = await tokenRegWrapper.getTokenByNameAsync(token2.name); + const oldData = await tokenRegWrapper.getTokenByNameAsync(token1.name); const expectedNewData = _.assign({}, token1, { symbol: token2.symbol }); const expectedOldData = nullToken; -- cgit v1.2.3 From 8f45e9a518fac7bfff1c93b41173ebabc7a883f8 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 9 Mar 2018 17:19:27 +0100 Subject: Run coverage on CI --- packages/contracts/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/contracts') diff --git a/packages/contracts/package.json b/packages/contracts/package.json index ba0b52e90..c5a163c50 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -25,7 +25,7 @@ "coverage:report:html": "istanbul report html && open coverage/lcov-report/index.html", "coverage:report:lcov": "istanbul report lcov", "coverage:report:coveralls": "yarn coverage:report:lcov && cat coverage/lcov.info | coveralls", - "test:circleci": "yarn test" + "test:circleci": "yarn test:coverage && yarn coverage:report:coveralls" }, "config": { "contracts": "Exchange,DummyToken,ZRXToken,Token,WETH9,TokenTransferProxy,MultiSigWallet,MultiSigWalletWithTimeLock,MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress,MaliciousToken,TokenRegistry,Arbitrage,EtherDelta,AccountLevels" -- cgit v1.2.3 From 945a19bb61722ddb708ea8108e36d3fea7d03d52 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Sat, 10 Mar 2018 01:09:09 +0100 Subject: Fix a typo in tests --- packages/contracts/test/token_registry.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'packages/contracts') diff --git a/packages/contracts/test/token_registry.ts b/packages/contracts/test/token_registry.ts index b3a420d31..5313ec1b1 100644 --- a/packages/contracts/test/token_registry.ts +++ b/packages/contracts/test/token_registry.ts @@ -177,8 +177,8 @@ describe('TokenRegistry', () => { it('should change the token symbol when called by owner', async () => { await tokenReg.setTokenSymbol.sendTransactionAsync(token1.address, token2.symbol, { from: owner }); - const newData = await tokenRegWrapper.getTokenByNameAsync(token2.name); - const oldData = await tokenRegWrapper.getTokenByNameAsync(token1.name); + const newData = await tokenRegWrapper.getTokenBySymbolAsync(token2.symbol); + const oldData = await tokenRegWrapper.getTokenBySymbolAsync(token1.symbol); const expectedNewData = _.assign({}, token1, { symbol: token2.symbol }); const expectedOldData = nullToken; -- cgit v1.2.3 From 8d90e640b093b016a362fce51115853c63c541f9 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Sat, 10 Mar 2018 03:23:59 +0100 Subject: Keep coverage directory --- packages/contracts/coverage/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 packages/contracts/coverage/.gitkeep (limited to 'packages/contracts') diff --git a/packages/contracts/coverage/.gitkeep b/packages/contracts/coverage/.gitkeep new file mode 100644 index 000000000..e69de29bb -- cgit v1.2.3 From 2197c2481a1f9f8fcc5d4e9055769741b8c53c73 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Sat, 10 Mar 2018 04:07:25 +0100 Subject: Increase timeout --- packages/contracts/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/contracts') diff --git a/packages/contracts/package.json b/packages/contracts/package.json index c5a163c50..37d104a54 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -14,7 +14,7 @@ "build": "tsc", "test": "run-s build run_mocha", "test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text", - "run_mocha": "mocha 'lib/test/**/*.js' --timeout 10000 --bail --exit", + "run_mocha": "mocha 'lib/test/**/*.js' --timeout 100000 --bail --exit", "compile:comment": "Yarn workspaces do not link binaries correctly so we need to reference them directly https://github.com/yarnpkg/yarn/issues/3846", "compile": "node ../deployer/lib/src/cli.js compile --contracts ${npm_package_config_contracts} --contracts-dir src/contracts --artifacts-dir src/artifacts", "clean": "shx rm -rf ./lib", -- cgit v1.2.3 From 9bffce9dc55030a3901b7be61a5dbbdc80d09a4b Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Sat, 10 Mar 2018 06:07:31 +0100 Subject: Fix coverage:report:html --- packages/contracts/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/contracts') diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 37d104a54..05d305942 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -22,7 +22,7 @@ "migrate": "yarn build && yarn compile && node ./lib/migrations/index.js", "lint": "tslint --project . 'migrations/**/*.ts' 'test/**/*.ts' 'util/**/*.ts' 'deploy/**/*.ts'", "coverage:report:text": "istanbul report text", - "coverage:report:html": "istanbul report html && open coverage/lcov-report/index.html", + "coverage:report:html": "istanbul report html && open coverage/index.html", "coverage:report:lcov": "istanbul report lcov", "coverage:report:coveralls": "yarn coverage:report:lcov && cat coverage/lcov.info | coveralls", "test:circleci": "yarn test:coverage && yarn coverage:report:coveralls" -- cgit v1.2.3 From bd7517cfd489a9789f81c247fb45329881274d15 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Sat, 10 Mar 2018 06:07:55 +0100 Subject: Add support for async calls under coverage --- packages/contracts/test/token_registry.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'packages/contracts') diff --git a/packages/contracts/test/token_registry.ts b/packages/contracts/test/token_registry.ts index 5313ec1b1..9dcc77b82 100644 --- a/packages/contracts/test/token_registry.ts +++ b/packages/contracts/test/token_registry.ts @@ -142,8 +142,10 @@ describe('TokenRegistry', () => { await tokenReg.setTokenName.sendTransactionAsync(token1.address, token2.name, { from: owner, }); - const newData = await tokenRegWrapper.getTokenByNameAsync(token2.name); - const oldData = await tokenRegWrapper.getTokenByNameAsync(token1.name); + const [newData, oldData] = await Promise.all([ + tokenRegWrapper.getTokenByNameAsync(token2.name), + tokenRegWrapper.getTokenByNameAsync(token1.name), + ]); const expectedNewData = _.assign({}, token1, { name: token2.name }); const expectedOldData = nullToken; @@ -177,8 +179,10 @@ describe('TokenRegistry', () => { it('should change the token symbol when called by owner', async () => { await tokenReg.setTokenSymbol.sendTransactionAsync(token1.address, token2.symbol, { from: owner }); - const newData = await tokenRegWrapper.getTokenBySymbolAsync(token2.symbol); - const oldData = await tokenRegWrapper.getTokenBySymbolAsync(token1.symbol); + const [newData, oldData] = await Promise.all([ + tokenRegWrapper.getTokenBySymbolAsync(token2.symbol), + tokenRegWrapper.getTokenBySymbolAsync(token1.symbol), + ]); const expectedNewData = _.assign({}, token1, { symbol: token2.symbol }); const expectedOldData = nullToken; -- cgit v1.2.3 From c4a18ee64b58217dd9733c9b9edbfe592fc1cb8d Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 12 Mar 2018 03:19:39 +0100 Subject: Make Deployer configurable by jsonrpcUrl instead of jsonrpcPort --- packages/contracts/migrations/index.ts | 2 +- packages/contracts/test/utils/deployer.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'packages/contracts') diff --git a/packages/contracts/migrations/index.ts b/packages/contracts/migrations/index.ts index a44d011da..47ae7044d 100644 --- a/packages/contracts/migrations/index.ts +++ b/packages/contracts/migrations/index.ts @@ -8,7 +8,7 @@ import { runMigrationsAsync } from './migrate'; const deployerOpts = { artifactsDir: path.resolve('src', 'artifacts'), - jsonrpcPort: devConstants.RPC_PORT, + jsonrpcUrl: devConstants.RPC_URL, networkId: constants.TESTRPC_NETWORK_ID, defaults: { gas: devConstants.GAS_ESTIMATE, diff --git a/packages/contracts/test/utils/deployer.ts b/packages/contracts/test/utils/deployer.ts index c1370f38c..1baa47f09 100644 --- a/packages/contracts/test/utils/deployer.ts +++ b/packages/contracts/test/utils/deployer.ts @@ -9,7 +9,7 @@ import { web3 } from './web3_wrapper'; const deployerOpts = { web3Provider: web3.currentProvider, artifactsDir: path.resolve('src', 'artifacts'), - jsonrpcPort: devConstants.RPC_PORT, + jsonrpcUrl: devConstants.RPC_URL, networkId: constants.TESTRPC_NETWORK_ID, defaults: { gas: devConstants.GAS_ESTIMATE, -- cgit v1.2.3 From a9db0e8ebe1360cf521302691998ef1f98e2dc51 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 13 Mar 2018 15:19:31 +0100 Subject: Properly and consistently parse ENV vars --- packages/contracts/test/global_hooks.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'packages/contracts') diff --git a/packages/contracts/test/global_hooks.ts b/packages/contracts/test/global_hooks.ts index 0440c871d..089521d94 100644 --- a/packages/contracts/test/global_hooks.ts +++ b/packages/contracts/test/global_hooks.ts @@ -1,7 +1,7 @@ -import { coverage } from '@0xproject/dev-utils'; +import { coverage, env, EnvVars } from '@0xproject/dev-utils'; after('generate coverage report', async () => { - if (process.env.SOLIDITY_COVERAGE) { + if (env.parseBoolean(EnvVars.SolidityCoverage)) { const coverageSubprovider = coverage.getCoverageSubproviderSingleton(); await coverageSubprovider.writeCoverageAsync(); } -- cgit v1.2.3 From 11ed5d62baa0cce4014afaf6986a0745cc853bef Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 13 Mar 2018 16:34:37 +0100 Subject: Report all coverage reports together --- packages/contracts/package.json | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'packages/contracts') diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 05d305942..371aba8ab 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -13,7 +13,7 @@ "copy_artifacts": "copyfiles './src/artifacts/**/*' ./lib", "build": "tsc", "test": "run-s build run_mocha", - "test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text", + "test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov", "run_mocha": "mocha 'lib/test/**/*.js' --timeout 100000 --bail --exit", "compile:comment": "Yarn workspaces do not link binaries correctly so we need to reference them directly https://github.com/yarnpkg/yarn/issues/3846", "compile": "node ../deployer/lib/src/cli.js compile --contracts ${npm_package_config_contracts} --contracts-dir src/contracts --artifacts-dir src/artifacts", @@ -24,8 +24,7 @@ "coverage:report:text": "istanbul report text", "coverage:report:html": "istanbul report html && open coverage/index.html", "coverage:report:lcov": "istanbul report lcov", - "coverage:report:coveralls": "yarn coverage:report:lcov && cat coverage/lcov.info | coveralls", - "test:circleci": "yarn test:coverage && yarn coverage:report:coveralls" + "test:circleci": "yarn test:coverage" }, "config": { "contracts": "Exchange,DummyToken,ZRXToken,Token,WETH9,TokenTransferProxy,MultiSigWallet,MultiSigWalletWithTimeLock,MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress,MaliciousToken,TokenRegistry,Arbitrage,EtherDelta,AccountLevels" @@ -54,7 +53,6 @@ "chai-bignumber": "^2.0.1", "chai-typescript-typings": "^0.0.4", "copyfiles": "^1.2.0", - "coveralls": "^3.0.0", "dirty-chai": "^2.0.1", "ethers-typescript-typings": "^0.0.2", "mocha": "^4.0.1", -- cgit v1.2.3 From 0334004b11564d4c23dd64bcf1ee4f9c6097a466 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 13 Mar 2018 19:09:16 +0100 Subject: Revert "Report all coverage reports together" This reverts commit 11ed5d62baa0cce4014afaf6986a0745cc853bef. --- packages/contracts/package.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'packages/contracts') diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 371aba8ab..05d305942 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -13,7 +13,7 @@ "copy_artifacts": "copyfiles './src/artifacts/**/*' ./lib", "build": "tsc", "test": "run-s build run_mocha", - "test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov", + "test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text", "run_mocha": "mocha 'lib/test/**/*.js' --timeout 100000 --bail --exit", "compile:comment": "Yarn workspaces do not link binaries correctly so we need to reference them directly https://github.com/yarnpkg/yarn/issues/3846", "compile": "node ../deployer/lib/src/cli.js compile --contracts ${npm_package_config_contracts} --contracts-dir src/contracts --artifacts-dir src/artifacts", @@ -24,7 +24,8 @@ "coverage:report:text": "istanbul report text", "coverage:report:html": "istanbul report html && open coverage/index.html", "coverage:report:lcov": "istanbul report lcov", - "test:circleci": "yarn test:coverage" + "coverage:report:coveralls": "yarn coverage:report:lcov && cat coverage/lcov.info | coveralls", + "test:circleci": "yarn test:coverage && yarn coverage:report:coveralls" }, "config": { "contracts": "Exchange,DummyToken,ZRXToken,Token,WETH9,TokenTransferProxy,MultiSigWallet,MultiSigWalletWithTimeLock,MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress,MaliciousToken,TokenRegistry,Arbitrage,EtherDelta,AccountLevels" @@ -53,6 +54,7 @@ "chai-bignumber": "^2.0.1", "chai-typescript-typings": "^0.0.4", "copyfiles": "^1.2.0", + "coveralls": "^3.0.0", "dirty-chai": "^2.0.1", "ethers-typescript-typings": "^0.0.2", "mocha": "^4.0.1", -- cgit v1.2.3