Skip to content

Commit

Permalink
fix(tests): Fix Jest caching
Browse files Browse the repository at this point in the history
Explicitly define cache directory so Jest can cache properly.  Switch
cache cli option again.
  • Loading branch information
evansiroky committed Sep 28, 2016
1 parent c42b8c3 commit 4751cd5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bin/mastarm
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ commander
.description('Run tests using Jest')
.option('-u, --update-snapshots', 'Force update of snapshots. USE WITH CAUTION.')
.option('--coverage', 'Run Jest with coverage reporting')
.option('--cache', 'Run Jest with cache')
.option('--no-cache', 'Run Jest with cache')
.action(function (options) {
const jest = require('jest')
const config = loadConfig(process.cwd(), commander.config, commander.env)
Expand Down
3 changes: 2 additions & 1 deletion lib/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const path = require('path')

module.exports.generateTestConfig = (options) => {
const jestConfig = {
cacheDirectory: 'tmp',
collectCoverage: options.coverage,
collectCoverageFrom: ['lib/**/*.js'],
coverageDirectory: 'coverage',
Expand All @@ -11,7 +12,7 @@ module.exports.generateTestConfig = (options) => {
if (options.updateSnapshots) {
jestArguments.push('-u')
}
if (!options.cache) {
if (options.cache === false) {
jestArguments.push('--no-cache')
}
jestArguments.push('--config', JSON.stringify(jestConfig))
Expand Down

0 comments on commit 4751cd5

Please sign in to comment.