Skip to content

Commit

Permalink
fix(validator): resolve result parser properly
Browse files Browse the repository at this point in the history
- Add missing brackets to comparison
  • Loading branch information
AriPerkkio committed Dec 28, 2020
1 parent c4b071a commit a4af9bb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/config/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,8 @@ export function getConfigWithDefaults(config: ConfigWithOptionals): Config {
cache: config.cache != null ? config.cache : DEFAULT_CACHE,

resultParser:
config.resultParser || CI
? DEFAULT_RESULT_PARSER_CI
: DEFAULT_RESULT_PARSER_CLI,
config.resultParser ||
(CI ? DEFAULT_RESULT_PARSER_CI : DEFAULT_RESULT_PARSER_CLI),

concurrentTasks: config.concurrentTasks || DEFAULT_CONCURRENT_TASKS,

Expand Down
12 changes: 12 additions & 0 deletions test/unit/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@ describe('config', () => {
expect(config.CI).toBe(process.env.CI === 'true');
});

test('resultParser option is used when provided', () => {
mockConfig.mockReturnValue({
...DEFAULT_CONFIGURATION,
CI: true,
resultParser: 'markdown',
});
const config = getConfig();

// Should use value from configuration, not default value resolved by CI flag
expect(config.resultParser).toBe('markdown');
});

test('pathIgnorePattern is constructed into RegExp', () => {
mockConfig.mockReturnValue({
...DEFAULT_CONFIGURATION,
Expand Down

0 comments on commit a4af9bb

Please sign in to comment.