-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Improve Code Coverage #562
Conversation
src/Logger.js
Outdated
@@ -108,6 +108,10 @@ class Logger { | |||
this.lines++; | |||
} | |||
} | |||
|
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.
Internal _log function to help with stubbing, and to avoid stubbing console.log directly (nasty side-effects).
@@ -1,15 +1,17 @@ | |||
let serverErrorList = { | |||
const serverErrorList = { | |||
EACCES: "You don't have access to bind the server to port {port}.", | |||
EADDRINUSE: 'There is already a process listening on port {port}.' | |||
}; | |||
|
|||
function serverErrors(err, port) { |
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.
Code was previously built to handle unknown errors if (!desc) ...
, but an exception on the .replace
call would prevent this code path from ever executing.
Exposed by tests, fixed.
src/utils/fs.js
Outdated
@@ -5,6 +5,7 @@ const mkdirp = require('mkdirp'); | |||
exports.readFile = promisify(fs.readFile); | |||
exports.writeFile = promisify(fs.writeFile); | |||
exports.stat = promisify(fs.stat); | |||
exports.unlink = promisify(fs.unlink); |
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.
See notes in fs-cache tests.
Codecov Report
@@ Coverage Diff @@
## master #562 +/- ##
==========================================
+ Coverage 89.24% 94.15% +4.91%
==========================================
Files 64 64
Lines 2017 2019 +2
==========================================
+ Hits 1800 1901 +101
+ Misses 217 118 -99
Continue to review full report at Codecov.
|
assert.equal(cached, null); | ||
}); | ||
|
||
it('should remove file on delete', async () => { |
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.
cache.delete
was not working due to fs.unlink
missing from the fs
utility. The implementation catches the error and fails silently. Does not appear to be used today, but is now working correctly.
Exposed by tests, fixed.
assert.equal(cached.dependencies[0].mtime, mtime); | ||
assert.equal(cached.dependencies[1].mtime, undefined); | ||
}); | ||
|
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.
Added tests for #514.
@@ -1,7 +1,7 @@ | |||
module.exports = { |
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.
Gives us coverage on the array branch of loadPlugins
:
parcel/src/utils/loadPlugins.js
Lines 4 to 7 in b56b2a9
if (Array.isArray(plugins)) { | |
return await Promise.all( | |
plugins.map(async p => await loadPlugin(p, relative)).filter(Boolean) | |
); |
Other posthtmlrc is object, for complete coverage.
Awesome, thanks for working on this! 🥇 |
Tests have been updated with master. Notes & explanations can be found in the current and outdated self-review. |
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.
Awesome! 🏆
Goals:
Notes: