Skip to content

Commit

Permalink
Updates for cache directories. (jestjs#1345)
Browse files Browse the repository at this point in the history
  • Loading branch information
cpojer authored Aug 1, 2016
1 parent 3282e9a commit b8f780c
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 13 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
## master

## jest 14.1.0

* Changed Jest's default cache directory.
* Fixed `jest-react-native` for react 15.3.0.
* Updated react and react-native example to use `react-test-renderer`.
* Started to refactor code coverage.

## jest 14.0.2

* `babel-jest` bugfix.

## jest 14.0.1

* `babel-jest` can now be used to compose a transformer.
Expand Down
6 changes: 5 additions & 1 deletion packages/jest-cli/src/SearchSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,11 @@ class SearchSource {

return (
`${chalk.bold.red('NO TESTS FOUND')}. ` +
`${pluralize('file', data.total || 1, 's')} checked.\n${statsMessage}`
(data.total
? `${pluralize('file', data.total || 0, 's')} checked.\n${statsMessage}`
: `No files found in ${config.rootDir}.\n` +
`Make sure Jest's configuration does not exclude this directory.`
)
);
}

Expand Down
3 changes: 2 additions & 1 deletion packages/jest-config/src/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ import type {DefaultConfig} from 'types/Config';

const constants = require('./constants');
const os = require('os');
const path = require('path');
const utils = require('jest-util');

module.exports = ({
automock: true,
bail: false,
browser: false,
cacheDirectory: os.tmpdir(),
cacheDirectory: path.join(os.tmpdir(), 'jest'),
colors: false,
coveragePathIgnorePatterns: [
utils.replacePathSepForRegex(constants.NODE_MODULES),
Expand Down
22 changes: 13 additions & 9 deletions packages/jest-haste-map/src/crawlers/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,20 @@ function findNative(
.filter(x => !ignore(x));
const result = [];
let count = lines.length;
lines.forEach(path => {
fs.stat(path, (err, stat) => {
if (!err && stat) {
result.push([path, stat.mtime.getTime()]);
}
if (--count === 0) {
callback(result);
}
if (!count) {
callback([]);
} else {
lines.forEach(path => {
fs.stat(path, (err, stat) => {
if (!err && stat) {
result.push([path, stat.mtime.getTime()]);
}
if (--count === 0) {
callback(result);
}
});
});
});
}
});
}

Expand Down
4 changes: 2 additions & 2 deletions packages/jest-runtime/src/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ const cachedTransformAndWrap = (
const transformAndBuildScript = (
filename: Path,
config: Config,
options?: Options,
options: ?Options,
): vm.Script => {
const isInternalModule = !!(options && options.isInternalModule);
const content = stripShebang(fs.readFileSync(filename, 'utf8'));
Expand All @@ -309,7 +309,7 @@ const transformAndBuildScript = (
module.exports = (
filename: Path,
config: Config,
options?: Options,
options: ?Options,
): vm.Script => {
const scriptCacheKey = getScriptCacheKey(filename, config);
let script = cache.get(scriptCacheKey);
Expand Down

0 comments on commit b8f780c

Please sign in to comment.