Skip to content

Commit

Permalink
Standardize file names: Fix integration folder names (#5298)
Browse files Browse the repository at this point in the history
* chore(filenames): use dash for integration_tests/

* chore(filenames): fix intergration-tests subfolders

Fixes all the folder names in the integration-tests folder to follow Facebook internal file / folder
naming conventions. This is the first of several incremental PRs.
  • Loading branch information
jamischarles authored and cpojer committed Jan 14, 2018
1 parent 09e47d6 commit 0580b5b
Show file tree
Hide file tree
Showing 386 changed files with 105 additions and 99 deletions.
10 changes: 5 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ module.exports = {
},
},
{
files: ['scripts/**/*', 'integration_tests/**/*'],
files: ['scripts/**/*', 'integration-tests/**/*'],
rules: {
'babel/func-params-comma-dangle': 0,
'unicorn/filename-case': 0,
Expand Down Expand Up @@ -83,11 +83,11 @@ module.exports = {
},
},
{
excludedFiles: 'integration_tests/__tests__/**/*',
excludedFiles: 'integration-tests/__tests__/**/*',
files: [
'examples/**/*',
'scripts/**/*',
'integration_tests/*/**/*',
'integration-tests/*/**/*',
'website/*/**/*',
'eslint_import_resolver.js',
],
Expand All @@ -105,7 +105,7 @@ module.exports = {
},
{
files: [
'integration_tests/__tests__/**/*',
'integration-tests/__tests__/**/*',
'packages/babel-jest/**/*.test.js',
'packages/babel-plugin-jest-hoist/**/*.test.js',
'packages/babel-preset-jest/**/*.test.js',
Expand All @@ -127,7 +127,7 @@ module.exports = {
files: [
'website/**',
'**/__tests__/**',
'integration_tests/**',
'integration-tests/**',
'**/pretty-format/perf/**',
],
rules: {
Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
*~
/examples/*/node_modules/

/integration_tests/*/node_modules
/integration_tests/transform/*/coverage
/integration_tests/transform/*/node_modules
/integration-tests/*/node_modules
/integration-tests/transform/*/coverage
/integration-tests/transform/*/node_modules

/node_modules

Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
the case of `--lastCommit`, `--findRelatedTests`, or `--onlyChanged` options
having been passed to the CLI

### Chore & Maintenance

* `[filenames]` Standardize folder names under `integration-tests/`
([#5298](https://github.com/facebook/jest/pull/5298))


## jest 22.0.6

### Fixes
Expand Down
2 changes: 1 addition & 1 deletion docs/SnapshotTesting.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ serializable value and should be used anytime the goal is testing whether the
output is correct. The Jest repository contains many examples of testing the
output of Jest itself, the output of Jest's assertion library as well as log
messages from various parts of the Jest codebase. See an example of
[snapshotting CLI output](https://github.com/facebook/jest/blob/master/integration_tests/__tests__/console.test.js)
[snapshotting CLI output](https://github.com/facebook/jest/blob/master/integration-tests/__tests__/console.test.js)
in the Jest repo.

### What's the difference between snapshot testing and visual regression testing?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ exports[`outputs coverage report 1`] = `
File | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines |
-------------------------------------|----------|----------|----------|----------|----------------|
All files | 56.52 | 0 | 50 | 56.52 | |
coverage_report | 41.18 | 0 | 25 | 41.18 | |
coverage-report | 41.18 | 0 | 25 | 41.18 | |
not-required-in-test-suite.js | 0 | 0 | 0 | 0 | 8,15,16,17,19 |
other-file.js | 100 | 100 | 100 | 100 | |
sum.js | 85.71 | 100 | 50 | 85.71 | 12 |
sum_dependency.js | 0 | 0 | 0 | 0 | 8,10,11,14 |
coverage_report/cached-duplicates/a | 100 | 100 | 100 | 100 | |
coverage-report/cached-duplicates/a | 100 | 100 | 100 | 100 | |
identical.js | 100 | 100 | 100 | 100 | |
coverage_report/cached-duplicates/b | 100 | 100 | 100 | 100 | |
coverage-report/cached-duplicates/b | 100 | 100 | 100 | 100 | |
identical.js | 100 | 100 | 100 | 100 | |
-------------------------------------|----------|----------|----------|----------|----------------|
"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

exports[`--listTests flag causes tests to be printed in different lines 1`] = `
"
/MOCK_ABOLUTE_PATH/integration_tests/list_tests/__tests__/dummy.test.js
/MOCK_ABOLUTE_PATH/integration_tests/list_tests/__tests__/other.test.js"
/MOCK_ABOLUTE_PATH/integration-tests/list-tests/__tests__/dummy.test.js
/MOCK_ABOLUTE_PATH/integration-tests/list-tests/__tests__/other.test.js"
`;

exports[`--listTests flag causes tests to be printed out as JSON when using the --json flag 1`] = `"[\\"/MOCK_ABOLUTE_PATH/integration_tests/list_tests/__tests__/dummy.test.js\\",\\"/MOCK_ABOLUTE_PATH/integration_tests/list_tests/__tests__/other.test.js\\"]"`;
exports[`--listTests flag causes tests to be printed out as JSON when using the --json flag 1`] = `"[\\"/MOCK_ABOLUTE_PATH/integration-tests/list-tests/__tests__/dummy.test.js\\",\\"/MOCK_ABOLUTE_PATH/integration-tests/list-tests/__tests__/other.test.js\\"]"`;
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ const os = require('os');
const path = require('path');
const runJest = require('../runJest');

const CACHE = path.resolve(os.tmpdir(), 'clear_cache_directory');
const CACHE = path.resolve(os.tmpdir(), 'clear-cache-directory');

describe('jest --clearCache', () => {
test('normal run results in cache directory being written', () => {
const {status} = runJest('clear_cache', [`--cacheDirectory=${CACHE}`]);
const {status} = runJest('clear-cache', [`--cacheDirectory=${CACHE}`]);

expect(fs.existsSync(CACHE)).toBe(true);
expect(status).toBe(0);
});
test('clearCache results in deleted directory and exit status 0', () => {
expect(fs.existsSync(CACHE)).toBe(true);

const {status, stdout, stderr} = runJest('clear_cache', [
const {status, stdout, stderr} = runJest('clear-cache', [
'--clearCache',
`--cacheDirectory=${CACHE}`,
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
const runJest = require('../runJest');

test('config as JSON', () => {
const result = runJest('verbose_reporter', [
const result = runJest('verbose-reporter', [
'--config=' +
JSON.stringify({
testEnvironment: 'node',
Expand All @@ -25,7 +25,7 @@ test('config as JSON', () => {
});

test('works with sane config JSON', () => {
const result = runJest('verbose_reporter', [
const result = runJest('verbose-reporter', [
'--config=' +
JSON.stringify({
testEnvironment: 'node',
Expand All @@ -38,7 +38,7 @@ test('works with sane config JSON', () => {
});

test('watchman config option is respected over default argv', () => {
const {stdout} = runJest('verbose_reporter', [
const {stdout} = runJest('verbose-reporter', [
'--env=node',
'--watchman=false',
'--debug',
Expand All @@ -48,7 +48,7 @@ test('watchman config option is respected over default argv', () => {
});

test('config from argv is respected with sane config JSON', () => {
const {stdout} = runJest('verbose_reporter', [
const {stdout} = runJest('verbose-reporter', [
'--config=' +
JSON.stringify({
testEnvironment: 'node',
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ const skipOnWindows = require('../../scripts/skip_on_windows');
const {extractSummary} = require('../utils');
const runJest = require('../runJest');

const DIR = path.resolve(__dirname, '../coverage_report');
const DIR = path.resolve(__dirname, '../coverage-report');

skipOnWindows.suite();

test('outputs coverage report', () => {
const {stdout, status} = runJest(DIR, ['--no-cache', '--coverage']);
const coverageDir = path.resolve(__dirname, '../coverage_report/coverage');
const coverageDir = path.resolve(__dirname, '../coverage-report/coverage');

// - the `setup.js` file is ignored and should not be in the coverage report.
// - `sum_dependency.js` is mocked and the real module is never required but
Expand Down Expand Up @@ -60,7 +60,7 @@ test('collects coverage only from specified files avoiding dependencies', () =>
});

test('json reporter printing with --coverage', () => {
const {stderr, status} = runJest('json_reporter', ['--coverage']);
const {stderr, status} = runJest('json-reporter', ['--coverage']);
const {summary} = extractSummary(stderr);
expect(status).toBe(1);
expect(summary).toMatchSnapshot();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const skipOnWindows = require('../../scripts/skip_on_windows');
skipOnWindows.suite();

test('works with custom matchers', () => {
const {stderr} = runJest('custom_matcher_stack_trace');
const {stderr} = runJest('custom-matcher-stack-trace');

let {rest} = extractSummary(stderr);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const runJest = require('../runJest');
const os = require('os');
const path = require('path');

const DIR = path.resolve(os.tmpdir(), 'custom_reporters_test_dir');
const DIR = path.resolve(os.tmpdir(), 'custom-reporters-test-dir');

beforeEach(() => cleanup(DIR));
afterEach(() => cleanup(DIR));
Expand All @@ -27,7 +27,7 @@ describe('Custom Reporters Integration', () => {
reporters: ['<rootDir>/reporters/test_reporter.js'],
};

const {status} = runJest('custom_reporters', [
const {status} = runJest('custom-reporters', [
'--config',
JSON.stringify(reporterConfig),
'add.test.js',
Expand All @@ -46,7 +46,7 @@ describe('Custom Reporters Integration', () => {
],
};

const {status, stdout} = runJest('custom_reporters', [
const {status, stdout} = runJest('custom-reporters', [
'--config',
JSON.stringify(reporterConfig),
'add.test.js',
Expand All @@ -61,7 +61,7 @@ describe('Custom Reporters Integration', () => {
reporters: [[3243242]],
};

const {status, stderr} = runJest('custom_reporters', [
const {status, stderr} = runJest('custom-reporters', [
'--config',
JSON.stringify(reporterConfig),
'add.test.js',
Expand All @@ -72,7 +72,7 @@ describe('Custom Reporters Integration', () => {
});

test('default reporters enabled', () => {
const {stderr, stdout, status} = runJest('custom_reporters', [
const {stderr, stdout, status} = runJest('custom-reporters', [
'--config',
JSON.stringify({
reporters: ['default', '<rootDir>/reporters/test_reporter.js'],
Expand All @@ -90,7 +90,7 @@ describe('Custom Reporters Integration', () => {
});

test('TestReporter with all tests passing', () => {
const {stdout, status, stderr} = runJest('custom_reporters', [
const {stdout, status, stderr} = runJest('custom-reporters', [
'add.test.js',
]);

Expand All @@ -102,7 +102,7 @@ describe('Custom Reporters Integration', () => {
});

test('TestReporter with all tests failing', () => {
const {stdout, status, stderr} = runJest('custom_reporters', [
const {stdout, status, stderr} = runJest('custom-reporters', [
'add_fail.test.js',
]);

Expand All @@ -114,7 +114,7 @@ describe('Custom Reporters Integration', () => {
});

test('IncompleteReporter for flexibility', () => {
const {stderr, stdout, status} = runJest('custom_reporters', [
const {stderr, stdout, status} = runJest('custom-reporters', [
'--no-cache',
'--config',
JSON.stringify({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const runJest = require('../runJest');
describe('jest --debug', () => {
skipOnWindows.suite();

const dir = path.resolve(__dirname, '..', 'verbose_reporter');
const dir = path.resolve(__dirname, '..', 'verbose-reporter');

it('outputs debugging info before running the test', () => {
const {stdout} = runJest(dir, ['--debug', '--no-cache']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
const path = require('path');
const runJest = require('../runJest');

const DIR = path.resolve(__dirname, '../empty_suite_error');
const DIR = path.resolve(__dirname, '../empty-suite-error');

describe('JSON Reporter', () => {
it('fails the test suite if it contains no tests', () => {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ const path = require('path');
const runJest = require('../runJest');
const {cleanup} = require('../utils');

const DIR = path.join(os.tmpdir(), 'jest_global_setup');
const DIR = path.join(os.tmpdir(), 'jest-global-setup');

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

test('globalSetup is triggered once before all test suites', () => {
const setupPath = path.resolve(__dirname, '../global_setup/setup.js');
const result = runJest.json('global_setup', [`--globalSetup=${setupPath}`]);
const setupPath = path.resolve(__dirname, '../global-setup/setup.js');
const result = runJest.json('global-setup', [`--globalSetup=${setupPath}`]);
expect(result.status).toBe(0);
const files = fs.readdirSync(DIR);
expect(files).toHaveLength(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const path = require('path');
const runJest = require('../runJest');
const {cleanup} = require('../utils');

const DIR = path.join(os.tmpdir(), 'jest_global_teardown');
const DIR = path.join(os.tmpdir(), 'jest-global-teardown');

beforeEach(() => cleanup(DIR));
afterAll(() => cleanup(DIR));
Expand All @@ -23,9 +23,9 @@ test('globalTeardown is triggered once after all test suites', () => {
mkdirp.sync(DIR);
const teardownPath = path.resolve(
__dirname,
'../global_teardown/teardown.js',
'../global-teardown/teardown.js',
);
const result = runJest.json('global_teardown', [
const result = runJest.json('global-teardown', [
`--globalTeardown=${teardownPath}`,
]);
expect(result.status).toBe(0);
Expand Down
File renamed without changes.
Loading

0 comments on commit 0580b5b

Please sign in to comment.