aboutsummaryrefslogtreecommitdiffstats
path: root/packages/dev-utils
diff options
context:
space:
mode:
Diffstat (limited to 'packages/dev-utils')
-rw-r--r--packages/dev-utils/CHANGELOG.json28
-rw-r--r--packages/dev-utils/CHANGELOG.md20
-rw-r--r--packages/dev-utils/package.json20
-rw-r--r--packages/dev-utils/src/callback_error_reporter.ts68
-rw-r--r--packages/dev-utils/src/coverage.ts5
-rw-r--r--packages/dev-utils/src/index.ts1
-rw-r--r--packages/dev-utils/src/web3_factory.ts4
7 files changed, 125 insertions, 21 deletions
diff --git a/packages/dev-utils/CHANGELOG.json b/packages/dev-utils/CHANGELOG.json
index f245e6183..3f70a93cc 100644
--- a/packages/dev-utils/CHANGELOG.json
+++ b/packages/dev-utils/CHANGELOG.json
@@ -1,5 +1,33 @@
[
{
+ "version": "0.4.2",
+ "changes": [
+ {
+ "note": "Move callbackErrorReporter over from 0x.js",
+ "pr": 579
+ }
+ ]
+ },
+ {
+ "timestamp": 1525477860,
+ "version": "0.4.1",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
+ "version": "0.4.0",
+ "changes": [
+ {
+ "note": "Update web3 provider engine to 14.0.4",
+ "pr": 555
+ }
+ ],
+ "timestamp": 1525428773
+ },
+ {
"version": "0.3.6",
"changes": [
{
diff --git a/packages/dev-utils/CHANGELOG.md b/packages/dev-utils/CHANGELOG.md
index de9db5125..ab824c898 100644
--- a/packages/dev-utils/CHANGELOG.md
+++ b/packages/dev-utils/CHANGELOG.md
@@ -5,11 +5,19 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v0.4.1 - _May 5, 2018_
+
+ * Dependencies updated
+
+## v0.4.0 - _May 4, 2018_
+
+ * Update web3 provider engine to 14.0.4 (#555)
+
## v0.3.6 - _April 18, 2018_
* Allow an rpcURL to be set in Web3Config (for testnet RPC endpoints) (#524)
-## v0.3.5 - _April 12, 2018_
+## v0.3.5 - _April 11, 2018_
* Dependencies updated
@@ -21,25 +29,25 @@ CHANGELOG
* Dependencies updated
-## v0.3.1 - _March 18, 2018_
+## v0.3.1 - _March 17, 2018_
* Reduce npm package size by adding an `.npmignore` file.
* Move `@0xproject/web3-wrapper` to dependencies from devDependencies.
-## v0.3.0 - _March 18, 2018_
+## v0.3.0 - _March 17, 2018_
* Add coverage subprovider if SOLIDITY_COVERAGE env variable is true (#426)
* Refactor `BlockchainLifecycle` to work with in-process ganache (#426)
* Remove `RPC` class and move it's logic to `Web3Wrapper` (#426)
-## v0.2.0 - _February 16, 2018_
+## v0.2.0 - _February 15, 2018_
* Remove subproviders (#392)
-## v0.0.12 - _February 9, 2018_
+## v0.0.12 - _February 8, 2018_
* Fix publishing issue where .npmignore was not properly excluding undesired content (#389)
-## v0.0.11 - _February 7, 2018_
+## v0.0.11 - _February 6, 2018_
* Updated `types-ethereumjs-util` dev dependency (#352)
diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json
index 5b855fb33..67b448024 100644
--- a/packages/dev-utils/package.json
+++ b/packages/dev-utils/package.json
@@ -1,6 +1,6 @@
{
"name": "@0xproject/dev-utils",
- "version": "0.3.6",
+ "version": "0.4.1",
"description": "0x dev TS utils",
"main": "lib/src/index.js",
"types": "lib/src/index.d.ts",
@@ -13,7 +13,7 @@
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
"clean": "shx rm -rf lib scripts",
- "lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'",
+ "lint": "tslint --project .",
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
},
"license": "Apache-2.0",
@@ -26,8 +26,8 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/dev-utils/README.md",
"devDependencies": {
- "@0xproject/monorepo-scripts": "^0.1.18",
- "@0xproject/tslint-config": "^0.4.16",
+ "@0xproject/monorepo-scripts": "^0.1.19",
+ "@0xproject/tslint-config": "^0.4.17",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
"chai": "^4.0.1",
@@ -40,14 +40,14 @@
"typescript": "2.7.1"
},
"dependencies": {
- "@0xproject/sol-cov": "^0.0.8",
- "@0xproject/subproviders": "^0.9.0",
- "@0xproject/types": "^0.6.1",
- "@0xproject/typescript-typings": "^0.2.0",
- "@0xproject/web3-wrapper": "^0.6.1",
+ "@0xproject/sol-cov": "^0.0.10",
+ "@0xproject/subproviders": "^0.10.1",
+ "@0xproject/types": "^0.6.3",
+ "@0xproject/typescript-typings": "^0.3.1",
+ "@0xproject/web3-wrapper": "^0.6.3",
"lodash": "^4.17.4",
"web3": "^0.20.0",
- "web3-provider-engine": "^13.0.1"
+ "web3-provider-engine": "^14.0.4"
},
"publishConfig": {
"access": "public"
diff --git a/packages/dev-utils/src/callback_error_reporter.ts b/packages/dev-utils/src/callback_error_reporter.ts
new file mode 100644
index 000000000..c8e693673
--- /dev/null
+++ b/packages/dev-utils/src/callback_error_reporter.ts
@@ -0,0 +1,68 @@
+import * as chai from 'chai';
+import * as _ from 'lodash';
+
+import { DoneCallback } from '@0xproject/types';
+
+const expect = chai.expect;
+
+export const callbackErrorReporter = {
+ reportNoErrorCallbackErrors(done: DoneCallback, expectToBeCalledOnce = true) {
+ const callback = <T>(f?: (value: T) => void) => {
+ const wrapped = (value: T) => {
+ if (_.isUndefined(f)) {
+ done();
+ return;
+ }
+ try {
+ f(value);
+ if (expectToBeCalledOnce) {
+ done();
+ }
+ } catch (err) {
+ done(err);
+ }
+ };
+ return wrapped;
+ };
+ return callback;
+ },
+ reportNodeCallbackErrors(done: DoneCallback, expectToBeCalledOnce = true) {
+ const callback = <T>(f?: (value: T) => void) => {
+ const wrapped = (error: Error | null, value: T | undefined) => {
+ if (!_.isNull(error)) {
+ done(error);
+ } else {
+ if (_.isUndefined(f)) {
+ done();
+ return;
+ }
+ try {
+ f(value as T);
+ if (expectToBeCalledOnce) {
+ done();
+ }
+ } catch (err) {
+ done(err);
+ }
+ }
+ };
+ return wrapped;
+ };
+ return callback;
+ },
+ assertNodeCallbackError(done: DoneCallback, errMsg: string) {
+ const wrapped = <T>(error: Error | null, value: T | undefined) => {
+ if (_.isNull(error)) {
+ done(new Error('Expected callback to receive an error'));
+ } else {
+ try {
+ expect(error.message).to.be.equal(errMsg);
+ done();
+ } catch (err) {
+ done(err);
+ }
+ }
+ };
+ return wrapped;
+ },
+};
diff --git a/packages/dev-utils/src/coverage.ts b/packages/dev-utils/src/coverage.ts
index 67c87ec30..6f7640835 100644
--- a/packages/dev-utils/src/coverage.ts
+++ b/packages/dev-utils/src/coverage.ts
@@ -13,10 +13,9 @@ export const coverage = {
return coverageSubprovider;
},
_getCoverageSubprovider(): CoverageSubprovider {
- const artifactsPath = '../migrations/src/artifacts';
+ const artifactsPath = '../migrations/artifacts/1.0.0';
const contractsPath = 'src/contracts';
- const networkId = 50;
const defaultFromAddress = constants.TESTRPC_FIRST_ADDRESS;
- return new CoverageSubprovider(artifactsPath, contractsPath, networkId, defaultFromAddress);
+ return new CoverageSubprovider(artifactsPath, contractsPath, defaultFromAddress);
},
};
diff --git a/packages/dev-utils/src/index.ts b/packages/dev-utils/src/index.ts
index 2ff2a2238..9124f3e28 100644
--- a/packages/dev-utils/src/index.ts
+++ b/packages/dev-utils/src/index.ts
@@ -3,3 +3,4 @@ export { web3Factory } from './web3_factory';
export { constants as devConstants } from './constants';
export { coverage } from './coverage';
export { env, EnvVars } from './env';
+export { callbackErrorReporter } from './callback_error_reporter';
diff --git a/packages/dev-utils/src/web3_factory.ts b/packages/dev-utils/src/web3_factory.ts
index 68348d671..4cd343c44 100644
--- a/packages/dev-utils/src/web3_factory.ts
+++ b/packages/dev-utils/src/web3_factory.ts
@@ -60,9 +60,9 @@ export const web3Factory = {
provider.addProvider(
new GanacheSubprovider({
logger,
- verbose: env.parseBoolean(EnvVars.SolidityCoverage),
+ verbose: env.parseBoolean(EnvVars.VerboseGanache),
port: 8545,
- networkId: 50,
+ network_id: 50,
mnemonic: 'concert load couple harbor equip island argue ramp clarify fence smart topic',
}),
);