From 0987c9a7cfb1936469062b4cb6222158b5e110b7 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Tue, 27 Feb 2018 17:12:45 -0800 Subject: Write to provided output directory --- packages/sra-report/src/index.ts | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'packages/sra-report/src') diff --git a/packages/sra-report/src/index.ts b/packages/sra-report/src/index.ts index bd0615480..fade07095 100644 --- a/packages/sra-report/src/index.ts +++ b/packages/sra-report/src/index.ts @@ -63,13 +63,27 @@ const mainAsync = async () => { throw new Error('Could not get any orders from /orders endpoint'); } const orderHash = ZeroEx.getOrderHashHex(firstOrder); - const newmanRunOptions = { + const newmanEnvironmentOptions = { collection: sraReportCollectionJSON, - reporters: 'cli', globals: postmanEnvironmentFactory.createGlobalEnvironment(args.url, orderHash), environment: postmanEnvironmentFactory.createNetworkEnvironment(args.networkId), }; + const newmanReporterOptions = !_.isUndefined(args.output) + ? { + reporters: 'json', + reporter: { + json: { + export: args.output, + }, + }, + } + : { + reporters: 'cli', + }; + const newmanRunOptions = { + ...newmanEnvironmentOptions, + ...newmanReporterOptions, + }; await newmanRunAsync(newmanRunOptions); }; - mainAsync().catch(utils.log); -- cgit