Skip to content

Commit

Permalink
Continuation to jestjs#3771 for snake case file naming (jestjs#3920)
Browse files Browse the repository at this point in the history
* Resolved conflicts

* Including eslint file for forcing file names

* renaming files

* renaming files
  • Loading branch information
anilreddykatta authored and aaronabramov committed Jun 29, 2017
1 parent 5bfb144 commit 0a4ed7a
Show file tree
Hide file tree
Showing 116 changed files with 248 additions and 212 deletions.
28 changes: 19 additions & 9 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
module.exports = {
extends: [
'./packages/eslint-config-fb-strict/index.js',
'plugin:import/errors',
'plugin:import/errors'
],
parser: 'babel-eslint',
rules: {
Expand All @@ -20,15 +20,16 @@ module.exports = {
'max-len': 0,
'no-multiple-empty-lines': 1,
'import/no-duplicates': 2,
'import/no-unresolved': [2, { ignore: ['^types/'] }],
'import/no-unresolved': [2, {ignore: ['^types/']}],
// This has to be disabled until all type and module imports are combined
// https://github.com/benmosher/eslint-plugin-import/issues/645
'import/order': 0,
// These has to be disabled until the whole code base is converted to ESM
'import/default': 0,
'import/named': 0,
'unicorn/filename-case': [2, {case: 'snakeCase'}]
},
plugins: ['markdown', 'import'],
plugins: ['markdown', 'import', 'unicorn'],
overrides: [
// to make it more suitable for running on code examples in docs/ folder
{
Expand All @@ -43,22 +44,31 @@ module.exports = {
'no-unused-vars': 0,
'consistent-return': 0,
'import/no-unresolved': 0,
'sort-keys': 0
},
'sort-keys': 0,
'unicorn/filename-case': 0
}
},
{
files: ['examples/**/*'],
rules: {
'babel/func-params-comma-dangle': 0,
'import/order': 0,
'import/no-unresolved': [2, { 'ignore': ['^react-native$'] }]
},
'import/no-unresolved': [2, {ignore: ['^react-native$']}],
'unicorn/filename-case': 0
}
},
{
files: ['scripts/**/*', 'integration_tests/**/*'],
rules: {
'babel/func-params-comma-dangle': 0,
},
'unicorn/filename-case': 0
}
},
],
{
files: ['**/__mocks__/**/*', 'website/**/*', '**/jest-runtime/**/*', '**/src/Console*'],
rules: {
'unicorn/filename-case': 0
}
}
]
};
2 changes: 1 addition & 1 deletion examples/react-native/.flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ experimental.strict_type_args=true

munge_underscores=true

module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub'
module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'global_image_stub'
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'

suppress_type=$FlowIssue
Expand Down
File renamed without changes.
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"eslint-plugin-import": "^2.6.0",
"eslint-plugin-markdown": "^1.0.0-beta.6",
"eslint-plugin-react": "^7.1.0",
"eslint-plugin-unicorn": "^2.1.2",
"flow-bin": "^0.48.0",
"glob": "^7.1.1",
"graceful-fs": "^4.1.11",
Expand Down Expand Up @@ -114,7 +115,7 @@
"transform": {
"^.+\\.js$": "<rootDir>/packages/babel-jest"
},
"setupTestFrameworkScriptFile": "<rootDir>/testSetupFile.js",
"setupTestFrameworkScriptFile": "<rootDir>/test_setup_file.js",
"snapshotSerializers": [
"<rootDir>/packages/pretty-format/build/plugins/convert_ansi.js"
],
Expand All @@ -130,5 +131,6 @@
"testMatch": [
"**/*.test.js"
]
}
},
"dependencies": {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

const os = require('os');

const generateEmptyCoverage = require('../generateEmptyCoverage');
const generateEmptyCoverage = require('../generate_empty_coverage');

jest.mock('jest-runtime', () => {
const realRuntime = require.requireActual('jest-runtime');
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-cli/src/__tests__/search_source.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('SearchSource', () => {

beforeEach(() => {
Runtime = require('jest-runtime');
SearchSource = require('../SearchSource');
SearchSource = require('../search_source');
normalize = require('jest-config').normalize;
});

Expand Down Expand Up @@ -415,7 +415,7 @@ describe('SearchSource', () => {
});

it('returns empty search result if no related tests were found', () => {
const input = ['no tests.js'];
const input = ['no_tests.js'];
const data = searchSource.findRelatedTestsFromPattern(input);
expect(data.tests).toEqual([]);
});
Expand Down
10 changes: 5 additions & 5 deletions packages/jest-cli/src/__tests__/test_runner.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

'use strict';

const TestRunner = require('../TestRunner');
const TestWatcher = require('../TestWatcher');
const SummaryReporter = require('../reporters/SummaryReporter');
const TestRunner = require('../test_runner');
const TestWatcher = require('../test_watcher');
const SummaryReporter = require('../reporters/summary_reporter');

let workerFarmMock;

Expand All @@ -27,8 +27,8 @@ jest.mock('worker-farm', () => {
return mock;
});

jest.mock('../TestWorker', () => {});
jest.mock('../reporters/DefaultReporter');
jest.mock('../test_worker', () => {});
jest.mock('../reporters/default_reporter');

test('.addReporter() .removeReporter()', () => {
const runner = new TestRunner({}, {});
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-cli/src/__tests__/test_sequencer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jest.mock('fs');
const fs = require('fs');
const path = require('path');

const TestSequencer = require('../TestSequencer');
const TestSequencer = require('../test_sequencer');

const FAIL = 0;
const SUCCESS = 1;
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-cli/src/__tests__/watch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
'use strict';

const chalk = require('chalk');
const TestWatcher = require('../TestWatcher');
const TestWatcher = require('../test_watcher');
const {KEYS} = require('../constants');

const runJestMock = jest.fn();

jest.doMock('chalk', () => new chalk.constructor({enabled: false}));
jest.doMock(
'../runJest',
'../run_jest',
() =>
function() {
const args = Array.from(arguments);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jest.mock('ansi-escapes', () => ({
}));

jest.mock(
'../SearchSource',
'../search_source',
() =>
class {
constructor(context) {
Expand Down Expand Up @@ -68,7 +68,7 @@ jest.doMock('chalk', () =>
);

jest.doMock(
'../runJest',
'../run_jest',
() =>
function() {
const args = Array.from(arguments);
Expand All @@ -81,7 +81,7 @@ jest.doMock(
},
);

jest.doMock('../lib/terminalUtils', () => ({
jest.doMock('../lib/terminal_utils', () => ({
getTerminalWidth: () => terminalWidth,
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jest.mock('ansi-escapes', () => ({
}));

jest.mock(
'../SearchSource',
'../search_source',
() =>
class {
findMatchingTests(pattern) {
Expand All @@ -44,7 +44,7 @@ jest.doMock('chalk', () =>
);

jest.doMock(
'../runJest',
'../run_jest',
() =>
function() {
const args = Array.from(arguments);
Expand Down Expand Up @@ -95,7 +95,7 @@ jest.doMock(
},
);

jest.doMock('../lib/terminalUtils', () => ({
jest.doMock('../lib/terminal_utils', () => ({
getTerminalWidth: () => terminalWidth,
}));

Expand Down
File renamed without changes.
16 changes: 8 additions & 8 deletions packages/jest-cli/src/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ import {readConfig} from 'jest-config';
import {version as VERSION} from '../../package.json';
import args from './args';
import chalk from 'chalk';
import createContext from '../lib/createContext';
import getJest from './getJest';
import getMaxWorkers from '../lib/getMaxWorkers';
import handleDeprecationWarnings from '../lib/handleDeprecationWarnings';
import logDebugMessages from '../lib/logDebugMessages';
import preRunMessage from '../preRunMessage';
import runJest from '../runJest';
import createContext from '../lib/create_context';
import getJest from './get_jest';
import getMaxWorkers from '../lib/get_max_workers';
import handleDeprecationWarnings from '../lib/handle_deprecation_warnings';
import logDebugMessages from '../lib/log_debug_messages';
import preRunMessage from '../pre_run_message';
import runJest from '../run_jest';
import Runtime from 'jest-runtime';
import TestWatcher from '../TestWatcher';
import TestWatcher from '../test_watcher';
import watch from '../watch';
import yargs from 'yargs';

Expand Down
6 changes: 3 additions & 3 deletions packages/jest-cli/src/jest.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

import {version as VERSION} from '../package.json';

import SearchSource from './SearchSource';
import TestRunner from './TestRunner';
import TestWatcher from './TestWatcher';
import SearchSource from './search_source';
import TestRunner from './test_runner';
import TestWatcher from './test_watcher';
import {run, runCLI} from './cli';

module.exports = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

'use strict';

const formatTestNameByPattern = require('../formatTestNameByPattern');
const formatTestNameByPattern = require('../format_test_name_by_pattern');

describe('for multiline test name returns', () => {
const testNames = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @emails oncall+jsinfra
*/

const getMaxWorkers = require('../getMaxWorkers');
const getMaxWorkers = require('../get_max_workers');

jest.mock('os', () => ({
cpus: () => ({length: 4}),
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-cli/src/lib/__tests__/is_valid_path.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/

const path = require('path');
const isValidPath = require('../isValidPath');
const isValidPath = require('../is_valid_path');

const rootDir = path.resolve(path.sep, 'root');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

'use strict';

const logDebugMessages = require('../logDebugMessages');
const logDebugMessages = require('../log_debug_messages');

jest.mock('../../../package.json', () => ({version: 123}));

Expand Down
2 changes: 1 addition & 1 deletion packages/jest-cli/src/lib/__tests__/prompt.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
'use strict';

const Prompt = require('../Prompt');
const Prompt = require('../prompt');
let {KEYS} = require('../../constants');

KEYS = Object.assign({}, KEYS, {
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-cli/src/lib/__tests__/scroll_list.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const scroll = require('../scrollList');
const scroll = require('../scroll_list');

it('When offset is -1', () => {
expect(scroll(25, {max: 10, offset: -1})).toEqual({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
'use strict';

const validatePattern = require('../validatePattern');
const validatePattern = require('../validate_pattern');

describe('validate pattern function', () => {
it('without passed args returns true', () => {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
*/

import type {Argv} from 'types/Argv';
import type {TestSelectionConfig} from '../SearchSource';
import type {TestSelectionConfig} from '../search_source';

import {clearLine} from 'jest-util';
import chalk from 'chalk';
import validatePattern from './validatePattern';
import validatePattern from './validate_pattern';

const DEFAULT_PATTERN_INFO = {
input: '',
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import chalk from 'chalk';
import ansiEscapes from 'ansi-escapes';
import stringLength from 'string-length';
import Prompt from './Prompt';
import Prompt from './prompt';

const pluralize = (count: number, text: string) =>
count === 1 ? text : text + 's';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @flow
*/

import type {ScrollOptions} from './scrollList';
import type {ScrollOptions} from './scroll_list';

import {KEYS} from '../constants';

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import type {Argv} from 'types/Argv';

import getTestPathPattern from './getTestPathPattern';
import getTestPathPattern from './get_test_path_pattern';

type Options = {|
testNamePattern?: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

'use strict';

import type {ScrollOptions} from './lib/scrollList';
import type {ScrollOptions} from './lib/scroll_list';

import chalk from 'chalk';
import ansiEscapes from 'ansi-escapes';
import Prompt from './lib/Prompt';
import Prompt from './lib/prompt';

const usage = (entity: string) =>
`\n${chalk.bold('Pattern Mode Usage')}\n` +
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ beforeEach(() => {
write: jest.fn(),
}));

CoverageReporter = require('../CoverageReporter');
CoverageReporter = require('../coverage_reporter');
libCoverage = require('istanbul-lib-coverage');
libSourceMaps = require('istanbul-lib-source-maps');
});
Expand Down
Loading

0 comments on commit 0a4ed7a

Please sign in to comment.