Comparing version 0.1.17 to 0.1.18
@@ -80,7 +80,15 @@ #!/usr/bin/env node | ||
if (numFailedTests) { | ||
results += colors.colorize(numFailedTests + ' tests failed', colors.RED + colors.BOLD) + ', '; | ||
results += | ||
colors.colorize( | ||
[numFailedTests, (numFailedTests > 1 ? 'tests' : 'test'), 'failed'].join(' '), | ||
colors.RED + colors.BOLD | ||
); | ||
results += ', '; | ||
} | ||
results += | ||
colors.colorize(numPassedTests + ' tests passed', colors.GREEN + colors.BOLD) + | ||
' (' + numTotalTests + ' total)'; | ||
colors.colorize( | ||
[numPassedTests, (numPassedTests > 1 ? 'tests' : 'test'), 'passed'].join(' '), | ||
colors.GREEN + colors.BOLD | ||
); | ||
results += ' (' + numTotalTests + ' total)'; | ||
@@ -128,5 +136,12 @@ console.log(results); | ||
// Old versions of the Jest CLI do not pass an onComplete callback, so it's | ||
// important that we provide backward compatibility in the API | ||
if (!onComplete) { | ||
onComplete = function() {}; | ||
} | ||
if (argv.version) { | ||
console.log('v' + _getJestVersion()); | ||
onComplete(true); | ||
return; | ||
} | ||
@@ -136,3 +151,7 @@ | ||
if (argv.config) { | ||
config = utils.loadConfigFromFile(argv.config); | ||
if (typeof argv.config === 'string') { | ||
config = utils.loadConfigFromFile(argv.config); | ||
} else if (typeof argv.config === 'object') { | ||
config = Q(utils.normalizeConfig(argv.config)); | ||
} | ||
} else { | ||
@@ -183,3 +202,6 @@ var pkgJsonPath = path.join(packageRoot, 'package.json'); | ||
.then(function(matchingTestPaths) { | ||
console.log('Found ' + matchingTestPaths.length + ' matching tests...'); | ||
var numMatchingTestPaths = matchingTestPaths.length; | ||
console.log( | ||
['Found', numMatchingTestPaths, 'matching', (numMatchingTestPaths > 1 ? 'tests...' : 'test...')].join(' ') | ||
); | ||
if (argv.runInBand) { | ||
@@ -186,0 +208,0 @@ return testRunner.runTestsInBand(matchingTestPaths, _onResultReady); |
{ | ||
"name": "jest-cli", | ||
"description": "Painless JavaScript Unit Testing.", | ||
"version": "0.1.17", | ||
"version": "0.1.18", | ||
"main": "bin/jest.js", | ||
@@ -6,0 +6,0 @@ "dependencies": { |
@@ -123,2 +123,18 @@ /** | ||
pit('requires a JSON file twice successfully', function() { | ||
return buildLoader().then(function(loader) { | ||
var exports1 = loader.requireModule( | ||
__filename, | ||
'./test_root/JSONFile.json' | ||
); | ||
var exports2 = loader.requireModule( | ||
__filename, | ||
'./test_root/JSONFile.json' | ||
); | ||
expect(exports1.isJSONModule).toBe(true); | ||
expect(exports2.isJSONModule).toBe(true); | ||
expect(exports1).toBe(exports2); | ||
}); | ||
}); | ||
describe('features I want to remove, but must exist for now', function() { | ||
@@ -125,0 +141,0 @@ /** |
@@ -867,10 +867,2 @@ /** | ||
if (!moduleObj) { | ||
// Good ole node... | ||
if (path.extname(modulePath) === '.json') { | ||
return this._moduleRegistry[modulePath] = JSON.parse(fs.readFileSync( | ||
modulePath, | ||
'utf8' | ||
)); | ||
} | ||
// We must register the pre-allocated module object first so that any | ||
@@ -888,3 +880,11 @@ // circular dependencies that may arise while evaluating the module can | ||
this._execModule(moduleObj); | ||
// Good ole node... | ||
if (path.extname(modulePath) === '.json') { | ||
moduleObj.exports = JSON.parse(fs.readFileSync( | ||
modulePath, | ||
'utf8' | ||
)); | ||
} else { | ||
this._execModule(moduleObj); | ||
} | ||
} | ||
@@ -891,0 +891,0 @@ |
@@ -27,3 +27,3 @@ /** | ||
*/ | ||
maxWorkers: os.cpus().length - 1, | ||
maxWorkers: Math.max(os.cpus().length - 1, 1), | ||
@@ -30,0 +30,0 @@ /** |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
578275
55
7852