-
Notifications
You must be signed in to change notification settings - Fork 56
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
Refactor request: Use colors/safe #528
Comments
Hi @kriskowal, This is a legitimate request, it will probably be a breaking change though. From my understanding, export class DisplayProcessor {
protected configuration: Configuration;
protected theme: Theme;
constructor(configuration: Configuration, theme: Theme) {
this.configuration = configuration;
this.theme = theme;
}
...
}
export class SpecColorsProcessor extends DisplayProcessor {
public displaySuccessfulSpec(spec: CustomReporterResult, log: string): string {
return this.theme.successful(log);
}
...
} Does it look like what you had in mind? |
Any design that does not mutate String.prototype is sufficient for the scope of this request. You can test that assertion by freezing String.prototype before running tests. Or, to freeze everything, you can On an unrelated note, any design that eliminates shared mutable state in the scope of modules generally composes better and is easier to test. I would be delighted if the API had a workflow like:
I am not intimately familiar with |
Available in |
Thank you for this. I can confirm that this works as intended! |
I am working with a project that would benefit from running in an environment where the shared primordial objects like String.prototype are frozen to prevent supply-chain attacks. That project uses jasmine and this jasmine-spec-runner.
In many cases, replacing
import "colors"
withimport colors from "colors"
then changing terms like"failed".red
tocolors.red("failed")
is sufficient. However, this project makes extensive use of themes to patch String.prototype on-the-fly.I would like to propose a refactor that captures the configured styles on a theme module and uses the theme module instead of
colors/safe
. Would that change be welcome?The text was updated successfully, but these errors were encountered: