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

Rule proposal: avoid setup code outside of tests or hooks #38

Closed
lo1tuma opened this issue Sep 13, 2015 · 1 comment
Closed

Rule proposal: avoid setup code outside of tests or hooks #38

lo1tuma opened this issue Sep 13, 2015 · 1 comment
Labels

Comments

@lo1tuma
Copy link
Owner

lo1tuma commented Sep 13, 2015

This should be considered a warning:

describe('foo',  function ()  {
    var fixture = fs.readFileSync('foo.txt');
});

You should read the file in a before hook instead.

The problem with such code is that it will be executed during the process startup time. It will be even executed if you skip the test suite.


I'm not 100% sure how to achieve this. Disallowing every call expression would also disallow using forEach for parameterized tests.

@lo1tuma
Copy link
Owner Author

lo1tuma commented Mar 2, 2018

Fixed by #147

@lo1tuma lo1tuma closed this as completed Mar 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant