Comparing version 0.1.12 to 0.1.13
{ | ||
"name": "jest-cli", | ||
"description": "Painless JavaScript Unit Testing.", | ||
"version": "0.1.12", | ||
"version": "0.1.13", | ||
"dependencies": { | ||
@@ -6,0 +6,0 @@ "coffee-script": "1.7.1", |
@@ -49,2 +49,3 @@ # [Jest](http://facebook.github.io/jest/) [![Build Status](https://travis-ci.org/facebook/jest.svg?branch=master)](https://travis-ci.org/facebook/jest) | ||
- [`config.collectCoverageOnlyFrom` [object]](http://facebook.github.io/jest/docs/api.html#config-collectcoverageonlyfrom-object) | ||
- [`config.globals` [object]](http://facebook.github.io/jest/docs/api.html#config-globals-object) | ||
- [`config.modulePathIgnorePatterns` [array<string>]](http://facebook.github.io/jest/docs/api.html#config-modulepathignorepatterns-array-string) | ||
@@ -51,0 +52,0 @@ - [`config.rootDir` [string]](http://facebook.github.io/jest/docs/api.html#config-rootdir-string) |
@@ -12,3 +12,16 @@ /** | ||
function JSDomEnvironment() { | ||
function _deepCopy(obj) { | ||
var newObj = {}; | ||
var value; | ||
for (var key in obj) { | ||
value = obj[key]; | ||
if (typeof value === 'object' && value !== null) { | ||
value = _deepCopy(value); | ||
} | ||
newObj[key] = value; | ||
} | ||
return newObj; | ||
} | ||
function JSDomEnvironment(config) { | ||
// We lazily require jsdom because it takes a good ~.5s to load. | ||
@@ -73,2 +86,9 @@ // | ||
this.global.process = process; | ||
// Apply any user-specified global vars | ||
var globalValues = _deepCopy(config.globals); | ||
for (var customGlobalKey in globalValues) { | ||
// Always deep-copy objects so isolated test environments can't share memory | ||
this.global[customGlobalKey] = globalValues[customGlobalKey]; | ||
} | ||
} | ||
@@ -75,0 +95,0 @@ |
@@ -16,3 +16,3 @@ /** | ||
this._global = global; | ||
this._uuidCounter = 0; | ||
this._uuidCounter = 1; | ||
this._maxLoops = maxLoops || 100000; | ||
@@ -19,0 +19,0 @@ |
@@ -16,2 +16,3 @@ /** | ||
cacheDirectory: path.resolve(__dirname, '..', '..', '.haste_cache'), | ||
globals: {}, | ||
moduleLoader: require.resolve('../HasteModuleLoader/HasteModuleLoader'), | ||
@@ -155,2 +156,3 @@ modulePathIgnorePatterns: [], | ||
// Normalize user-supplied config options | ||
Object.keys(config).reduce(function(newConfig, key) { | ||
@@ -204,2 +206,3 @@ var value; | ||
case 'collectCoverage': | ||
case 'globals': | ||
case 'moduleLoader': | ||
@@ -269,2 +272,9 @@ case 'name': | ||
var fileData = fs.readFileSync(filePath, 'utf8'); | ||
// If the file data starts with a shebang remove it (but leave the line empty | ||
// to keep stack trace line numbers correct) | ||
if (fileData.substr(0, 2) === '#!') { | ||
fileData = fileData.replace(/^#!.*$/, ''); | ||
} | ||
if (config.scriptPreprocessor) { | ||
@@ -271,0 +281,0 @@ try { |
@@ -292,3 +292,3 @@ /** | ||
var env = new configDeps.testEnvironment(); | ||
var env = new configDeps.testEnvironment(config); | ||
var testRunner = configDeps.testRunner; | ||
@@ -295,0 +295,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
291743
7603
96