Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardize file names in packages/jest-haste-map #7266

Merged
merged 3 commits into from
Oct 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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