Excuse root._ export from coverage.

This commit is contained in:
John-David Dalton
2015-12-30 16:31:37 -06:00
parent 5202294ae2
commit 6229e02806
2 changed files with 8 additions and 2 deletions

View File

@@ -46,6 +46,7 @@ before_install:
PATTERN[5]="|\bindex,\s*iterable\)\s*===\s*false\)[^}]+?(break;)|"
PATTERN[6]="|\s*if\s*\(!lodashFunc\)\s*\{\s*return;\s*\}|"
PATTERN[7]="|\s*define\([\s\S]+?\);|"
PATTERN[8]="|\s*root\._\s*=\s*_;|"
if [ $ISTANBUL == true ]; then
set -e

View File

@@ -206,6 +206,11 @@
(_.runInContext ? _.runInContext(root) : _)
));
/** Used to detect instrumented istanbul code coverage runs. */
var coverage = root.__coverage__ || root[lodashStable.findKey(root, function(value, key) {
return /^(?:\$\$cov_\d+\$\$)$/.test(key);
})];
/** Used to restore the `_` reference. */
var oldDash = root._;
@@ -13972,12 +13977,12 @@
QUnit.test('should work with a `root` of `this`', function(assert) {
assert.expect(2);
if (!isModularize && !document && realm.object) {
if (!isModularize && !coverage && (!document && realm.object)) {
var fs = require('fs'),
vm = require('vm'),
expected = {},
context = vm.createContext({ '_': expected, 'console': console }),
source = fs.readFileSync(filePath);
source = fs.readFileSync(filePath, 'utf8');
vm.runInContext(source + '\nthis.lodash = this._.noConflict()', context);