Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

errorMessage is leaked to global scope #1104

Closed
thom-nic opened this issue Dec 5, 2017 · 3 comments
Closed

errorMessage is leaked to global scope #1104

thom-nic opened this issue Dec 5, 2017 · 3 comments

Comments

@thom-nic
Copy link

thom-nic commented Dec 5, 2017

Mocha (I believe) is detecting variables leaked to global scope. I just upgrade from chai v3.5 to v4.1.2 now I am getting the following test failures:

Error: global leak detected: errorMessage

if I grep -rn errorMessage node_modules/chai I see:

node_modules/chai/chai.js
1513:      errorMessage = msgPrefix + 'the argument to above must be a date';
1515:      errorMessage = msgPrefix + 'the argument to above must be a number';
1518:      errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date';
1524:      throw new AssertionError(errorMessage, undefined, ssfi);
1609:      errorMessage = msgPrefix + 'the argument to least must be a date';
1611:      errorMessage = msgPrefix + 'the argument to least must be a number';
1614:      errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date';
1620:      throw new AssertionError(errorMessage, undefined, ssfi);
1704:      errorMessage = msgPrefix + 'the argument to below must be a date';
1706:      errorMessage = msgPrefix + 'the argument to below must be a number';
1709:      errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date';
1715:      throw new AssertionError(errorMessage, undefined, ssfi);
1799:      errorMessage = msgPrefix + 'the argument to most must be a date';
1801:      errorMessage = msgPrefix + 'the argument to most must be a number';
1804:      errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date';
1810:      throw new AssertionError(errorMessage, undefined, ssfi);
1898:      errorMessage = msgPrefix + 'the arguments to within must be dates';
1900:      errorMessage = msgPrefix + 'the arguments to within must be numbers';
1903:      errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date';
1909:      throw new AssertionError(errorMessage, undefined, ssfi);

node_modules/chai/lib/chai/core/assertions.js
1152:      errorMessage = msgPrefix + 'the argument to above must be a date';
1154:      errorMessage = msgPrefix + 'the argument to above must be a number';
1157:      errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date';
1163:      throw new AssertionError(errorMessage, undefined, ssfi);
1248:      errorMessage = msgPrefix + 'the argument to least must be a date';
1250:      errorMessage = msgPrefix + 'the argument to least must be a number';
1253:      errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date';
1259:      throw new AssertionError(errorMessage, undefined, ssfi);
1343:      errorMessage = msgPrefix + 'the argument to below must be a date';
1345:      errorMessage = msgPrefix + 'the argument to below must be a number';
1348:      errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date';
1354:      throw new AssertionError(errorMessage, undefined, ssfi);
1438:      errorMessage = msgPrefix + 'the argument to most must be a date';
1440:      errorMessage = msgPrefix + 'the argument to most must be a number';
1443:      errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date';
1449:      throw new AssertionError(errorMessage, undefined, ssfi);
1537:      errorMessage = msgPrefix + 'the arguments to within must be dates';
1539:      errorMessage = msgPrefix + 'the arguments to within must be numbers';
1542:      errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date';
1548:      throw new AssertionError(errorMessage, undefined, ssfi);```

I don't see any var, let or const declaring errorMessage so it appears that indeed it appears to be leaking into the global scope.

@meeber
Copy link
Contributor

meeber commented Dec 6, 2017

Fixed in master via #1040 but not released yet

@meeber meeber closed this as completed Dec 6, 2017
@acrodrig
Copy link

I am getting lots of errors of this types well. Has this made it to a release?

@ricardograca
Copy link

@acrodrig Doesn't look like it. The commit where this was fixed isn't in any released version yet.

pauldps added a commit to pauldps/gfa-core that referenced this issue Aug 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants