diff --git a/CHANGELOG.md b/CHANGELOG.md index 452deb95efe1..257e66b24706 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -107,6 +107,8 @@ - `[docs]` Add correct default value for `testUrl` config option ([#7277](https://github.com/facebook/jest/pull/7277)) - `[jest-util]` [**BREAKING**] Remove long-deprecated globals for fake timers ([#7285](https://github.com/facebook/jest/pull/7285)) - `[docs]` Remove duplicate code in `MockFunctions` ([#7297](https://github.com/facebook/jest/pull/7297)) +- `[jest-worker]` Standardize filenames ([#7316](https://github.com/facebook/jest/pull/7316)) +- `[pretty-format]` Standardize filenames ([#7316](https://github.com/facebook/jest/pull/7316)) ### Performance diff --git a/jest.config.js b/jest.config.js index 9c16175c878b..9a7e9b0808ce 100644 --- a/jest.config.js +++ b/jest.config.js @@ -25,7 +25,7 @@ module.exports = { projects: ['', '/examples/*/'], setupFilesAfterEnv: ['/testSetupFile.js'], snapshotSerializers: [ - '/packages/pretty-format/build/plugins/convert_ansi.js', + '/packages/pretty-format/build/plugins/ConvertAnsi.js', ], testEnvironment: './packages/jest-environment-node', testPathIgnorePatterns: [ @@ -35,7 +35,7 @@ module.exports = { '\\.snap$', '/packages/.*/build', '/packages/.*/build-es5', - '/packages/.*/src/__tests__/expect_util.js', + '/packages/.*/src/__tests__/getPrettyPrint.js', '/packages/jest-cli/src/__tests__/test_root', '/packages/jest-cli/src/__tests__/__fixtures__/', '/packages/jest-cli/src/lib/__tests__/fixtures/', diff --git a/packages/jest-worker/README.md b/packages/jest-worker/README.md index 5087287be92a..3c98dfdb2b5e 100644 --- a/packages/jest-worker/README.md +++ b/packages/jest-worker/README.md @@ -24,7 +24,7 @@ This example covers the minimal usage: import Worker from 'jest-worker'; async function main() { - const worker = new Worker(require.resolve('./worker')); + const worker = new Worker(require.resolve('./Worker')); const result = await worker.hello('Alice'); // "Hello, Alice" } @@ -114,7 +114,7 @@ This example covers the standard usage: import Worker from 'jest-worker'; async function main() { - const myWorker = new Worker(require.resolve('./worker'), { + const myWorker = new Worker(require.resolve('./Worker'), { exposedMethods: ['foo', 'bar', 'getWorkerId'], numWorkers: 4, }); @@ -155,7 +155,7 @@ This example covers the usage with a `computeWorkerKey` method: import Worker from 'jest-worker'; async function main() { - const myWorker = new Worker(require.resolve('./worker'), { + const myWorker = new Worker(require.resolve('./Worker'), { computeWorkerKey: (method, filename) => filename, }); diff --git a/packages/jest-worker/src/worker.js b/packages/jest-worker/src/Worker.js similarity index 100% rename from packages/jest-worker/src/worker.js rename to packages/jest-worker/src/Worker.js diff --git a/packages/jest-worker/src/__tests__/worker.test.js b/packages/jest-worker/src/__tests__/Worker.test.js similarity index 99% rename from packages/jest-worker/src/__tests__/worker.test.js rename to packages/jest-worker/src/__tests__/Worker.test.js index 4fd91d9e3de6..cad8347df5b9 100644 --- a/packages/jest-worker/src/__tests__/worker.test.js +++ b/packages/jest-worker/src/__tests__/Worker.test.js @@ -38,7 +38,7 @@ beforeEach(() => { return forkInterface; }); - Worker = require('../worker').default; + Worker = require('../Worker').default; }); afterEach(() => { diff --git a/packages/jest-worker/src/__tests__/index.test.js b/packages/jest-worker/src/__tests__/index.test.js index 349a91797b5f..ba49151b6ec2 100644 --- a/packages/jest-worker/src/__tests__/index.test.js +++ b/packages/jest-worker/src/__tests__/index.test.js @@ -30,7 +30,7 @@ beforeEach(() => { // The worker mock returns a worker with custom methods, plus it stores them // in a global list, so that they can be accessed later. This list is reset in // every test. - jest.mock('../worker', () => { + jest.mock('../Worker', () => { const fakeClass = jest.fn(() => { const fakeWorker = { getStderr: () => ({once() {}, pipe() {}}), @@ -63,7 +63,7 @@ beforeEach(() => { virtual: true, }); - Worker = require('../worker').default; + Worker = require('../Worker').default; Farm = require('../index').default; }); diff --git a/packages/jest-worker/src/index.js b/packages/jest-worker/src/index.js index 0cb636c2fc6c..be634f2fecbd 100644 --- a/packages/jest-worker/src/index.js +++ b/packages/jest-worker/src/index.js @@ -17,7 +17,7 @@ import type {FarmOptions} from './types'; import type {Readable} from 'stream'; import {CHILD_MESSAGE_CALL, CHILD_MESSAGE_END} from './types'; -import Worker from './worker'; +import Worker from './Worker'; /* istanbul ignore next */ const emptyMethod = () => {}; diff --git a/packages/jest-worker/src/types.js b/packages/jest-worker/src/types.js index a8afc71f9f58..5d7108f9fb30 100644 --- a/packages/jest-worker/src/types.js +++ b/packages/jest-worker/src/types.js @@ -29,7 +29,7 @@ export type PARENT_MESSAGE_ERROR = // Option objects. -import type Worker from './worker'; +import type Worker from './Worker'; export type ForkOptions = { cwd?: string, diff --git a/packages/pretty-format/perf/test.js b/packages/pretty-format/perf/test.js index 9bc97b44099f..e8ac99df480c 100644 --- a/packages/pretty-format/perf/test.js +++ b/packages/pretty-format/perf/test.js @@ -12,7 +12,7 @@ const React = require('react'); const ReactTestRenderer = require('react-test-renderer'); const leftPad = require('left-pad'); const prettyFormat = require('../build'); -const ReactTestComponent = require('../build/plugins/react_test_component'); +const ReactTestComponent = require('../build/plugins/ReactTestComponent'); const worldGeoJson = require('./world.geo.json'); const NANOSECONDS = 1000000000; diff --git a/packages/pretty-format/src/__tests__/asymmetric_matcher.test.js b/packages/pretty-format/src/__tests__/AsymmetricMatcher.test.js similarity index 100% rename from packages/pretty-format/src/__tests__/asymmetric_matcher.test.js rename to packages/pretty-format/src/__tests__/AsymmetricMatcher.test.js diff --git a/packages/pretty-format/src/__tests__/convert_ansi.test.js b/packages/pretty-format/src/__tests__/ConvertAnsi.test.js similarity index 100% rename from packages/pretty-format/src/__tests__/convert_ansi.test.js rename to packages/pretty-format/src/__tests__/ConvertAnsi.test.js diff --git a/packages/pretty-format/src/__tests__/dom_collection.test.js b/packages/pretty-format/src/__tests__/DOMCollection.test.js similarity index 98% rename from packages/pretty-format/src/__tests__/dom_collection.test.js rename to packages/pretty-format/src/__tests__/DOMCollection.test.js index cf0d498f8b18..204068c2561c 100644 --- a/packages/pretty-format/src/__tests__/dom_collection.test.js +++ b/packages/pretty-format/src/__tests__/DOMCollection.test.js @@ -13,7 +13,7 @@ const prettyFormat = require('../'); const {DOMCollection, DOMElement} = prettyFormat.plugins; -const toPrettyPrintTo = require('./expect_util').getPrettyPrint([ +const toPrettyPrintTo = require('./getPrettyPrint').default([ DOMCollection, DOMElement, ]); diff --git a/packages/pretty-format/src/__tests__/dom_element.test.js b/packages/pretty-format/src/__tests__/DOMElement.test.js similarity index 99% rename from packages/pretty-format/src/__tests__/dom_element.test.js rename to packages/pretty-format/src/__tests__/DOMElement.test.js index 9b06b105766c..e211b33665d9 100644 --- a/packages/pretty-format/src/__tests__/dom_element.test.js +++ b/packages/pretty-format/src/__tests__/DOMElement.test.js @@ -13,7 +13,7 @@ const prettyFormat = require('../'); const {DOMElement} = prettyFormat.plugins; -const toPrettyPrintTo = require('./expect_util').getPrettyPrint([DOMElement]); +const toPrettyPrintTo = require('./getPrettyPrint').default([DOMElement]); const expect: any = global.expect; expect.extend({toPrettyPrintTo}); diff --git a/packages/pretty-format/src/__tests__/immutable.test.js b/packages/pretty-format/src/__tests__/Immutable.test.js similarity index 99% rename from packages/pretty-format/src/__tests__/immutable.test.js rename to packages/pretty-format/src/__tests__/Immutable.test.js index b402605cf85c..4e0e40cf91e7 100644 --- a/packages/pretty-format/src/__tests__/immutable.test.js +++ b/packages/pretty-format/src/__tests__/Immutable.test.js @@ -11,7 +11,7 @@ import React from 'react'; import Immutable from 'immutable'; -import {getPrettyPrint} from './expect_util'; +import getPrettyPrint from './getPrettyPrint'; const {plugins: prettyPlugins} = require('..'); const {Immutable: ImmutablePlugin, ReactElement} = prettyPlugins; diff --git a/packages/pretty-format/src/__tests__/expect_util.js b/packages/pretty-format/src/__tests__/getPrettyPrint.js similarity index 95% rename from packages/pretty-format/src/__tests__/expect_util.js rename to packages/pretty-format/src/__tests__/getPrettyPrint.js index 1fb9a1dc0d8b..5ee5ee04929b 100644 --- a/packages/pretty-format/src/__tests__/expect_util.js +++ b/packages/pretty-format/src/__tests__/getPrettyPrint.js @@ -14,7 +14,7 @@ import type {OptionsReceived, Plugins} from 'types/PrettyFormat'; const diff = require('jest-diff'); const prettyFormat = require('../'); -export const getPrettyPrint = (plugins: Plugins) => +const getPrettyPrint = (plugins: Plugins) => function(received: any, expected: any, options?: OptionsReceived) { const prettyFormatted = prettyFormat( received, @@ -52,3 +52,5 @@ export const getPrettyPrint = (plugins: Plugins) => return {actual: prettyFormatted, message, pass}; }; + +export default getPrettyPrint; diff --git a/packages/pretty-format/src/__tests__/pretty_format.test.js b/packages/pretty-format/src/__tests__/prettyFormat.test.js similarity index 100% rename from packages/pretty-format/src/__tests__/pretty_format.test.js rename to packages/pretty-format/src/__tests__/prettyFormat.test.js diff --git a/packages/pretty-format/src/index.js b/packages/pretty-format/src/index.js index 3c193f1a17d3..618a6fc62971 100644 --- a/packages/pretty-format/src/index.js +++ b/packages/pretty-format/src/index.js @@ -28,13 +28,13 @@ import { printObjectProperties, } from './collections'; -import AsymmetricMatcher from './plugins/asymmetric_matcher'; -import ConvertAnsi from './plugins/convert_ansi'; -import DOMCollection from './plugins/dom_collection'; -import DOMElement from './plugins/dom_element'; -import Immutable from './plugins/immutable'; -import ReactElement from './plugins/react_element'; -import ReactTestComponent from './plugins/react_test_component'; +import AsymmetricMatcher from './plugins/AsymmetricMatcher'; +import ConvertAnsi from './plugins/ConvertAnsi'; +import DOMCollection from './plugins/DOMCollection'; +import DOMElement from './plugins/DOMElement'; +import Immutable from './plugins/Immutable'; +import ReactElement from './plugins/ReactElement'; +import ReactTestComponent from './plugins/ReactTestComponent'; const toString = Object.prototype.toString; const toISOString = Date.prototype.toISOString; diff --git a/packages/pretty-format/src/plugins/asymmetric_matcher.js b/packages/pretty-format/src/plugins/AsymmetricMatcher.js similarity index 100% rename from packages/pretty-format/src/plugins/asymmetric_matcher.js rename to packages/pretty-format/src/plugins/AsymmetricMatcher.js diff --git a/packages/pretty-format/src/plugins/convert_ansi.js b/packages/pretty-format/src/plugins/ConvertAnsi.js similarity index 100% rename from packages/pretty-format/src/plugins/convert_ansi.js rename to packages/pretty-format/src/plugins/ConvertAnsi.js diff --git a/packages/pretty-format/src/plugins/dom_collection.js b/packages/pretty-format/src/plugins/DOMCollection.js similarity index 100% rename from packages/pretty-format/src/plugins/dom_collection.js rename to packages/pretty-format/src/plugins/DOMCollection.js diff --git a/packages/pretty-format/src/plugins/dom_element.js b/packages/pretty-format/src/plugins/DOMElement.js similarity index 100% rename from packages/pretty-format/src/plugins/dom_element.js rename to packages/pretty-format/src/plugins/DOMElement.js diff --git a/packages/pretty-format/src/plugins/immutable.js b/packages/pretty-format/src/plugins/Immutable.js similarity index 100% rename from packages/pretty-format/src/plugins/immutable.js rename to packages/pretty-format/src/plugins/Immutable.js diff --git a/packages/pretty-format/src/plugins/react_element.js b/packages/pretty-format/src/plugins/ReactElement.js similarity index 100% rename from packages/pretty-format/src/plugins/react_element.js rename to packages/pretty-format/src/plugins/ReactElement.js diff --git a/packages/pretty-format/src/plugins/react_test_component.js b/packages/pretty-format/src/plugins/ReactTestComponent.js similarity index 100% rename from packages/pretty-format/src/plugins/react_test_component.js rename to packages/pretty-format/src/plugins/ReactTestComponent.js diff --git a/packages/pretty-format/src/plugins/lib/escape_html.js b/packages/pretty-format/src/plugins/lib/escapeHTML.js similarity index 100% rename from packages/pretty-format/src/plugins/lib/escape_html.js rename to packages/pretty-format/src/plugins/lib/escapeHTML.js diff --git a/packages/pretty-format/src/plugins/lib/markup.js b/packages/pretty-format/src/plugins/lib/markup.js index eb45835588a0..70ebceebc806 100644 --- a/packages/pretty-format/src/plugins/lib/markup.js +++ b/packages/pretty-format/src/plugins/lib/markup.js @@ -9,7 +9,7 @@ import type {Config, Printer, Refs} from 'types/PrettyFormat'; -import escapeHTML from './escape_html'; +import escapeHTML from './escapeHTML'; // Return empty string if keys is empty. export const printProps = (