Skip to content

Commit

Permalink
Run prettier.
Browse files Browse the repository at this point in the history
  • Loading branch information
cpojer committed Apr 27, 2017
1 parent b2b13de commit 91c5b95
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 42 deletions.
5 changes: 3 additions & 2 deletions packages/jest-cli/src/TestNamePatternPrompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const stringLength = require('string-length');
const Prompt = require('./lib/Prompt');
const formatTestNameByPattern = require('./lib/formatTestNameByPattern');

const pluralizeTest = (total: number) => total === 1 ? 'test' : 'tests';
const pluralizeTest = (total: number) => (total === 1 ? 'test' : 'tests');

const usage = () =>
`\n${chalk.bold('Pattern Mode Usage')}\n` +
Expand Down Expand Up @@ -124,7 +124,8 @@ module.exports = class TestNamePatternPrompt {
if (regex.test(title)) {
matchedTests.push(title);
}
}));
}),
);

return matchedTests;
}
Expand Down
5 changes: 3 additions & 2 deletions packages/jest-cli/src/TestPathPatternPrompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type SearchSources = Array<{|
searchSource: SearchSource,
|}>;

const pluralizeFile = (total: number) => total === 1 ? 'file' : 'files';
const pluralizeFile = (total: number) => (total === 1 ? 'file' : 'files');

const usage = () =>
`\n${chalk.bold('Pattern Mode Usage')}\n` +
Expand Down Expand Up @@ -112,7 +112,8 @@ module.exports = class TestPathPatternPrompt {
return highlight(path, filePath, pattern, context.config.rootDir);
})
.forEach(filePath =>
this._pipe.write(`\n ${chalk.dim('\u203A')} ${filePath}`));
this._pipe.write(`\n ${chalk.dim('\u203A')} ${filePath}`),
);

if (total > max) {
const more = total - max;
Expand Down
63 changes: 31 additions & 32 deletions packages/jest-cli/src/__tests__/watch-filename-pattern-mode-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,42 +29,42 @@ jest.mock('ansi-escapes', () => ({

jest.mock(
'../SearchSource',
() =>
class {
constructor(context) {
this._context = context;
}

findMatchingTests(pattern) {
const paths = [
'./path/to/file1-test.js',
'./path/to/file2-test.js',
'./path/to/file3-test.js',
'./path/to/file4-test.js',
'./path/to/file5-test.js',
'./path/to/file6-test.js',
'./path/to/file7-test.js',
'./path/to/file8-test.js',
'./path/to/file9-test.js',
'./path/to/file10-test.js',
'./path/to/file11-test.js',
].filter(path => path.match(pattern));

return {
tests: paths.map(path => ({
context: this._context,
duration: null,
path,
})),
};
}
},
() => class {
constructor(context) {
this._context = context;
}

findMatchingTests(pattern) {
const paths = [
'./path/to/file1-test.js',
'./path/to/file2-test.js',
'./path/to/file3-test.js',
'./path/to/file4-test.js',
'./path/to/file5-test.js',
'./path/to/file6-test.js',
'./path/to/file7-test.js',
'./path/to/file8-test.js',
'./path/to/file9-test.js',
'./path/to/file10-test.js',
'./path/to/file11-test.js',
].filter(path => path.match(pattern));

return {
tests: paths.map(path => ({
context: this._context,
duration: null,
path,
})),
};
}
},
);

jest.doMock('chalk', () =>
Object.assign(new chalk.constructor({enabled: false}), {
stripColor: str => str,
}));
}),
);

jest.doMock(
'../runJest',
Expand All @@ -86,7 +86,6 @@ jest.doMock('../lib/terminalUtils', () => ({

const watch = require('../watch');


const toHex = char => Number(char.charCodeAt(0)).toString(16);

const globalConfig = {watch: true};
Expand Down
5 changes: 1 addition & 4 deletions packages/jest-config/src/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ const cacheDirectory = (() => {
// On some platforms tmpdir() is `/tmp`, causing conflicts between different
// users and permission issues. Adding an additional subdivision by UID can
// help.
return path.join(
os.tmpdir(),
'jest_' + getuid.call(process).toString(36),
);
return path.join(os.tmpdir(), 'jest_' + getuid.call(process).toString(36));
})();

module.exports = ({
Expand Down
7 changes: 5 additions & 2 deletions packages/jest-runtime/src/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,11 @@ const writeCacheFile = (cachePath: Path, fileData: string) => {
try {
fs.writeFileSync(cachePath, fileData, 'utf8');
} catch (e) {
e.message = 'jest: failed to cache transform results in: ' + cachePath +
'\nFailure message: ' + e.message;
e.message =
'jest: failed to cache transform results in: ' +
cachePath +
'\nFailure message: ' +
e.message;
removeFile(cachePath);
throw e;
}
Expand Down

0 comments on commit 91c5b95

Please sign in to comment.