Skip to content

Commit

Permalink
Standardize file names in integration-tests (#5513)
Browse files Browse the repository at this point in the history
* standardize file names in integration-tests

- updated tests
- added to changelog

* remove filename lint rule since multiple styles are not supported

* remove unicorn completely
  • Loading branch information
Michael Baldwin authored and cpojer committed Feb 14, 2018
1 parent 4ca959b commit 10276f9
Show file tree
Hide file tree
Showing 97 changed files with 116 additions and 199 deletions.
30 changes: 1 addition & 29 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ module.exports = {
'react/jsx-no-undef': 0,
'react/react-in-jsx-scope': 0,
'sort-keys': 0,
'unicorn/filename-case': 0,
},
},
{
Expand All @@ -42,44 +41,18 @@ module.exports = {
'babel/func-params-comma-dangle': 0,
'import/no-unresolved': [2, {ignore: ['^react-native$']}],
'import/order': 0,
'unicorn/filename-case': 0,
},
},
{
files: ['scripts/**/*', 'integration-tests/**/*'],
rules: {
'babel/func-params-comma-dangle': 0,
'unicorn/filename-case': 0,
},
},
{
files: 'types/**/*',
rules: {
'import/no-extraneous-dependencies': 0,
'unicorn/filename-case': 0,
},
},
{
files: [
'**/__mocks__/**/*',
'website/**/*',
'**/jest-runtime/**/*',
'**/src/Console*',
'packages/jest-cli/src/lib/Prompt.js',
'packages/jest-cli/src/reporters/Status.js',
'packages/jest-editor-support/src/Process.js',
'packages/jest-editor-support/src/Runner.js',
'packages/jest-editor-support/src/Settings.js',
'packages/jest-editor-support/src/Snapshot.js',
'packages/jest-editor-support/src/__tests__/Snapshot-test.js',
'packages/jest-jasmine2/src/jasmine/Env.js',
'packages/jest-jasmine2/src/jasmine/Spec.js',
'packages/jest-jasmine2/src/jasmine/Suite.js',
'packages/jest-jasmine2/src/jasmine/Timer.js',
'packages/jest-snapshot/src/State.js',
],
rules: {
'unicorn/filename-case': 0,
},
},
{
Expand Down Expand Up @@ -136,7 +109,7 @@ module.exports = {
},
],
parser: 'babel-eslint',
plugins: ['markdown', 'import', 'unicorn', 'prettier'],
plugins: ['markdown', 'import', 'prettier'],
rules: {
'flowtype/boolean-style': 2,
'flowtype/no-primitive-constructor-types': 2,
Expand Down Expand Up @@ -168,7 +141,6 @@ module.exports = {
trailingComma: 'all',
},
],
'unicorn/filename-case': [1, {case: 'snakeCase'}],
},
settings: {
'import/resolver': {
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

* `[jest-config]` Allow `<rootDir>` to be used with `collectCoverageFrom`
([#5524](https://github.com/facebook/jest/pull/5524))
* `[filenames]` Standardize files names in "integration-tests" folder ([#5513](https://github.com/facebook/jest/pull/5513))


## jest 22.2.2

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ File | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines |
---------------|----------|----------|----------|----------|----------------|
All files | 100 | 100 | 100 | 100 | |
a | 100 | 100 | 100 | 100 | |
identical.js | 100 | 100 | 100 | 100 | |
Identical.js | 100 | 100 | 100 | 100 | |
b | 100 | 100 | 100 | 100 | |
identical.js | 100 | 100 | 100 | 100 | |
Identical.js | 100 | 100 | 100 | 100 | |
---------------|----------|----------|----------|----------|----------------|
"
`;

exports[`collects coverage only from multiple specified files 1`] = `
"---------------|----------|----------|----------|----------|----------------|
File | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines |
---------------|----------|----------|----------|----------|----------------|
All files | 100 | 100 | 100 | 100 | |
other-file.js | 100 | 100 | 100 | 100 | |
setup.js | 100 | 100 | 100 | 100 | |
---------------|----------|----------|----------|----------|----------------|
"--------------|----------|----------|----------|----------|----------------|
File | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines |
--------------|----------|----------|----------|----------|----------------|
All files | 100 | 100 | 100 | 100 | |
OtherFile.js | 100 | 100 | 100 | 100 | |
setup.js | 100 | 100 | 100 | 100 | |
--------------|----------|----------|----------|----------|----------------|
"
`;

Expand All @@ -39,7 +39,7 @@ exports[`collects coverage only from specified files avoiding dependencies 1`] =
File | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines |
----------|----------|----------|----------|----------|----------------|
All files | 85.71 | 100 | 50 | 85.71 | |
sum.js | 85.71 | 100 | 50 | 85.71 | 12 |
Sum.js | 85.71 | 100 | 50 | 85.71 | 12 |
----------|----------|----------|----------|----------|----------------|
"
`;
Expand All @@ -59,14 +59,14 @@ File | % Stmts | % Branch | % Funcs | % Lines
-------------------------------------|----------|----------|----------|----------|----------------|
All files | 56.52 | 0 | 50 | 56.52 | |
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 |
OtherFile.js | 100 | 100 | 100 | 100 | |
Sum.js | 85.71 | 100 | 50 | 85.71 | 12 |
SumDependency.js | 0 | 0 | 0 | 0 | 8,10,11,14 |
notRequiredInTestSuite.js | 0 | 0 | 0 | 0 | 8,15,16,17,19 |
coverage-report/cached-duplicates/a | 100 | 100 | 100 | 100 | |
identical.js | 100 | 100 | 100 | 100 | |
Identical.js | 100 | 100 | 100 | 100 | |
coverage-report/cached-duplicates/b | 100 | 100 | 100 | 100 | |
identical.js | 100 | 100 | 100 | 100 | |
Identical.js | 100 | 100 | 100 | 100 | |
-------------------------------------|----------|----------|----------|----------|----------------|
"
`;
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ exports[`babel-jest instruments only specific files and collects coverage 1`] =
File | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines |
------------|----------|----------|----------|----------|----------------|
All files | 83.33 | 100 | 50 | 83.33 | |
covered.js | 83.33 | 100 | 50 | 83.33 | 15 |
Covered.js | 83.33 | 100 | 50 | 83.33 | 15 |
------------|----------|----------|----------|----------|----------------|
"
`;
Expand All @@ -24,7 +24,7 @@ exports[`no babel-jest instrumentation with no babel-jest 1`] = `
File | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines |
------------|----------|----------|----------|----------|----------------|
All files | 83.33 | 100 | 50 | 83.33 | |
covered.js | 83.33 | 100 | 50 | 83.33 | 15 |
Covered.js | 83.33 | 100 | 50 | 83.33 | 15 |
------------|----------|----------|----------|----------|----------------|
"
`;
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'use strict';

const path = require('path');
const {run} = require('../utils');
const {run} = require('../Utils');
const runJest = require('../runJest');

const DIR = path.resolve(__dirname, '..', 'babel-plugin-jest-hoist');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

const path = require('path');
const SkipOnWindows = require('../../scripts/SkipOnWindows');
const {extractSummary, cleanup, writeFiles} = require('../utils');
const {extractSummary, cleanup, writeFiles} = require('../Utils');
const runJest = require('../runJest');

const DIR = path.resolve(__dirname, '../cli_accepts_exact_filenames');
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/__tests__/console.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
'use strict';

const SkipOnWindows = require('../../scripts/SkipOnWindows');
const {extractSummary} = require('../utils');
const {extractSummary} = require('../Utils');
const runJest = require('../runJest');

SkipOnWindows.suite();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

const path = require('path');
const SkipOnWindows = require('../../scripts/SkipOnWindows');
const {extractSummary, cleanup, writeFiles} = require('../utils');
const {extractSummary, cleanup, writeFiles} = require('../Utils');
const runJest = require('../runJest');

const DIR = path.resolve(__dirname, '../console_log_output_when_run_in_band');
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/__tests__/coverage_remapping.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
const {readFileSync} = require('fs');
const path = require('path');
const SkipOnWindows = require('../../scripts/SkipOnWindows');
const {cleanup, run} = require('../utils');
const {cleanup, run} = require('../Utils');
const runJest = require('../runJest');

const dir = path.resolve(__dirname, '../coverage-remapping');
Expand Down
18 changes: 9 additions & 9 deletions integration-tests/__tests__/coverage_report.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
const fs = require('fs');
const path = require('path');
const SkipOnWindows = require('../../scripts/SkipOnWindows');
const {extractSummary} = require('../utils');
const {extractSummary} = require('../Utils');
const runJest = require('../runJest');

const DIR = path.resolve(__dirname, '../coverage-report');
Expand All @@ -23,9 +23,9 @@ test('outputs coverage report', () => {
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
// - `SumDependency.js` is mocked and the real module is never required but
// is listed with 0 % coverage.
// - `not-required-in-test-suite.js` is not required but it is listed
// - `notRequiredInTestSuite.js` is not required but it is listed
// with 0 % coverage.
expect(stdout).toMatchSnapshot();

Expand All @@ -51,7 +51,7 @@ test('collects coverage only from multiple specified files', () => {
'--coverage',
'--collectCoverageFrom', // overwrites the one in package.json
'setup.js',
'other-file.js',
'OtherFile.js',
]);

expect(stdout).toMatchSnapshot();
Expand All @@ -62,9 +62,9 @@ test('collects coverage only from specified files avoiding dependencies', () =>
'--no-cache',
'--coverage',
'--collectCoverageOnlyFrom',
'sum.js',
'Sum.js',
'--',
'sum.test.js',
'Sum.test.js',
]);

// Coverage report should only have `sum.js` coverage info
Expand Down Expand Up @@ -98,11 +98,11 @@ test('collects coverage from duplicate files avoiding shared cache', () => {
'--coverageThreshold',
'{"global": {"lines": 100}}',
'--collectCoverageOnlyFrom',
'cached-duplicates/a/identical.js',
'cached-duplicates/a/Identical.js',
'--collectCoverageOnlyFrom',
'cached-duplicates/b/identical.js',
'cached-duplicates/b/Identical.js',
'--',
'identical.test.js',
'Identical.test.js',
];
// Run once to prime the cache
runJest(DIR, args);
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/__tests__/coverage_threshold.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

const path = require('path');
const SkipOnWindows = require('../../scripts/SkipOnWindows');
const {cleanup, writeFiles} = require('../utils');
const {cleanup, writeFiles} = require('../Utils');
const runJest = require('../runJest');

const DIR = path.resolve(__dirname, '../coverage-threshold');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'use strict';

const runJest = require('../runJest');
const {extractSummary} = require('../utils');
const {extractSummary} = require('../Utils');
const SkipOnWindows = require('../../scripts/SkipOnWindows');

SkipOnWindows.suite();
Expand Down
13 changes: 5 additions & 8 deletions integration-tests/__tests__/custom_reporters.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'use strict';

const SkipOnWindows = require('../../scripts/SkipOnWindows');
const {cleanup, extractSummary, writeFiles} = require('../utils');
const {cleanup, extractSummary, writeFiles} = require('../Utils');
const runJest = require('../runJest');
const os = require('os');
const path = require('path');
Expand All @@ -24,7 +24,7 @@ describe('Custom Reporters Integration', () => {

test('valid string format for adding reporters', () => {
const reporterConfig = {
reporters: ['<rootDir>/reporters/test_reporter.js'],
reporters: ['<rootDir>/reporters/TestReporter.js'],
};

const {status} = runJest('custom-reporters', [
Expand All @@ -39,10 +39,7 @@ describe('Custom Reporters Integration', () => {
test('valid array format for adding reporters', () => {
const reporterConfig = {
reporters: [
[
'<rootDir>/reporters/test_reporter.js',
{'Dmitrii Abramov': 'Awesome'},
],
['<rootDir>/reporters/TestReporter.js', {'Dmitrii Abramov': 'Awesome'}],
],
};

Expand Down Expand Up @@ -75,7 +72,7 @@ describe('Custom Reporters Integration', () => {
const {stderr, stdout, status} = runJest('custom-reporters', [
'--config',
JSON.stringify({
reporters: ['default', '<rootDir>/reporters/test_reporter.js'],
reporters: ['default', '<rootDir>/reporters/TestReporter.js'],
}),
'add.test.js',
]);
Expand Down Expand Up @@ -118,7 +115,7 @@ describe('Custom Reporters Integration', () => {
'--no-cache',
'--config',
JSON.stringify({
reporters: ['<rootDir>/reporters/incomplete_reporter.js'],
reporters: ['<rootDir>/reporters/IncompleteReporter.js'],
}),
'add.test.js',
]);
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/__tests__/execute-tests-once-in-mpr.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

const path = require('path');
const SkipOnWindows = require('../../scripts/SkipOnWindows');
const {extractSummary, cleanup, writeFiles} = require('../utils');
const {extractSummary, cleanup, writeFiles} = require('../Utils');
const runJest = require('../runJest');

const DIR = path.resolve(__dirname, '../execute-tests-once-in-mpr');
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/__tests__/failures.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

const path = require('path');
const SkipOnWindows = require('../../scripts/SkipOnWindows');
const {extractSummary} = require('../utils');
const {extractSummary} = require('../Utils');
const runJest = require('../runJest');

const dir = path.resolve(__dirname, '../failures');
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/__tests__/find_related_files.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import runJest from '../runJest';
import os from 'os';
import path from 'path';

const {cleanup, writeFiles} = require('../utils');
const {cleanup, writeFiles} = require('../Utils');

const SkipOnWindows = require('../../scripts/SkipOnWindows');
const DIR = path.resolve(os.tmpdir(), 'find_related_tests_test');
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/__tests__/force_exit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import runJest from '../runJest';
import os from 'os';
import path from 'path';
const {cleanup, writeFiles} = require('../utils');
const {cleanup, writeFiles} = require('../Utils');

const SkipOnWindows = require('../../scripts/SkipOnWindows');
const DIR = path.resolve(os.tmpdir(), 'force_exit_test');
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/__tests__/global_setup.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const fs = require('fs');
const os = require('os');
const path = require('path');
const runJest = require('../runJest');
const {cleanup} = require('../utils');
const {cleanup} = require('../Utils');

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

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/__tests__/global_teardown.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const mkdirp = require('mkdirp');
const os = require('os');
const path = require('path');
const runJest = require('../runJest');
const {cleanup} = require('../utils');
const {cleanup} = require('../Utils');

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

Expand Down
4 changes: 2 additions & 2 deletions integration-tests/__tests__/globals.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const path = require('path');
const os = require('os');
const SkipOnWindows = require('../../scripts/SkipOnWindows');
const runJest = require('../runJest');
const {extractSummary} = require('../utils');
const {createEmptyPackage, writeFiles, cleanup} = require('../utils');
const {extractSummary} = require('../Utils');
const {createEmptyPackage, writeFiles, cleanup} = require('../Utils');

const DIR = path.resolve(os.tmpdir(), 'global-variables.test');
const TEST_DIR = path.resolve(DIR, '__tests__');
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/__tests__/jest.config.js.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

const path = require('path');
const SkipOnWindows = require('../../scripts/SkipOnWindows');
const {extractSummary, cleanup, writeFiles} = require('../utils');
const {extractSummary, cleanup, writeFiles} = require('../Utils');
const runJest = require('../runJest');

const DIR = path.resolve(__dirname, '../jest.config.js');
Expand Down
Loading

0 comments on commit 10276f9

Please sign in to comment.