Skip to content

Commit

Permalink
Standardize file names in packages/jest-haste-map (#7266)
Browse files Browse the repository at this point in the history
  • Loading branch information
matmalkowski authored and SimenB committed Oct 25, 2018
1 parent e21ae11 commit b8619f8
Show file tree
Hide file tree
Showing 17 changed files with 18 additions and 17 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
- `[tests]` Free tests from the dependency on value of FORCE_COLOR ([#6585](https://github.com/facebook/jest/pull/6585/files))
- `[jest-diff]` Standardize filenames ([#7238](https://github.com/facebook/jest/pull/7238))
- `[*]` Add babel plugin to make sure Jest is unaffected by fake Promise implementations ([#7225](https://github.com/facebook/jest/pull/7225))
- `[jest-haste-map]` Standardize filenames ([#7266](https://github.com/facebook/jest/pull/7266))

### Performance

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
'use strict';

import path from 'path';
import getMockName from '../get_mock_name';
import getMockName from '../getMockName';

describe('getMockName', () => {
it('extracts mock name from file path', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-haste-map/src/__tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jest.mock('sane', () => ({
WatchmanWatcher: mockWatcherConstructor,
}));

jest.mock('../lib/watchman_watcher.js', () => mockWatcherConstructor);
jest.mock('../lib/WatchmanWatcher.js', () => mockWatcherConstructor);

let mockChangedFiles;
let mockFs;
Expand Down Expand Up @@ -1230,7 +1230,7 @@ describe('HasteMap', () => {
} catch (error) {
const {
DuplicateHasteCandidatesError,
} = require('../module_map').default;
} = require('../ModuleMap').default;
expect(error).toBeInstanceOf(DuplicateHasteCandidatesError);
expect(error.hasteName).toBe('Pear');
expect(error.platform).toBe('g');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
const path = require('path');

jest.mock('fb-watchman', () => {
const normalizePathSep = require('../../lib/normalize_path_sep').default;
const normalizePathSep = require('../../lib/normalizePathSep').default;
const Client = jest.fn();
Client.prototype.command = jest.fn((args, callback) =>
setImmediate(() => {
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-haste-map/src/crawlers/watchman.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type {InternalHasteMap} from 'types/HasteMap';
import type {CrawlerOptions} from '../types';

import * as fastPath from '../lib/fast_path';
import normalizePathSep from '../lib/normalize_path_sep';
import normalizePathSep from '../lib/normalizePathSep';
import path from 'path';
import watchman from 'fb-watchman';
import H from '../constants';
Expand Down
File renamed without changes.
14 changes: 7 additions & 7 deletions packages/jest-haste-map/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@ import {getSha1, worker} from './worker';
import crypto from 'crypto';
import EventEmitter from 'events';
import fs from 'fs';
import getMockName from './get_mock_name';
import getPlatformExtension from './lib/get_platform_extension';
import getMockName from './getMockName';
import getPlatformExtension from './lib/getPlatformExtension';
import H from './constants';
import HasteFS from './haste_fs';
import HasteModuleMap from './module_map';
import HasteFS from './HasteFS';
import HasteModuleMap from './ModuleMap';
import invariant from 'invariant';
// eslint-disable-next-line import/default
import nodeCrawl from './crawlers/node';
import normalizePathSep from './lib/normalize_path_sep';
import normalizePathSep from './lib/normalizePathSep';
import os from 'os';
import path from 'path';
import sane from 'sane';
import serializer from 'jest-serializer';
// eslint-disable-next-line import/default
import watchmanCrawl from './crawlers/watchman';
import WatchmanWatcher from './lib/watchman_watcher';
import WatchmanWatcher from './lib/WatchmanWatcher';
import * as fastPath from './lib/fast_path';
import Worker from 'jest-worker';

Expand All @@ -43,7 +43,7 @@ import type {
HasteRegExp,
MockData,
} from 'types/HasteMap';
import type {SerializableModuleMap as HasteSerializableModuleMap} from './module_map';
import type {SerializableModuleMap as HasteSerializableModuleMap} from './ModuleMap';

type HType = typeof H;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
'use strict';

import extractRequires from '../extract_requires';
import extractRequires from '../extractRequires';

it('extracts both requires and imports from code', () => {
const code = `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

'use strict';

import getPlatformExtension from '../get_platform_extension';
import getPlatformExtension from '../getPlatformExtension';

describe('getPlatformExtension', () => {
it('should get platform ext', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ describe('normalizePathSep', () => {
it('does nothing on posix', () => {
jest.resetModules();
jest.mock('path', () => jest.requireActual('path').posix);
const normalizePathSep = require('../normalize_path_sep').default;
const normalizePathSep = require('../normalizePathSep').default;
expect(normalizePathSep('foo/bar/baz.js')).toEqual('foo/bar/baz.js');
});

it('replace slashes on windows', () => {
jest.resetModules();
jest.mock('path', () => jest.requireActual('path').win32);
const normalizePathSep = require('../normalize_path_sep').default;
const normalizePathSep = require('../normalizePathSep').default;
expect(normalizePathSep('foo/bar/baz.js')).toEqual('foo\\bar\\baz.js');
});
});
2 changes: 1 addition & 1 deletion packages/jest-haste-map/src/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import path from 'path';
import fs from 'graceful-fs';
import blacklist from './blacklist';
import H from './constants';
import extractRequires from './lib/extract_requires';
import extractRequires from './lib/extractRequires';

const PACKAGE_JSON = path.sep + 'package.json';

Expand Down

0 comments on commit b8619f8

Please sign in to comment.