-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
Publish ambient types #77
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
export default class TestLoader { | ||
/** Instantiates a new TestLoader and loads the modules. */ | ||
static load(): void; | ||
|
||
/** | ||
* Can be overridden in order to customize the criteria for identifying test | ||
* modules. | ||
*/ | ||
shouldLoadModule(moduleName: string): boolean; | ||
|
||
moduleLoadFailure(moduleName: string, error: unknown): void; | ||
|
||
/** Use `TestLoader.load()` static method instead. */ | ||
protected constructor(); | ||
|
||
// Assumed private: | ||
// loadModules(): void; | ||
// listModules(): string[]; | ||
// listTestModules(): string[]; | ||
// require(moduleName: string): void; | ||
// unsee(moduleName: string): void; | ||
} | ||
|
||
export function addModuleExcludeMatcher( | ||
matcher: (moduleName: string) => boolean | ||
): void; | ||
|
||
export function addModuleIncludeMatcher( | ||
matcher: (moduleName: string) => boolean | ||
): void; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Based on the docs for this library, I'm not sure how much of this should actually be public. All I need for emberjs/ember-qunit#994 is
loadModules
,moduleLoadFailure
,addModuleExcludeMatcher
andaddModuleIncludeMatcher
.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 we comment out the rest and see if anyone asks for them?
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.
I guess at the end of the day this whole package is probably pretty "private" anyway 🤷🏼♂️
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.
Ok so looking at the implementation, I would guess that
shouldLoadModule
,listModules
,listTestModules
,require
,unsee
andmoduleLoadFailure
are probably meant to be private helpers.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.
In that case, it may make more sense to declare the default export as an object with aload
method on it? I don't thinkTestLoader
is really meant to be instantiated or subclassed by anyone outside of here. The fact that it happens to be a class appears to be an implementation detail.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.
OTOH, the readme says....
🤷🏼 🤷🏼 🤷🏼
I guess you can take all of that information and decide what to do with them as you see fit, this is just an "internal" support package and I don't think these things were thought through very rigorously at the time.
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 probably should have just called
load()
which does exactly that, but oh wellThere 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.
lol true
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.
README says "optionally override TestLoader.prototype.shouldLoadModule" so I am going to make that public also
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.
I am working on ember-qunit anyway, so I just made that call the static
load
method and madeloadModules
private and the constructor protected.