-
Notifications
You must be signed in to change notification settings - Fork 155
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
Update fs.spec.js to use strict mode and changed var to let #693
Conversation
Codecov Report
@@ Coverage Diff @@
## master #693 +/- ##
==========================================
- Coverage 86.71% 86.63% -0.08%
==========================================
Files 16 16
Lines 1746 1736 -10
==========================================
- Hits 1514 1504 -10
Misses 232 232
Continue to review full report at Codecov.
|
For the require lines at the top of the file it's better to use const instead of let especially since those are global declarations also shouldn't be modifiable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the require lines should be const
@@ -1,19 +1,21 @@ | |||
var Filer = require('../../src'); | |||
var util = require('../lib/test-utils.js'); | |||
var expect = require('chai').expect; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should change to const
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really close. I agree with @woosle1234, you can switch to const
for all your let
's below. Every one of these variables is set, but then never changes; perfect for const
.
Can you update that, push again, and let me know when it's done? I'll re-review and hopefully we can merge.
Changed global variables
@humphd @woosle1234 The global variables have been changed as per request, please review the code again and let me know if anything else would need to be changed |
tests/spec/fs.spec.js
Outdated
|
||
describe('fs', function() { | ||
beforeEach(util.setup); | ||
afterEach(util.cleanup); | ||
|
||
it('is an object', function() { | ||
var fs = util.fs(); | ||
let fs = util.fs(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const
here too, fs
never changes.
tests/spec/fs.spec.js
Outdated
expect(typeof fs).to.equal('object'); | ||
expect(fs).to.be.an.instanceof(Filer.FileSystem); | ||
}); | ||
|
||
it('should have a root directory', function(done) { | ||
var fs = util.fs(); | ||
let fs = util.fs(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here, const
, fs
never changes.
changed let to const
Updated to use strict mode to detect silent errors
changed the var to let in order to be transferable in the future