Skip to content

Commit

Permalink
chore: Standardize file names in packages/jest-worker and packages/pr…
Browse files Browse the repository at this point in the history
…etty-format (#7316)

* Rename jest-worker woker

* rename in pretty-format/src/plugins/lib/escape_html.js

* Update CHANGELOG

* Rename with git mv

* Code review fixes

* Rename plugins and clean up exports

* Fix formatting issue

* Remove exports from AsymmetricMatcher

* Revert remove exports for test/serialize

* Change getPrettyPrint to default export

* Fix require default
  • Loading branch information
matmalkowski authored and thymikee committed Nov 14, 2018
1 parent 5b7c75d commit 06bf664
Show file tree
Hide file tree
Showing 26 changed files with 27 additions and 23 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = {
projects: ['<rootDir>', '<rootDir>/examples/*/'],
setupFilesAfterEnv: ['<rootDir>/testSetupFile.js'],
snapshotSerializers: [
'<rootDir>/packages/pretty-format/build/plugins/convert_ansi.js',
'<rootDir>/packages/pretty-format/build/plugins/ConvertAnsi.js',
],
testEnvironment: './packages/jest-environment-node',
testPathIgnorePatterns: [
Expand All @@ -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/',
Expand Down
6 changes: 3 additions & 3 deletions packages/jest-worker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

Expand Down Expand Up @@ -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,
});
Expand Down Expand Up @@ -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,
});

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ beforeEach(() => {
return forkInterface;
});

Worker = require('../worker').default;
Worker = require('../Worker').default;
});

afterEach(() => {
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-worker/src/__tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}}),
Expand Down Expand Up @@ -63,7 +63,7 @@ beforeEach(() => {
virtual: true,
});

Worker = require('../worker').default;
Worker = require('../Worker').default;
Farm = require('../index').default;
});

Expand Down
2 changes: 1 addition & 1 deletion packages/jest-worker/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {};
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-worker/src/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion packages/pretty-format/perf/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -52,3 +52,5 @@ export const getPrettyPrint = (plugins: Plugins) =>

return {actual: prettyFormatted, message, pass};
};

export default getPrettyPrint;
14 changes: 7 additions & 7 deletions packages/pretty-format/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion packages/pretty-format/src/plugins/lib/markup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand Down

0 comments on commit 06bf664

Please sign in to comment.