Skip to content

Commit

Permalink
Adds verbose logging option for the CLI to get more detail for thrown…
Browse files Browse the repository at this point in the history
… errors.
  • Loading branch information
dallasjohnson committed Oct 9, 2019
1 parent f52d7ca commit 51215a9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/cli/lamington-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { eosIsReady, startEos, runTests, stopContainer, buildAll } from './utils
import { GitIgnoreManager } from '../gitignoreManager';
import { ConfigManager } from '../configManager';

export var verbose_logging: Boolean;

/**
* Executes a build and test procedure
* @note Keep alive setup is incomplete
Expand All @@ -15,6 +17,11 @@ const run = async () => {

console.log('args: ' + args);

if (args.includes('verbose')) {
verbose_logging = true;
console.log('`verbose_logging` set to `true`');
}

// Stop running instances for fresh test environment
if (await eosIsReady()) {
await stopContainer();
Expand Down
4 changes: 4 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as chai from 'chai';
import * as deepEqualInAnyOrder from 'deep-equal-in-any-order';

import { EOSManager } from './eosManager';
import { verbose_logging } from './cli/lamington-test';
import { TableRowsResult } from './contracts';

// Extend Chai's expect methods
Expand Down Expand Up @@ -123,6 +124,9 @@ export const assertEOSError = async (
try {
await operation;
} catch (error) {
if (verbose_logging) {
console.log('Verbose error output: ' + JSON.stringify(error, null, 4));
}
if (error.json && error.json.error && error.json.error.name) {
// Compare error and fail if the error doesn't match the expected
assert(
Expand Down

0 comments on commit 51215a9

Please sign in to comment.