Skip to content

Commit

Permalink
Merge pull request #103 from dallasjohnson/feature/Add-reporter-optio…
Browse files Browse the repository at this point in the history
…n-to-config

Adds test reporter config
  • Loading branch information
MitchPierias authored Oct 8, 2019
2 parents 18c2538 + 86f2a24 commit 2bb7db4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/cli/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ export const runTests = async () => {
// pretty reasonable in our case and it's possible a successful test would take 10 seconds.
mocha.slow(TEST_EXPECTED_DURATION);
mocha.timeout(TEST_TIMEOUT_DURATION);
mocha.reporter(ConfigManager.testReporter);

// Run the tests.
await new Promise((resolve, reject) =>
Expand Down
16 changes: 13 additions & 3 deletions src/configManager.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import axios from 'axios';
import * as path from 'path';
import * as mkdirpCallback from 'mkdirp';
import * as Mocha from 'mocha';
import {
readFile as readFileCallback,
writeFile as writeFileCallback,
Expand Down Expand Up @@ -29,6 +30,8 @@ export interface LamingtonConfig {
exclude?: Array<string>;
debugTransactions?: boolean;
debug: LamingtonDebugLevel;
reporter?: string;
reporterOptions?: any;
}

/** Level of debug output */
Expand Down Expand Up @@ -67,7 +70,6 @@ export class ConfigManager {
* @author Mitch Pierias <github.com/MitchPierias>
*/
public static async initWithDefaults() {

DEFAULT_CONFIG.cdt = await ConfigManager.getAssetURL('EOSIO', 'eosio.cdt', 'amd64.deb');
DEFAULT_CONFIG.eos = await ConfigManager.getAssetURL('EOSIO', 'eos', 'ubuntu-18.04');

Expand Down Expand Up @@ -161,8 +163,8 @@ export class ConfigManager {
// Read existing configuration and store
ConfigManager.config = {
...DEFAULT_CONFIG,
...JSON.parse(await readFile(atPath, ENCODING))
}
...JSON.parse(await readFile(atPath, ENCODING)),
};
}

/**
Expand Down Expand Up @@ -215,4 +217,12 @@ export class ConfigManager {
static get exclude() {
return (ConfigManager.config && ConfigManager.config.exclude) || DEFAULT_CONFIG.exclude;
}

/**
* Returns the array of excluded strings or patterns
* @author Dallas Johnson <github.com/dallasjohnson>
*/
static get testReporter() {
return (ConfigManager.config && ConfigManager.config.reporter) || Mocha.reporters.Min;
}
}

0 comments on commit 2bb7db4

Please sign in to comment.