aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sra-report/src
diff options
context:
space:
mode:
authorBrandon Millman <brandon@0xproject.com>2018-03-20 01:28:02 +0800
committerGitHub <noreply@github.com>2018-03-20 01:28:02 +0800
commitc7c12371ef581920cbb10cc4586de17cdaa333f6 (patch)
tree40daa2b500f20078d31c9ee864f936c4b7bb2a3d /packages/sra-report/src
parent2a438419ab3bc32dba43918cf2eb480439ef81de (diff)
parentfb40b105015a20bb4359a3360258c9f85c495744 (diff)
downloaddexon-sol-tools-c7c12371ef581920cbb10cc4586de17cdaa333f6.tar
dexon-sol-tools-c7c12371ef581920cbb10cc4586de17cdaa333f6.tar.gz
dexon-sol-tools-c7c12371ef581920cbb10cc4586de17cdaa333f6.tar.bz2
dexon-sol-tools-c7c12371ef581920cbb10cc4586de17cdaa333f6.tar.lz
dexon-sol-tools-c7c12371ef581920cbb10cc4586de17cdaa333f6.tar.xz
dexon-sol-tools-c7c12371ef581920cbb10cc4586de17cdaa333f6.tar.zst
dexon-sol-tools-c7c12371ef581920cbb10cc4586de17cdaa333f6.zip
Merge pull request #451 from 0xProject/feature/sra-report/collection-tests@0xproject/deployer@0.3.3
Add scaffolding for sra-report collection unit tests
Diffstat (limited to 'packages/sra-report/src')
-rw-r--r--packages/sra-report/src/globals.d.ts24
-rw-r--r--packages/sra-report/src/index.ts6
-rw-r--r--packages/sra-report/src/utils.ts6
3 files changed, 32 insertions, 4 deletions
diff --git a/packages/sra-report/src/globals.d.ts b/packages/sra-report/src/globals.d.ts
index 0d3beb446..817d1534b 100644
--- a/packages/sra-report/src/globals.d.ts
+++ b/packages/sra-report/src/globals.d.ts
@@ -1,6 +1,28 @@
+declare module 'dirty-chai';
+
declare module 'newman' {
+ export interface NewmanRunSummary {
+ run: NewmanRun;
+ }
+ export interface NewmanRun {
+ executions: NewmanRunExecution[];
+ }
+ export interface NewmanRunExecution {
+ item: NewmanRunExecutionItem;
+ assertions: NewmanRunExecutionAssertion[];
+ }
+ export interface NewmanRunExecutionItem {
+ name: string;
+ }
+ export interface NewmanRunExecutionAssertion {
+ assertion: string;
+ error: NewmanRunExecutionAssertionError;
+ }
+ export interface NewmanRunExecutionAssertionError {
+ message: string;
+ }
// tslint:disable-next-line:completed-docs
- export function run(options: any, callback?: () => void): void;
+ export function run(options: any, callback?: (err: Error | null, summary: NewmanRunSummary) => void): void;
}
declare module '*.json' {
diff --git a/packages/sra-report/src/index.ts b/packages/sra-report/src/index.ts
index e9d55ab9b..9a203b654 100644
--- a/packages/sra-report/src/index.ts
+++ b/packages/sra-report/src/index.ts
@@ -7,11 +7,11 @@ import * as _ from 'lodash';
import * as newman from 'newman';
import * as yargs from 'yargs';
-import * as sraReportCollectionJSON from '../postman_configs/collections/sra_report.postman_collection.json';
+import * as sraReportCollectionJSON from '../../postman_collections/sra_report.postman_collection.json';
import { postmanEnvironmentFactory } from './postman_environment_factory';
+import { utils } from './utils';
-const newmanRunAsync = promisify<void>(newman.run);
const DEFAULT_NETWORK_ID = 1;
const SUPPORTED_NETWORK_IDS = [1, 3, 4, 42];
@@ -96,6 +96,6 @@ const mainAsync = async () => {
exportEnvironment: args.exportEnvironment,
...newmanReporterOptions,
};
- await newmanRunAsync(newmanRunOptions);
+ await utils.newmanRunAsync(newmanRunOptions);
};
mainAsync().catch(logUtils.log);
diff --git a/packages/sra-report/src/utils.ts b/packages/sra-report/src/utils.ts
new file mode 100644
index 000000000..3a83a7ea0
--- /dev/null
+++ b/packages/sra-report/src/utils.ts
@@ -0,0 +1,6 @@
+import { promisify } from '@0xproject/utils';
+import { NewmanRunSummary, run as newmanRun } from 'newman';
+
+export const utils = {
+ newmanRunAsync: promisify<NewmanRunSummary>(newmanRun),
+};