Skip to content
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
2 changes: 2 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"array-bracket-spacing": [2, "never"],
"arrow-spacing": [2],
"babel/arrow-parens": [2, "as-needed"],
"babel/flow-object-type": [2, "comma"],
"babel/func-params-comma-dangle": [2, "always-multiline"],
"brace-style": [2, "1tbs", {"allowSingleLine": true}],
"comma-dangle": [2, "always-multiline"],
"comma-spacing": [2],
Expand Down
5 changes: 5 additions & 0 deletions examples/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"rules": {
"babel/func-params-comma-dangle": 0
}
}
5 changes: 5 additions & 0 deletions integration_tests/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"rules": {
"babel/func-params-comma-dangle": 0
}
}
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"lerna": "2.0.0-beta.20",
"version": "12.1.2",
"version": "12.1.3",
"linkedFiles": {
"prefix": "/**\n * @flow\n */\n"
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"babel-plugin-transform-flow-strip-types": "^6.8.0",
"chalk": "^1.1.3",
"eslint": "^2.13.1",
"eslint-plugin-babel": "^3.2.0",
"eslint-plugin-babel": "^3.3.0",
"fbjs-scripts": "^0.7.1",
"flow-bin": "^0.27.0",
"glob": "^7.0.4",
Expand Down
4 changes: 2 additions & 2 deletions packages/babel-plugin-jest-hoist/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ FUNCTIONS.mock = args => {
const moduleFactory = args[1];
invariant(
moduleFactory.isFunction(),
'The second argument of `jest.mock` must be a function.'
'The second argument of `jest.mock` must be a function.',
);

const ids = new Set();
Expand All @@ -108,7 +108,7 @@ FUNCTIONS.mock = args => {
'reference any outside variables.\n' +
'Invalid variable access: ' + name + '\n' +
'Whitelisted objects: ' +
Object.keys(WHITELISTED_IDENTIFIERS).join(', ') + '.'
Object.keys(WHITELISTED_IDENTIFIERS).join(', ') + '.',
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-changed-files/src/__tests__/hg-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('hgChecker', () => {
it('returns null for non hg repo folder', () =>
hg.isHGRepository(tmpdir).then(res => {
expect(res).toBeNull();
})
}),
);

it('returns dirname for hg repo folder', () => {
Expand All @@ -56,7 +56,7 @@ describe('hgChecker', () => {
it('returns an empty array for hg repo folder without modified files', () =>
hg.findChangedFiles(tmpdir).then(res => {
expect(res).toEqual([]);
})
}),
);

it('returns an array of modified files for hg repo folder', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-changed-files/src/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function findChangedFiles(cwd: string): Promise<Array<Path>> {
resolve([]);
} else {
resolve(stdout.split('\n').map(
changedPath => path.resolve(cwd, changedPath)
changedPath => path.resolve(cwd, changedPath),
));
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-changed-files/src/hg.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function findChangedFiles(cwd: string, options: Options): Promise<Array<Path>> {
resolve([]);
} else {
resolve(stdout.split('\n').map(
changedPath => path.resolve(cwd, changedPath)
changedPath => path.resolve(cwd, changedPath),
));
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-cli/src/CoverageCollector.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ let _memoizedCoverageTemplate = null;
function _getCoverageTemplate() {
if (_memoizedCoverageTemplate === null) {
_memoizedCoverageTemplate = require('lodash.template')(
fs.readFileSync(COVERAGE_TEMPLATE_PATH, 'utf8')
fs.readFileSync(COVERAGE_TEMPLATE_PATH, 'utf8'),
);
}
return _memoizedCoverageTemplate;
Expand Down Expand Up @@ -67,7 +67,7 @@ class CoverageCollector {
for (nodeIndex in instrumentationInfo.nodes) {
if (!this._coverageDataStore.nodes.hasOwnProperty(nodeIndex)) {
coverageInfo.uncoveredSpans.push(
instrumentationInfo.nodes[nodeIndex].loc
instrumentationInfo.nodes[nodeIndex].loc,
);
}
}
Expand Down
14 changes: 7 additions & 7 deletions packages/jest-cli/src/SearchSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ class SearchSource {
}

_getAllTestPaths(
testPathPattern: StrOrRegExpPattern
testPathPattern: StrOrRegExpPattern,
): Promise<SearchResult> {
return this._hasteMap.then(data => (
this._filterTestPathsWithStats(
Object.keys(data.moduleMap.files),
testPathPattern
testPathPattern,
)
));
}
Expand All @@ -142,13 +142,13 @@ class SearchSource {
}

findMatchingTests(
testPathPattern: StrOrRegExpPattern
testPathPattern: StrOrRegExpPattern,
): Promise<SearchResult> {
if (testPathPattern && !(testPathPattern instanceof RegExp)) {
const maybeFile = path.resolve(process.cwd(), testPathPattern);
if (Resolver.fileExists(maybeFile)) {
return Promise.resolve(
this._filterTestPathsWithStats([maybeFile])
this._filterTestPathsWithStats([maybeFile]),
);
}
}
Expand All @@ -164,7 +164,7 @@ class SearchSource {
this.isTestFilePath.bind(this),
{
skipNodeResolution: this._options.skipNodeResolution,
}
},
),
}));
}
Expand All @@ -176,7 +176,7 @@ class SearchSource {
throw new Error(
'It appears that one of your testPathDirs does not exist ' +
'within a git or hg repository. Currently `--onlyChanged` ' +
'only works with git or hg projects.'
'only works with git or hg projects.',
);
}
return Promise.all(Array.from(repos).map(repo => {
Expand All @@ -186,7 +186,7 @@ class SearchSource {
}));
})
.then(changedPathSets => this.findRelatedTests(
new Set(Array.prototype.concat.apply([], changedPathSets))
new Set(Array.prototype.concat.apply([], changedPathSets)),
));
}

Expand Down
4 changes: 2 additions & 2 deletions packages/jest-cli/src/Test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Test {
const TestConsole = config.silent ? NullConsole : Console;
env.global.console = new TestConsole(
config.useStderr ? process.stderr : process.stdout,
process.stderr
process.stderr,
);
env.testFilePath = path;
const moduleLoader = new ModuleLoader(config, env, resolver);
Expand Down Expand Up @@ -74,7 +74,7 @@ class Test {
err => Promise.resolve().then(() => {
env.dispose();
throw err;
})
}),
);
}

Expand Down
16 changes: 8 additions & 8 deletions packages/jest-cli/src/TestRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class TestRunner {
constructor(
hasteMap: Promise<HasteResolverContext>,
config: Config,
options: Options
options: Options,
) {
this._hasteMap = hasteMap;
this._config = config;
Expand All @@ -86,7 +86,7 @@ class TestRunner {
// fastest results.
try {
this._testPerformanceCache = JSON.parse(fs.readFileSync(
this._getTestPerformanceCachePath()
this._getTestPerformanceCachePath(),
));
} catch (e) {}

Expand Down Expand Up @@ -128,7 +128,7 @@ class TestRunner {
if (config.useStderr) {
maybeReporter = new TestReporter(Object.create(
process,
{stdout: {value: process.stderr}}
{stdout: {value: process.stderr}},
));
} else {
maybeReporter = new TestReporter();
Expand Down Expand Up @@ -179,7 +179,7 @@ class TestRunner {
reporter.onTestResult && reporter.onTestResult(
config,
testResult,
aggregatedResults
aggregatedResults,
);
};

Expand Down Expand Up @@ -247,15 +247,15 @@ class TestRunner {
_createInBandTestRun(
testPaths: Array<Path>,
onTestResult: OnTestResult,
onRunFailure: OnRunFailure
onRunFailure: OnRunFailure,
) {
return testPaths.reduce((promise, path) =>
promise
.then(() => this._hasteMap)
.then(data => new Test(path, this._config, data.resolver).run())
.then(result => onTestResult(path, result))
.catch(err => onRunFailure(path, err)),
Promise.resolve()
Promise.resolve(),
);
}

Expand All @@ -282,11 +282,11 @@ class TestRunner {
if (err.type === 'ProcessTerminatedError') {
console.error(
'A worker process has quit unexpectedly! ' +
'Most likely this an initialization error.'
'Most likely this an initialization error.',
);
process.exit(1);
}
}))
})),
)
.then(() => workerFarm.end(farm));
});
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-cli/src/TestWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ module.exports = (data: WorkerData, callback: WorkerCallback) => {
if (!resolvers[name]) {
resolvers[name] = createResolver(
data.config,
createHasteMap(data.config).read()
createHasteMap(data.config).read(),
);
}

new Test(data.path, data.config, resolvers[name])
.run()
.then(
result => callback(null, result),
error => callback(formatError(error))
error => callback(formatError(error)),
);
} catch (error) {
callback(formatError(error));
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-cli/src/__tests__/SearchSource-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ describe('SearchSource', () => {
'jest-runtime',
'src',
'__tests__',
'test_root'
'test_root',
);
const rootPath = path.join(rootDir, 'root.js');

Expand Down
26 changes: 13 additions & 13 deletions packages/jest-cli/src/__tests__/customMatchers-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ describe('jasmine', () => {
(passed, result) => {
expect(passed).toBe(true);
expect(result.message).toBe('');
}
},
);
expectation.toTestJasmine();
expect(actual).toBe(false);
Expand All @@ -122,7 +122,7 @@ describe('jasmine', () => {
(passed, result) => {
expect(passed).toBe(false);
expect(result.message).toBe(SHOULD_BE_CALLED);
}
},
);
expectation.toTestJasmine();
expect(actual).toBe(true);
Expand All @@ -142,7 +142,7 @@ describe('Jest custom matchers in Jasmine 2', () => {
(passed, result) => {
expect(passed).toBe(false);
expect(result.message).toBe(CALLED_AT_LEAST_ONCE);
}
},
);
expectation.toBeCalled();
});
Expand All @@ -152,7 +152,7 @@ describe('Jest custom matchers in Jasmine 2', () => {
(passed, result) => {
expect(passed).toBe(false);
expect(result.message).toBe(SHOULD_NOT_BE_CALLED);
}
},
);
expectation.function();
expectation.not.toBeCalled();
Expand All @@ -163,7 +163,7 @@ describe('Jest custom matchers in Jasmine 2', () => {
(passed, result) => {
expect(passed).toBe(true);
expect(result.message).toBe('');
}
},
);
expectation.function();
expectation.toBeCalled();
Expand All @@ -178,7 +178,7 @@ describe('Jest custom matchers in Jasmine 2', () => {
(passed, result) => {
expect(passed).toBe(true);
expect(result.message).toBe('');
}
},
);
expectation.function(1, {}, '');
expectation.lastCalledWith(1, {}, '');
Expand All @@ -189,7 +189,7 @@ describe('Jest custom matchers in Jasmine 2', () => {
(passed, result) => {
expect(passed).toBe(false);
expect(result.message).toBe(SHOULD_NOT_HAVE_LAST_CALLED_WITH);
}
},
);
expectation.function(1, {}, '');
expectation.not.lastCalledWith(1, {}, '');
Expand All @@ -200,7 +200,7 @@ describe('Jest custom matchers in Jasmine 2', () => {
(passed, result) => {
expect(passed).toBe(false);
expect(result.message).toBe(NOT_EXPECTED_VALUES_LAST_TIME);
}
},
);

expectation.function(1, {}, '');
Expand All @@ -216,7 +216,7 @@ describe('Jest custom matchers in Jasmine 2', () => {
(passed, result) => {
expect(passed).toBe(true);
expect(result.message).toBe('');
}
},
);
expectation.function(1, {}, '');
expectation.toBeCalledWith(1, {}, '');
Expand All @@ -227,7 +227,7 @@ describe('Jest custom matchers in Jasmine 2', () => {
(passed, result) => {
expect(passed).toBe(false);
expect(result.message).toBe(SHOULD_NOT_HAVE_CALLED_WITH);
}
},
);
expectation.function(1, {}, '');
expectation.not.toBeCalledWith(1, {}, '');
Expand All @@ -238,7 +238,7 @@ describe('Jest custom matchers in Jasmine 2', () => {
(passed, result) => {
expect(passed).toBe(false);
expect(result.message).toBe(NOT_EXPECTED_VALUES);
}
},
);

expectation.function(1, {}, '');
Expand All @@ -250,7 +250,7 @@ describe('Jest custom matchers in Jasmine 2', () => {
(passed, result) => {
expect(passed).toBe(false);
expect(result.message).toBe(NOT_EXPECTED_VALUES_EXACTLY_FOUR);
}
},
);

expectation.function(1);
Expand All @@ -265,7 +265,7 @@ describe('Jest custom matchers in Jasmine 2', () => {
(passed, result) => {
expect(passed).toBe(false);
expect(result.message).toBe(NOT_EXPECTED_VALUES_MORE_THAN_FOUR);
}
},
);

expectation.function(1);
Expand Down
Loading