chore: upgrade prettier (#7336)

This commit is contained in:
Simen Bekkhus 2018-11-19 15:46:34 +01:00 committed by GitHub
parent 819cae5f18
commit 993bc5c5f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
57 changed files with 421 additions and 396 deletions

3
.prettierignore Normal file
View File

@ -0,0 +1,3 @@
fixtures/failing-jsons/
packages/jest-config/src/__tests__/jest-preset.json
packages/pretty-format/perf/world.geo.json

View File

@ -154,9 +154,9 @@ jest.mock(
'../moduleName',
() => {
/*
* Custom implementation of a module that doesn't exist in JS,
* like a generated module or a native module in react-native.
*/
* Custom implementation of a module that doesn't exist in JS,
* like a generated module or a native module in react-native.
*/
},
{virtual: true},
);

View File

@ -50,13 +50,12 @@ const users = {
export default function request(url) {
return new Promise((resolve, reject) => {
const userID = parseInt(url.substr('/users/'.length), 10);
process.nextTick(
() =>
users[userID]
? resolve(users[userID])
: reject({
error: 'User with ' + userID + ' not found.',
}),
process.nextTick(() =>
users[userID]
? resolve(users[userID])
: reject({
error: 'User with ' + userID + ' not found.',
}),
);
});
}

View File

@ -26,33 +26,33 @@ Object {
"0": Object {
"loc": Object {
"end": Object {
"column": 9,
"line": 5,
"column": 35,
"line": 4,
},
"start": Object {
"column": 8,
"line": 5,
"column": 34,
"line": 4,
},
},
"locations": Array [
Object {
"end": Object {
"column": 9,
"line": 5,
"column": 35,
"line": 4,
},
"start": Object {
"column": 8,
"line": 5,
"column": 34,
"line": 4,
},
},
Object {
"end": Object {
"column": 9,
"line": 6,
"column": 39,
"line": 4,
},
"start": Object {
"column": 8,
"line": 6,
"column": 38,
"line": 4,
},
},
],
@ -61,33 +61,33 @@ Object {
"1": Object {
"loc": Object {
"end": Object {
"column": 37,
"line": 7,
"column": 35,
"line": 5,
},
"start": Object {
"column": 36,
"line": 7,
"column": 34,
"line": 5,
},
},
"locations": Array [
Object {
"end": Object {
"column": 37,
"line": 7,
"column": 35,
"line": 5,
},
"start": Object {
"column": 36,
"line": 7,
"column": 34,
"line": 5,
},
},
Object {
"end": Object {
"column": 41,
"line": 7,
"column": 39,
"line": 5,
},
"start": Object {
"column": 40,
"line": 7,
"column": 38,
"line": 5,
},
},
],
@ -96,43 +96,43 @@ Object {
"2": Object {
"loc": Object {
"end": Object {
"column": 33,
"line": 8,
"column": 31,
"line": 6,
},
"start": Object {
"column": 29,
"line": 8,
"column": 27,
"line": 6,
},
},
"locations": Array [
Object {
"end": Object {
"column": 33,
"line": 8,
"column": 31,
"line": 6,
},
"start": Object {
"column": 29,
"line": 8,
"column": 27,
"line": 6,
},
},
Object {
"end": Object {
"column": 41,
"line": 8,
"column": 39,
"line": 6,
},
"start": Object {
"column": 37,
"line": 8,
"column": 35,
"line": 6,
},
},
Object {
"end": Object {
"column": 50,
"line": 8,
"column": 48,
"line": 6,
},
"start": Object {
"column": 45,
"line": 8,
"column": 43,
"line": 6,
},
},
],
@ -141,33 +141,33 @@ Object {
"3": Object {
"loc": Object {
"end": Object {
"column": 42,
"line": 9,
"column": 40,
"line": 7,
},
"start": Object {
"column": 32,
"line": 9,
"column": 30,
"line": 7,
},
},
"locations": Array [
Object {
"end": Object {
"column": 42,
"line": 9,
"column": 40,
"line": 7,
},
"start": Object {
"column": 32,
"line": 9,
"column": 30,
"line": 7,
},
},
Object {
"end": Object {
"column": 55,
"line": 9,
"column": 53,
"line": 7,
},
"start": Object {
"column": 45,
"line": 9,
"column": 43,
"line": 7,
},
},
],
@ -194,7 +194,7 @@ Object {
"loc": Object {
"end": Object {
"column": 1,
"line": 12,
"line": 10,
},
"start": Object {
"column": 49,
@ -206,22 +206,22 @@ Object {
"1": Object {
"decl": Object {
"end": Object {
"column": 37,
"line": 9,
"column": 35,
"line": 7,
},
"start": Object {
"column": 32,
"line": 9,
"column": 30,
"line": 7,
},
},
"loc": Object {
"end": Object {
"column": 42,
"line": 9,
"column": 40,
"line": 7,
},
"start": Object {
"column": 32,
"line": 9,
"column": 30,
"line": 7,
},
},
"name": "(anonymous_1)",
@ -229,22 +229,22 @@ Object {
"2": Object {
"decl": Object {
"end": Object {
"column": 50,
"line": 9,
"column": 48,
"line": 7,
},
"start": Object {
"column": 45,
"line": 9,
"column": 43,
"line": 7,
},
},
"loc": Object {
"end": Object {
"column": 55,
"line": 9,
"column": 53,
"line": 7,
},
"start": Object {
"column": 45,
"line": 9,
"column": 43,
"line": 7,
},
},
"name": "(anonymous_2)",
@ -264,8 +264,8 @@ Object {
"statementMap": Object {
"0": Object {
"end": Object {
"column": 1,
"line": 12,
"column": 2,
"line": 10,
},
"start": Object {
"column": 0,
@ -274,72 +274,72 @@ Object {
},
"1": Object {
"end": Object {
"column": 9,
"line": 6,
"column": 39,
"line": 4,
},
"start": Object {
"column": 29,
"column": 27,
"line": 4,
},
},
"2": Object {
"end": Object {
"column": 41,
"line": 7,
"column": 39,
"line": 5,
},
"start": Object {
"column": 29,
"line": 7,
"column": 27,
"line": 5,
},
},
"3": Object {
"end": Object {
"column": 50,
"line": 8,
"column": 48,
"line": 6,
},
"start": Object {
"column": 29,
"line": 8,
"column": 27,
"line": 6,
},
},
"4": Object {
"end": Object {
"column": 55,
"line": 9,
"column": 53,
"line": 7,
},
"start": Object {
"column": 25,
"line": 9,
"column": 23,
"line": 7,
},
},
"5": Object {
"end": Object {
"column": 42,
"line": 9,
"column": 40,
"line": 7,
},
"start": Object {
"column": 38,
"line": 9,
"column": 36,
"line": 7,
},
},
"6": Object {
"end": Object {
"column": 55,
"line": 9,
"column": 53,
"line": 7,
},
"start": Object {
"column": 51,
"line": 9,
"column": 49,
"line": 7,
},
},
"7": Object {
"end": Object {
"column": 17,
"line": 11,
"column": 15,
"line": 9,
},
"start": Object {
"column": 4,
"line": 11,
"column": 2,
"line": 9,
},
},
},

View File

@ -385,8 +385,8 @@ exports[`works with async failures 1`] = `
> 21 | expect(Promise.reject({foo: 'bar'})).resolves.toEqual({foo: 'bar'}));
| ^
22 |
23 | test(
24 | 'timeout',
23 | test('timeout', done => {
24 | setTimeout(done, 50);
at __tests__/async_failures.test.js:21:3
@ -396,11 +396,11 @@ exports[`works with async failures 1`] = `
21 | expect(Promise.reject({foo: 'bar'})).resolves.toEqual({foo: 'bar'}));
22 |
> 23 | test(
> 23 | test('timeout', done => {
| ^
24 | 'timeout',
25 | done => {
26 | setTimeout(done, 50);
24 | setTimeout(done, 50);
25 | }, 5);
26 |
at __tests__/async_failures.test.js:23:1

View File

@ -1,12 +1,10 @@
// Copyright 2004-present Facebook. All Rights Reserved.
export = function difference(a: number, b: number): number {
const branch1: boolean = true
? 1
: 0;
const branch2: boolean = true ? 1 : 0;
const branch3: boolean = true || true || false;
const fn: Function = true ? () => null : () => null;
const branch1: boolean = true ? 1 : 0;
const branch2: boolean = true ? 1 : 0;
const branch3: boolean = true || true || false;
const fn: Function = true ? () => null : () => null;
return a - b;
}
return a - b;
};

View File

@ -6,10 +6,14 @@
},
"testRegex": "/__tests__/.*\\.(js)$",
"testEnvironment": "node",
"moduleFileExtensions": ["js"]
"moduleFileExtensions": [
"js"
]
},
"babel": {
"presets": ["env"]
"presets": [
"env"
]
},
"dependencies": {
"babel-core": "6.26.0",

View File

@ -1,11 +1,14 @@
{
"jest": {
"reporters": [
["<rootDir>/reporters/TestReporter.js", {
"hello": "world",
"dmitrii": "abramov",
"christoph": "pojer"
}]
[
"<rootDir>/reporters/TestReporter.js",
{
"hello": "world",
"dmitrii": "abramov",
"christoph": "pojer"
}
]
]
}
}

View File

@ -20,10 +20,6 @@ test('expect reject', () =>
test('expect resolve', () =>
expect(Promise.reject({foo: 'bar'})).resolves.toEqual({foo: 'bar'}));
test(
'timeout',
done => {
setTimeout(done, 50);
},
5
);
test('timeout', done => {
setTimeout(done, 50);
}, 5);

View File

@ -15,7 +15,8 @@ describe('promise beforeAll', () => {
process.nextTick(resolve);
}).then(() => {
flag = 1;
}));
})
);
beforeAll(() => new Promise(resolve => setTimeout(resolve, 10)), 500);

View File

@ -13,7 +13,8 @@ describe('promise beforeEach', () => {
process.nextTick(resolve);
}).then(() => {
this.flag = 1;
}));
})
);
// passing tests
it('runs tests after beforeEach asynchronously completes', () => {

View File

@ -1,6 +1,8 @@
{
"jest": {
"testEnvironment": "node",
"coverageReporters": ["json"]
"coverageReporters": [
"json"
]
}
}

View File

@ -1,18 +1,18 @@
{
"jest": {
"projects": [
{
"rootDir": "<rootDir>/foo",
"testPathIgnorePatterns": [
"<rootDir>/__tests__/boggus-foo.test.js"
]
},
{
"rootDir": "<rootDir>/bar",
"testPathIgnorePatterns": [
"<rootDir>/__tests__/boggus-bar.test.js"
]
}
{
"rootDir": "<rootDir>/foo",
"testPathIgnorePatterns": [
"<rootDir>/__tests__/boggus-foo.test.js"
]
},
{
"rootDir": "<rootDir>/bar",
"testPathIgnorePatterns": [
"<rootDir>/__tests__/boggus-bar.test.js"
]
}
]
}
}

View File

@ -1,6 +1,10 @@
{
"jest": {
"moduleFileExtensions": ["js", "json", "jsx"],
"moduleFileExtensions": [
"js",
"json",
"jsx"
],
"testEnvironment": "node"
}
}

View File

@ -1,3 +1,3 @@
{
"extension": "json"
"extension": "json"
}

View File

@ -1,3 +1,3 @@
{
"extension": "json"
"extension": "json"
}

View File

@ -1,3 +1,3 @@
{
"extension": "json"
"extension": "json"
}

View File

@ -1,3 +1,3 @@
{
"extension": "json"
"extension": "json"
}

View File

@ -5,7 +5,10 @@
"^.+\\.(ts)$": "<rootDir>/Preprocessor.js"
},
"testEnvironment": "node",
"moduleFileExtensions": ["ts", "js"],
"moduleFileExtensions": [
"ts",
"js"
],
"testRegex": "fails"
},
"dependencies": {

View File

@ -7,7 +7,9 @@
"<rootDir>/this-directory-is-covered/Covered.js": true,
"<rootDir>/this-directory-is-covered/ExcludedFromCoverage.js": true
},
"coveragePathIgnorePatterns": ["ExcludedFromCoverage"],
"coveragePathIgnorePatterns": [
"ExcludedFromCoverage"
],
"testEnvironment": "node"
}
}

View File

@ -1,8 +1,16 @@
{
"jest": {
"testEnvironment": "node",
"moduleFileExtensions": ["js", "json", "jsx", "node", "mjs"],
"testMatch": [ "**/__tests__/**/*.mjs"],
"moduleFileExtensions": [
"js",
"json",
"jsx",
"node",
"mjs"
],
"testMatch": [
"**/__tests__/**/*.mjs"
],
"transform": {
"^.+\\.mjs?$": "../../../packages/babel-jest"
}

View File

@ -4,7 +4,9 @@
"<rootDir>/this-directory-is-covered/Covered.js": true,
"<rootDir>/this-directory-is-covered/ExcludedFromCoverage.js": true
},
"coveragePathIgnorePatterns": ["ExcludedFromCoverage"],
"coveragePathIgnorePatterns": [
"ExcludedFromCoverage"
],
"testEnvironment": "node"
}
}

View File

@ -4,7 +4,9 @@
"transform": {
"^.+\\.(ts|js)$": "<rootDir>/TypescriptPreprocessor.js"
},
"testMatch": ["**/__tests__/*.+(ts|tsx|js)"],
"testMatch": [
"**/__tests__/*.+(ts|tsx|js)"
],
"testEnvironment": "node",
"moduleFileExtensions": [
"ts",

View File

@ -10,13 +10,12 @@ const users = {
export default function request(url) {
return new Promise((resolve, reject) => {
const userID = parseInt(url.substr('/users/'.length), 10);
process.nextTick(
() =>
users[userID]
? resolve(users[userID])
: reject({
error: 'User with ' + userID + ' not found.',
})
process.nextTick(() =>
users[userID]
? resolve(users[userID])
: reject({
error: 'User with ' + userID + ' not found.',
})
);
});
}

View File

@ -1,38 +1,38 @@
{
"images" : [
"images": [
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
"idiom": "iphone",
"size": "29x29",
"scale": "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
"idiom": "iphone",
"size": "29x29",
"scale": "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
"idiom": "iphone",
"size": "40x40",
"scale": "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
"idiom": "iphone",
"size": "40x40",
"scale": "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
"idiom": "iphone",
"size": "60x60",
"scale": "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
"idiom": "iphone",
"size": "60x60",
"scale": "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"info": {
"version": 1,
"author": "xcode"
}
}

View File

@ -2,7 +2,7 @@
/// <reference path="./typings/react/react.d.ts" />
import * as React from 'react'
import * as React from 'react';
interface CheckboxWithLabelProps {
labelOff: string;
@ -13,7 +13,10 @@ interface CheckboxWithLabelState {
isChecked: boolean;
}
class CheckboxWithLabel extends React.Component<CheckboxWithLabelProps, CheckboxWithLabelState> {
class CheckboxWithLabel extends React.Component<
CheckboxWithLabelProps,
CheckboxWithLabelState
> {
constructor(props: CheckboxWithLabelProps) {
super(props);
this.state = {isChecked: false};
@ -25,7 +28,9 @@ class CheckboxWithLabel extends React.Component<CheckboxWithLabelProps, Checkbox
<input
type="checkbox"
checked={this.state.isChecked}
onChange={() => this.setState(current => ({isChecked: !current.isChecked}))}
onChange={() =>
this.setState(current => ({isChecked: !current.isChecked}))
}
/>
{this.state.isChecked ? this.props.labelOn : this.props.labelOff}
</label>

View File

@ -9,7 +9,7 @@ const CheckboxWithLabel = require('../CheckboxWithLabel');
it('CheckboxWithLabel changes the text after click', () => {
// Render a checkbox with label in the document
const checkbox = TestUtils.renderIntoDocument(
<CheckboxWithLabel labelOn="On" labelOff="Off" />
<CheckboxWithLabel labelOn="On" labelOff="Off" />,
);
const checkboxNode = ReactDOM.findDOMNode(checkbox);
@ -19,7 +19,7 @@ it('CheckboxWithLabel changes the text after click', () => {
// Simulate a click and verify that it is now On
TestUtils.Simulate.change(
TestUtils.findRenderedDOMComponentWithTag(checkbox, 'input')
TestUtils.findRenderedDOMComponentWithTag(checkbox, 'input'),
);
expect(checkboxNode.textContent).toEqual('On');
});

View File

@ -1,11 +1,11 @@
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
it('adds 1 + 2 to equal 3 in TScript', ()=> {
it('adds 1 + 2 to equal 3 in TScript', () => {
const sum = require('../sum.ts');
expect(sum(1, 2)).toBe(3);
});
it('adds 1 + 2 to equal 3 in JavaScript', ()=> {
it('adds 1 + 2 to equal 3 in JavaScript', () => {
const sum = require('../sum.js');
expect(sum(1, 2)).toBe(3);
});

View File

@ -26,14 +26,14 @@
"codecov": "^3.0.0",
"debug": "^4.0.1",
"eslint": "^5.6.0",
"eslint-config-prettier": "^3.0.1",
"eslint-config-prettier": "^3.1.0",
"eslint-plugin-babel": "^5.1.0",
"eslint-plugin-flowtype": "^2.35.0",
"eslint-plugin-import": "^2.6.0",
"eslint-plugin-jest": "^22.0.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-markdown": "^1.0.0-beta.6",
"eslint-plugin-prettier": "^2.3.1",
"eslint-plugin-prettier": "^2.7.0",
"eslint-plugin-react": "^7.1.0",
"eslint-plugin-relay": "~0.0.19",
"execa": "^1.0.0",
@ -57,7 +57,7 @@
"mkdirp": "^0.5.1",
"mocha": "^5.0.1",
"mock-fs": "^4.4.1",
"prettier": "^1.13.3",
"prettier": "^1.15.2",
"prettylint": "^1.0.0",
"progress": "^2.0.0",
"promise": "^8.0.2",

View File

@ -511,10 +511,10 @@ const matchers: MatchersObject = {
` ${printReceived(result.value)}` +
(diffString ? `\n\nDifference:\n\n${diffString}` : '')
: traversedPath
? `Received:\n ${RECEIVED_COLOR(
'object',
)}.${traversedPath}: ${printReceived(lastTraversedObject)}`
: '')
? `Received:\n ${RECEIVED_COLOR(
'object',
)}.${traversedPath}: ${printReceived(lastTraversedObject)}`
: '')
);
};
if (pass === undefined) {

View File

@ -313,12 +313,12 @@ const createLastReturnedMatcher = matcherName => (
(!lastResult
? `But it was ${RECEIVED_COLOR('not called')}`
: lastResult.type === 'incomplete'
? `But the last call ${RECEIVED_COLOR('has not returned yet')}`
: lastResult.type === 'throw'
? `But the last call ${RECEIVED_COLOR('threw an error')}`
: `But the last call returned:\n ${printReceived(
lastResult.value,
)}`);
? `But the last call ${RECEIVED_COLOR('has not returned yet')}`
: lastResult.type === 'throw'
? `But the last call ${RECEIVED_COLOR('threw an error')}`
: `But the last call returned:\n ${printReceived(
lastResult.value,
)}`);
return {message, pass};
};
@ -420,18 +420,16 @@ const createNthReturnedWithMatcher = (matcherName: string) => (
(results.length === 0
? `But it was ${RECEIVED_COLOR('not called')}`
: nth > results.length
? `But it was only called ${printReceived(results.length)} times`
: nthResult.type === 'incomplete'
? `But the ${nthString} call ${RECEIVED_COLOR(
'has not returned yet',
)}`
: nthResult.type === 'throw'
? `But the ${nthString} call ${RECEIVED_COLOR(
'threw an error',
)}`
: `But the ${nthString} call returned with:\n ${printReceived(
nthResult.value,
)}`);
? `But it was only called ${printReceived(results.length)} times`
: nthResult.type === 'incomplete'
? `But the ${nthString} call ${RECEIVED_COLOR(
'has not returned yet',
)}`
: nthResult.type === 'throw'
? `But the ${nthString} call ${RECEIVED_COLOR('threw an error')}`
: `But the ${nthString} call returned with:\n ${printReceived(
nthResult.value,
)}`);
return {message, pass};
};

View File

@ -203,16 +203,15 @@ test('writes the cache based on the results', () => {
});
test('works with multiple contexts', () => {
fs.readFileSync = jest.fn(
cacheName =>
cacheName.startsWith(path.sep + 'cache' + path.sep)
? JSON.stringify({
'/test-a.js': [SUCCESS, 5],
'/test-b.js': [FAIL, 1],
})
: JSON.stringify({
'/test-c.js': [FAIL],
}),
fs.readFileSync = jest.fn(cacheName =>
cacheName.startsWith(path.sep + 'cache' + path.sep)
? JSON.stringify({
'/test-a.js': [SUCCESS, 5],
'/test-b.js': [FAIL, 1],
})
: JSON.stringify({
'/test-c.js': [FAIL],
}),
);
const testPaths = [

View File

@ -334,9 +334,8 @@ describe('setupFilesAfterEnv', () => {
let Resolver;
beforeEach(() => {
Resolver = require('jest-resolve');
Resolver.findNodeModule = jest.fn(
name =>
name.startsWith('/') ? name : '/root/path/foo' + path.sep + name,
Resolver.findNodeModule = jest.fn(name =>
name.startsWith('/') ? name : '/root/path/foo' + path.sep + name,
);
});
@ -385,9 +384,8 @@ describe('setupTestFrameworkScriptFile', () => {
console.warn = jest.fn();
consoleWarn = console.warn;
Resolver = require('jest-resolve');
Resolver.findNodeModule = jest.fn(
name =>
name.startsWith('/') ? name : '/root/path/foo' + path.sep + name,
Resolver.findNodeModule = jest.fn(name =>
name.startsWith('/') ? name : '/root/path/foo' + path.sep + name,
);
});
@ -724,11 +722,10 @@ describe('babel-jest', () => {
let Resolver;
beforeEach(() => {
Resolver = require('jest-resolve');
Resolver.findNodeModule = jest.fn(
name =>
name.indexOf('babel-jest') === -1
? path.sep + 'node_modules' + path.sep + name
: name,
Resolver.findNodeModule = jest.fn(name =>
name.indexOf('babel-jest') === -1
? path.sep + 'node_modules' + path.sep + name
: name,
);
});

View File

@ -565,11 +565,10 @@ export default function normalize(options: InitialOptions, argv: Argv) {
break;
case 'projects':
value = (options[key] || [])
.map(
project =>
typeof project === 'string'
? _replaceRootDirTags(options.rootDir, project)
: project,
.map(project =>
typeof project === 'string'
? _replaceRootDirTags(options.rootDir, project)
: project,
)
.reduce((projects, project) => {
// Project can be specified as globs. If a glob matches any files,
@ -727,8 +726,8 @@ export default function normalize(options: InitialOptions, argv: Argv) {
argv.ci && !argv.updateSnapshot
? 'none'
: argv.updateSnapshot
? 'all'
: 'new';
? 'all'
: 'new';
newOptions.maxWorkers = getMaxWorkers(argv);

View File

@ -44,10 +44,8 @@ module.exports = async function watchmanCrawl(
const cmd = (...args) =>
new Promise((resolve, reject) =>
client.command(
args,
(error, result) =>
error ? reject(WatchmanError(error)) : resolve(result),
client.command(args, (error, result) =>
error ? reject(WatchmanError(error)) : resolve(result),
),
);

View File

@ -755,8 +755,8 @@ class HasteMap extends EventEmitter {
canUseWatchman && this._options.useWatchman
? WatchmanWatcher
: os.platform() === 'darwin'
? sane.FSEventsWatcher
: sane.NodeWatcher;
? sane.FSEventsWatcher
: sane.NodeWatcher;
const extensions = this._options.extensions;
const ignorePattern = this._options.ignorePattern;
const rootDir = this._options.rootDir;

View File

@ -328,8 +328,8 @@ class Resolver {
return virtualMocks[virtualMockPath]
? virtualMockPath
: moduleName
? this.resolveModule(from, moduleName)
: from;
? this.resolveModule(from, moduleName)
: from;
}
_isModuleResolved(from: Path, moduleName: string): boolean {

View File

@ -59,13 +59,12 @@ export default function nodeModulesPaths(
.reduce(
(dirs, aPath) =>
dirs.concat(
modules.map(
moduleDir =>
path.isAbsolute(moduleDir)
? aPath === basedirAbs
? moduleDir
: ''
: path.join(prefix, aPath, moduleDir),
modules.map(moduleDir =>
path.isAbsolute(moduleDir)
? aPath === basedirAbs
? moduleDir
: ''
: path.join(prefix, aPath, moduleDir),
),
),
[],

View File

@ -71,9 +71,8 @@ async function runTestInternal(
: /* $FlowFixMe */
require(config.testRunner)): TestFramework);
/* $FlowFixMe */
const Runtime = (require(config.moduleLoader || 'jest-runtime'): Class<
RuntimeClass,
>);
const Runtime = (require(config.moduleLoader ||
'jest-runtime'): Class<RuntimeClass>);
let runtime = undefined;

View File

@ -43,11 +43,11 @@ There are two levels of support for the collective: Backer and Sponsor.
### Backers
Backers of the collective are individuals contributing at least $2/month. We'll include a list of backers on the Jest homepage, README on github/yarn/npm, and Contributors page.
Backers of the collective are individuals contributing at least \$2/month. We'll include a list of backers on the Jest homepage, README on github/yarn/npm, and Contributors page.
### Sponsors
Sponsors of the collective are individuals and organizations contributing at least $100/month. We'll place sponsor logos with a link to their site on the Jest homepage, README on github/yarn/npm, and Contributors page.
Sponsors of the collective are individuals and organizations contributing at least \$100/month. We'll place sponsor logos with a link to their site on the Jest homepage, README on github/yarn/npm, and Contributors page.
## What is the goal of the collective

View File

@ -49,25 +49,29 @@ class Contributors extends React.Component {
</translate>
</p>
<div>
{backers.filter(b => b.tier === 'sponsor').map(b => (
<a
key={b.id}
className="sponsor-item"
title={`$${b.totalDonations / 100} by ${b.name || b.slug}`}
target="_blank"
href={b.website || `https://opencollective.com/${b.slug}`}
>
{
<img
className="sponsor-avatar"
src={b.avatar}
alt={
b.name || b.slug ? `${b.name || b.slug}'s avatar` : 'avatar'
}
/>
}
</a>
))}
{backers
.filter(b => b.tier === 'sponsor')
.map(b => (
<a
key={b.id}
className="sponsor-item"
title={`$${b.totalDonations / 100} by ${b.name || b.slug}`}
target="_blank"
href={b.website || `https://opencollective.com/${b.slug}`}
>
{
<img
className="sponsor-avatar"
src={b.avatar}
alt={
b.name || b.slug
? `${b.name || b.slug}'s avatar`
: 'avatar'
}
/>
}
</a>
))}
</div>
<div className="support">
<a
@ -86,25 +90,29 @@ class Contributors extends React.Component {
</translate>
</p>
<div>
{backers.filter(b => b.tier === 'backer').map(b => (
<a
key={b.id}
className="backer-item"
title={`$${b.totalDonations / 100} by ${b.name || b.slug}`}
target="_blank"
href={b.website || `https://opencollective.com/${b.slug}`}
>
{
<img
className="backer-avatar"
src={b.avatar}
alt={
b.name || b.slug ? `${b.name || b.slug}'s avatar` : 'avatar'
}
/>
}
</a>
))}
{backers
.filter(b => b.tier === 'backer')
.map(b => (
<a
key={b.id}
className="backer-item"
title={`$${b.totalDonations / 100} by ${b.name || b.slug}`}
target="_blank"
href={b.website || `https://opencollective.com/${b.slug}`}
>
{
<img
className="backer-avatar"
src={b.avatar}
alt={
b.name || b.slug
? `${b.name || b.slug}'s avatar`
: 'avatar'
}
/>
}
</a>
))}
<div>
<a
className="support-button"

View File

@ -1,10 +1,10 @@
/* Copyright (c) 2014-present, Facebook, Inc. All rights reserved. */
.fixedHeaderContainer header img.logo {
height: 60px;
margin-top: -20px;
margin-bottom: -20px;
margin-right: -20px;
height: 60px;
margin-top: -20px;
margin-bottom: -20px;
margin-right: -20px;
}
div.jest-repl {

View File

@ -1,18 +1,18 @@
{
"name": "",
"icons": [
{
"src": "/img/favicon/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/img/favicon/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"theme_color": "#99424f",
"background_color": "#ffffff",
"display": "standalone"
"name": "",
"icons": [
{
"src": "/img/favicon/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/img/favicon/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"theme_color": "#99424f",
"background_color": "#ffffff",
"display": "standalone"
}

View File

@ -125,9 +125,9 @@ jest.mock(
'../moduleName',
() => {
/*
* Custom implementation of a module that doesn't exist in JS,
* like a generated module or a native module in react-native.
*/
* Custom implementation of a module that doesn't exist in JS,
* like a generated module or a native module in react-native.
*/
},
{virtual: true},
);

View File

@ -51,13 +51,12 @@ const users = {
export default function request(url) {
return new Promise((resolve, reject) => {
const userID = parseInt(url.substr('/users/'.length), 10);
process.nextTick(
() =>
users[userID]
? resolve(users[userID])
: reject({
error: 'User with ' + userID + ' not found.',
}),
process.nextTick(() =>
users[userID]
? resolve(users[userID])
: reject({
error: 'User with ' + userID + ' not found.',
}),
);
});
}

View File

@ -125,9 +125,9 @@ jest.mock(
'../moduleName',
() => {
/*
* Custom implementation of a module that doesn't exist in JS,
* like a generated module or a native module in react-native.
*/
* Custom implementation of a module that doesn't exist in JS,
* like a generated module or a native module in react-native.
*/
},
{virtual: true},
);

View File

@ -126,9 +126,9 @@ jest.mock(
'../moduleName',
() => {
/*
* Custom implementation of a module that doesn't exist in JS,
* like a generated module or a native module in react-native.
*/
* Custom implementation of a module that doesn't exist in JS,
* like a generated module or a native module in react-native.
*/
},
{virtual: true},
);

View File

@ -51,13 +51,12 @@ const users = {
export default function request(url) {
return new Promise((resolve, reject) => {
const userID = parseInt(url.substr('/users/'.length), 10);
process.nextTick(
() =>
users[userID]
? resolve(users[userID])
: reject({
error: 'User with ' + userID + ' not found.',
}),
process.nextTick(() =>
users[userID]
? resolve(users[userID])
: reject({
error: 'User with ' + userID + ' not found.',
}),
);
});
}

View File

@ -126,9 +126,9 @@ jest.mock(
'../moduleName',
() => {
/*
* Custom implementation of a module that doesn't exist in JS,
* like a generated module or a native module in react-native.
*/
* Custom implementation of a module that doesn't exist in JS,
* like a generated module or a native module in react-native.
*/
},
{virtual: true},
);

View File

@ -51,13 +51,12 @@ const users = {
export default function request(url) {
return new Promise((resolve, reject) => {
const userID = parseInt(url.substr('/users/'.length), 10);
process.nextTick(
() =>
users[userID]
? resolve(users[userID])
: reject({
error: 'User with ' + userID + ' not found.',
}),
process.nextTick(() =>
users[userID]
? resolve(users[userID])
: reject({
error: 'User with ' + userID + ' not found.',
}),
);
});
}

View File

@ -208,9 +208,9 @@ jest.mock(
'../moduleName',
() => {
/*
* Custom implementation of a module that doesn't exist in JS,
* like a generated module or a native module in react-native.
*/
* Custom implementation of a module that doesn't exist in JS,
* like a generated module or a native module in react-native.
*/
},
{virtual: true},
);

View File

@ -208,9 +208,9 @@ jest.mock(
'../moduleName',
() => {
/*
* Custom implementation of a module that doesn't exist in JS,
* like a generated module or a native module in react-native.
*/
* Custom implementation of a module that doesn't exist in JS,
* like a generated module or a native module in react-native.
*/
},
{virtual: true},
);

View File

@ -208,9 +208,9 @@ jest.mock(
'../moduleName',
() => {
/*
* Custom implementation of a module that doesn't exist in JS,
* like a generated module or a native module in react-native.
*/
* Custom implementation of a module that doesn't exist in JS,
* like a generated module or a native module in react-native.
*/
},
{virtual: true},
);

View File

@ -208,9 +208,9 @@ jest.mock(
'../moduleName',
() => {
/*
* Custom implementation of a module that doesn't exist in JS,
* like a generated module or a native module in react-native.
*/
* Custom implementation of a module that doesn't exist in JS,
* like a generated module or a native module in react-native.
*/
},
{virtual: true},
);

View File

@ -209,9 +209,9 @@ jest.mock(
'../moduleName',
() => {
/*
* Custom implementation of a module that doesn't exist in JS,
* like a generated module or a native module in react-native.
*/
* Custom implementation of a module that doesn't exist in JS,
* like a generated module or a native module in react-native.
*/
},
{virtual: true},
);

View File

@ -51,13 +51,12 @@ const users = {
export default function request(url) {
return new Promise((resolve, reject) => {
const userID = parseInt(url.substr('/users/'.length), 10);
process.nextTick(
() =>
users[userID]
? resolve(users[userID])
: reject({
error: 'User with ' + userID + ' not found.',
}),
process.nextTick(() =>
users[userID]
? resolve(users[userID])
: reject({
error: 'User with ' + userID + ' not found.',
}),
);
});
}

View File

@ -5286,10 +5286,10 @@ eslint-config-fbjs@^2.1.0:
resolved "https://registry.yarnpkg.com/eslint-config-fbjs/-/eslint-config-fbjs-2.1.0.tgz#bfe4f8c2d2282bfe515359553905d830e3a5d12f"
integrity sha512-wh7Lveo51V3/SUydWtR2VEU8wNfSHt5V7YzIUKTRkHF3kvkCwFtM6Jgsn+xBNkjxZGpfWgNJN/drk1LLx64Dww==
eslint-config-prettier@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-3.0.1.tgz#479214f64c1a4b344040924bfb97543db334b7b1"
integrity sha512-vA0TB8HCx/idHXfKHYcg9J98p0Q8nkfNwNAoP7e+ywUidn6ScaFS5iqncZAHPz+/a0A/tp657ulFHFx/2JDP4Q==
eslint-config-prettier@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-3.1.0.tgz#2c26d2cdcfa3a05f0642cd7e6e4ef3316cdabfa2"
integrity sha512-QYGfmzuc4q4J6XIhlp8vRKdI/fI0tQfQPy1dME3UOLprE+v4ssH/3W9LM2Q7h5qBcy5m0ehCrBDU2YF8q6OY8w==
dependencies:
get-stdin "^6.0.0"
@ -5378,10 +5378,10 @@ eslint-plugin-markdown@^1.0.0-beta.6:
remark-parse "^3.0.0"
unified "^6.1.2"
eslint-plugin-prettier@^2.2.0, eslint-plugin-prettier@^2.3.1:
version "2.6.2"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.6.2.tgz#71998c60aedfa2141f7bfcbf9d1c459bf98b4fad"
integrity sha512-tGek5clmW5swrAx1mdPYM8oThrBE83ePh7LeseZHBWfHVGrHPhKn7Y5zgRMbU/9D5Td9K4CEmUPjGxA7iw98Og==
eslint-plugin-prettier@^2.2.0, eslint-plugin-prettier@^2.7.0:
version "2.7.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.7.0.tgz#b4312dcf2c1d965379d7f9d5b5f8aaadc6a45904"
integrity sha512-CStQYJgALoQBw3FsBzH0VOVDRnJ/ZimUlpLm226U8qgqYJfPOY/CPK6wyRInMxh73HSKg5wyRwdS4BVYYHwokA==
dependencies:
fast-diff "^1.1.1"
jest-docblock "^21.0.0"
@ -10839,10 +10839,10 @@ preserve@^0.2.0:
resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"
integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=
prettier@^1.13.3, prettier@^1.13.4:
version "1.14.2"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.2.tgz#0ac1c6e1a90baa22a62925f41963c841983282f9"
integrity sha512-McHPg0n1pIke+A/4VcaS2en+pTNjy4xF+Uuq86u/5dyDO59/TtFZtQ708QIRkEZ3qwKz3GVkVa6mpxK/CpB8Rg==
prettier@^1.13.4, prettier@^1.15.2:
version "1.15.2"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.15.2.tgz#d31abe22afa4351efa14c7f8b94b58bb7452205e"
integrity sha512-YgPLFFA0CdKL4Eg2IHtUSjzj/BWgszDHiNQAe0VAIBse34148whfdzLagRL+QiKS+YfK5ftB6X4v/MBw8yCoug==
pretty-format@^4.2.1:
version "4.3.1"