You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 6, 2021. It is now read-only.
I am using the module but I am a bit confused how the assertions are used. As I see in the core project, you are using the assertions against the options object. For example, in the c9.core/client.js it is used like that:
assert(options.baseUrl, "Option 'baseUrl' is required")
It is not used against imports though. For example, in the c9.vfs.standalone/standalone.js the preview handler it is imported like that:
var previewHandler = imports["preview.handler"];
What if a developer forget to add this dependency in the consume array? The previewHandler it will be undefined and it will break at runtime in this specific example. Why there is not an assertion like that:
assert(imports["preview.handler"], "preview.handler is required");
Is there something that I am missing?
The text was updated successfully, but these errors were encountered:
Adding assertions like that for every used service would make code too verbose/unreadable.
requirement to manually update the list of dependencies in the consumes array is indeed problem, we should either make a eslint rule for it, or automatically infer list of dependencies using toString similar to what require.js does, but in the latter case performance overhead is significant for a large project like cloud9
We start adding assertions and finally the code became too verbose. Finally we god a decision to check the consumes array into the unit tests. The array is exported and we can compare the result with the definition in the unit test. If someone for a reason changes the dependencies (adding or removing a dependency) the unit test will break.
Hi there,
I am using the module but I am a bit confused how the assertions are used. As I see in the core project, you are using the assertions against the options object. For example, in the c9.core/client.js it is used like that:
It is not used against imports though. For example, in the c9.vfs.standalone/standalone.js the preview handler it is imported like that:
What if a developer forget to add this dependency in the consume array? The previewHandler it will be undefined and it will break at runtime in this specific example. Why there is not an assertion like that:
Is there something that I am missing?
The text was updated successfully, but these errors were encountered: