Skip to content

Commit

Permalink
testPathPattern message test (jestjs#4006)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronabramov authored Jul 11, 2017
1 parent 24e773c commit 3b9da7b
Showing 1 changed file with 44 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/

'use strict';

import runJest from '../runJest';
import {cleanup, writeFiles} from '../utils';
import os from 'os';
import path from 'path';

const skipOnWindows = require('skipOnWindows');
const DIR = path.resolve(os.tmpdir(), 'jest_path_pattern_reporter_message');

skipOnWindows.suite();

beforeEach(() => cleanup(DIR));
afterEach(() => cleanup(DIR));

test('prints a message with path pattern at the end', () => {
writeFiles(DIR, {
'.watchmanconfig': '',
'__tests__/a.test.js': `test('a', () => {});`,
'__tests__/b.test.js': `test('b', () => {});`,
'package.json': '{}',
});
let stderr;

({stderr} = runJest(DIR, ['a']));
expect(stderr).toMatch('Ran all test suites matching "a"');

({stderr} = runJest(DIR, ['a', 'b']));
expect(stderr).toMatch('Ran all test suites matching /a|b/');

({stderr} = runJest(DIR, ['--testPathPattern', 'a']));
expect(stderr).toMatch('Ran all test suites matching /a/');

({stderr} = runJest(DIR, ['--testPathPattern', 'a|b']));
expect(stderr).toMatch('Ran all test suites matching /a|b/');
});

0 comments on commit 3b9da7b

Please sign in to comment.