diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-04-02 16:10:07 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-04-02 17:35:03 +0800 |
commit | b2d6ac8dba9dae92e2850fd39f0f7f3f22900cc5 (patch) | |
tree | 98458fcb9b7e884d7857c5e0f1ad11c2e8d4d0e6 | |
parent | b090b7b1f26e7c6af9aa9f244bb0009bc5050127 (diff) | |
download | dexon-sol-tools-b2d6ac8dba9dae92e2850fd39f0f7f3f22900cc5.tar dexon-sol-tools-b2d6ac8dba9dae92e2850fd39f0f7f3f22900cc5.tar.gz dexon-sol-tools-b2d6ac8dba9dae92e2850fd39f0f7f3f22900cc5.tar.bz2 dexon-sol-tools-b2d6ac8dba9dae92e2850fd39f0f7f3f22900cc5.tar.lz dexon-sol-tools-b2d6ac8dba9dae92e2850fd39f0f7f3f22900cc5.tar.xz dexon-sol-tools-b2d6ac8dba9dae92e2850fd39f0f7f3f22900cc5.tar.zst dexon-sol-tools-b2d6ac8dba9dae92e2850fd39f0f7f3f22900cc5.zip |
move all configs to a config file
-rw-r--r-- | packages/metacoin/test/utils/config.ts | 7 | ||||
-rw-r--r-- | packages/metacoin/test/utils/coverage.ts | 8 | ||||
-rw-r--r-- | packages/metacoin/test/utils/deployer.ts | 5 | ||||
-rw-r--r-- | packages/metacoin/test/utils/web3_wrapper.ts | 8 |
4 files changed, 17 insertions, 11 deletions
diff --git a/packages/metacoin/test/utils/config.ts b/packages/metacoin/test/utils/config.ts new file mode 100644 index 000000000..1b78cce2e --- /dev/null +++ b/packages/metacoin/test/utils/config.ts @@ -0,0 +1,7 @@ +export const config = { + networkId: 50, + artifactsDir: 'artifacts', + contractsDir: 'contracts', + ganacheLogFile: 'ganache.log', + mnemonic: 'concert load couple harbor equip island argue ramp clarify fence smart topic', +}; diff --git a/packages/metacoin/test/utils/coverage.ts b/packages/metacoin/test/utils/coverage.ts index 5115dec0e..6b249384f 100644 --- a/packages/metacoin/test/utils/coverage.ts +++ b/packages/metacoin/test/utils/coverage.ts @@ -1,7 +1,8 @@ +import { devConstants } from '@0xproject/dev-utils'; import { CoverageSubprovider } from '@0xproject/sol-cov'; import * as _ from 'lodash'; -import { devConstants } from '@0xproject/dev-utils'; +import { config } from './config'; let coverageSubprovider: CoverageSubprovider; @@ -13,10 +14,7 @@ export const coverage = { return coverageSubprovider; }, _getCoverageSubprovider(): CoverageSubprovider { - const artifactsPath = 'artifacts'; - const contractsPath = 'contracts'; - const networkId = 50; const defaultFromAddress = devConstants.TESTRPC_FIRST_ADDRESS; - return new CoverageSubprovider(artifactsPath, contractsPath, networkId, defaultFromAddress); + return new CoverageSubprovider(config.artifactsDir, config.contractsDir, config.networkId, defaultFromAddress); }, }; diff --git a/packages/metacoin/test/utils/deployer.ts b/packages/metacoin/test/utils/deployer.ts index d7dbc6d36..7916c8541 100644 --- a/packages/metacoin/test/utils/deployer.ts +++ b/packages/metacoin/test/utils/deployer.ts @@ -2,12 +2,13 @@ import { Deployer } from '@0xproject/deployer'; import { devConstants } from '@0xproject/dev-utils'; import * as path from 'path'; +import { config } from './config'; import { web3Wrapper } from './web3_wrapper'; const deployerOpts = { web3Provider: web3Wrapper.getProvider(), - artifactsDir: path.resolve('artifacts'), - networkId: 50, + artifactsDir: config.artifactsDir, + networkId: config.networkId, defaults: { from: devConstants.TESTRPC_FIRST_ADDRESS, }, diff --git a/packages/metacoin/test/utils/web3_wrapper.ts b/packages/metacoin/test/utils/web3_wrapper.ts index 216a1de5a..23bd62b93 100644 --- a/packages/metacoin/test/utils/web3_wrapper.ts +++ b/packages/metacoin/test/utils/web3_wrapper.ts @@ -5,6 +5,7 @@ import * as fs from 'fs'; import * as _ from 'lodash'; import ProviderEngine = require('web3-provider-engine'); +import { config } from './config'; import { coverage } from './coverage'; export const web3Provider = new ProviderEngine(); @@ -16,13 +17,12 @@ web3Provider.addProvider( new GanacheSubprovider({ logger: { log: (arg: any) => { - fs.appendFileSync('ganache.log', `${arg}\n`); + fs.appendFileSync(config.ganacheLogFile, `${arg}\n`); }, }, verbose: env.parseBoolean(EnvVars.SolidityCoverage), - port: 8545, - networkId: 50, - mnemonic: 'concert load couple harbor equip island argue ramp clarify fence smart topic', + networkId: config.networkId, + mnemonic: config.mnemonic, }), ); web3Provider.start(); |