-
Notifications
You must be signed in to change notification settings - Fork 2
Maintenance #144
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
Maintenance #144
Conversation
test/test_plugins.js
Outdated
| }); | ||
|
|
||
| it("balks at invalid buckets", () => { | ||
| // FIXME: unhandled promise rejection |
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.
unskipping this test results in:
ℹ Error: Test "balks at invalid buckets" at test/test_plugins.js:234:2 generated asynchronous activity after the test ended. This activity created the error "AssertionError [ERR_ASSERTION]: Got unwanted rejection.
Actual message: "exit 1"" and would have caused the test to fail, but instead triggered an unhandledRejection event.
ℹ Error: Test "balks at invalid buckets" at test/test_plugins.js:234:2 generated asynchronous activity after the test ended. This activity created the error "AssertionError [ERR_ASSERTION]: Got unwanted rejection.
Actual message: "exit 1"" and would have caused the test to fail, but instead triggered an unhandledRejection event.
ℹ Error: Test "balks at invalid buckets" at test/test_plugins.js:234:2 generated asynchronous activity after the test ended. This activity created the error "AssertionError [ERR_ASSERTION]: Got unwanted rejection.
Actual message: "exit 1"" and would have caused the test to fail, but instead triggered an unhandledRejection event.
ℹ Error: Test "balks at invalid buckets" at test/test_plugins.js:234:2 generated asynchronous activity after the test ended. This activity created the error "AssertionError [ERR_ASSERTION]: Got unwanted rejection.
Actual message: "exit 1"" and would have caused the test to fail, but instead triggered an unhandledRejection event.
The code runs into the abort. This seems to lead to an unhandled promise rejection 🤔 Any idea, @FND ?
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.
assert.rejects() and assert.doesNotReject() should be awaited I believe.
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.
Thank you, but that doesn't change the error.
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.
It looks like the unhandledRejection events are present on the main branch, but not being reported anywhere. This diff seems to make them go away for me locally:
diff --git a/test/test_plugins.js b/test/test_plugins.js
index 104631d..808136e 100644
--- a/test/test_plugins.js
+++ b/test/test_plugins.js
@@ -1,6 +1,5 @@
/* global describe, before, after, it */
"use strict";
-
let { pluginsByBucket, _determinePlugins } = require("../lib/plugins");
let path = require("path");
let assert = require("assert");
@@ -187,12 +186,12 @@ describe("plugin resolution", () => {
}));
});
- it("balks at invalid package identifiers", () => {
- assert.rejects(async () => {
+ it("balks at invalid package identifiers", async () => {
+ await assert.rejects(async () => {
return _determinePlugins(["faucet-pipeline-yummy"]);
}, /exit 1/);
- assert.rejects(() => {
+ await assert.rejects(() => {
return _determinePlugins([{
// NB: local configuration must not be comprehensive to ensure
// plugin is loaded
@@ -202,8 +201,8 @@ describe("plugin resolution", () => {
}, /exit 1/);
});
- it("balks at duplicate configuration keys", () => {
- assert.rejects(() => {
+ it("balks at duplicate configuration keys", async () => {
+ await assert.rejects(() => {
return _determinePlugins([{
key: "dummy",
bucket: "static",
@@ -216,34 +215,36 @@ describe("plugin resolution", () => {
}, /exit 1/);
});
- it("balks at invalid plugins", () => {
- assert.rejects(() => {
+ it("balks at invalid plugins", async () => {
+ await assert.rejects(() => {
return _determinePlugins(["faucet-pipeline-invalid-a"]);
}, /exit 1/);
- assert.rejects(() => {
+ await assert.rejects(() => {
return _determinePlugins(["faucet-pipeline-invalid-b"]);
}, /exit 1/);
- assert.rejects(() => {
+ await assert.rejects(() => {
return _determinePlugins(["faucet-pipeline-invalid-c"]);
}, /exit 1/);
});
- it("balks at invalid buckets", () => {
+ it("balks at invalid buckets", async () => {
let plugin = {
key: "dummy",
plugin: () => {}
};
- ["static", "scripts", "styles", "markup"].forEach(bucket => {
+ const buckets = ["static", "scripts", "styles", "markup"];
+ for(let i = 0; i < buckets.length; ++i) {
+ const bucket = buckets[i];
plugin.bucket = bucket;
- assert.doesNotReject(() => {
- return _determinePlugins([plugin]);
+ await assert.doesNotReject(async () => {
+ await _determinePlugins([plugin]);
}, /exit 1/);
- });
+ }
plugin.bucket = "dummy";
- assert.rejects(() => {
+ await assert.rejects(() => {
return _determinePlugins([plugin]);
}, /exit 1/);
});
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.
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.
Oh wow, thanks @cjihrig! I remember getting tripped up by that a few times in the past - so probably wouldn't have spotted this here right away...
Out of curiosity: Do you have some kind of alert for Node's test runner or how did you notice this obscure PR?
Either way, thanks for your work on that: It helps reduce suffering in the world.
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.
Not an alert. I just happened to be doing a GitHub code search yesterday 😄
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.
Lucky us! 🙇
FND
left a comment
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.
Excellent work - thank you!
| }, | ||
| "devDependencies": { | ||
| "eslint-config-fnd": "^1.13.0", | ||
| "mocha": "^10.2.0", |
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 delightful! If I'm not mistaken, this should get rid of a whopping 130 dependencies - except json5 and tsconfig-paths depend on minimist as well for some reason, so it's "just" 50 fewer dependencies.
On a related note, because both those packages appear to be transitive dependencies of eslint-config-fnd: I've recently decided not to bother upgrading the latter (which triggers deprecation warnings) because that's a major pita, plus that elaborate DIY style was never a good idea in the first place... 😬 So, uhm, apologies for sinking our ecosystem in favor of pixel perfection?
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.
So... you are now using deno lint && deno format instead of eslint-config-fnd?
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.
Correct. It's still a risk, but less so. (Of course diff pollution seems likely either way.)
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.
Tracked as #145
Uh oh!
There was an error while loading. Please reload this page.