-
-
Notifications
You must be signed in to change notification settings - Fork 197
fix: validate test init before executing the test command #4381
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
Conversation
run ci |
lib/commands/test-init.ts
Outdated
name: 'karma', | ||
// Hardcode the version unitl https://github.com/karma-runner/karma/issues/3052 is fixed | ||
version: "2.0.2" | ||
name: 'karma' |
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.
Maybe just update the version. It will be bad if a new karma version breaks our functionality.
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.
lib/commands/test.ts
Outdated
protected $options: IOptions, | ||
protected $platformEnvironmentRequirements: IPlatformEnvironmentRequirements, | ||
protected $errors: IErrors) { | ||
super("android"); |
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.
Maybe use "protected abstract" in parent class and just set in derived classes.
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.
Using constant for the platform will be good improvement.
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.
if (!canStartKarmaServer) { | ||
this.$errors.fail({ | ||
formatStr: "Error: In order to run unit tests, your project must already be configured by running $ tns test init.", | ||
suppressCommandHelp: 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.
Maybe we can create better user experience by prompt the user to automatically execute tns test init
command.
This is not a merge stopper and can be done in another PR if we decide it is appropriate.
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.
@@ -159,7 +160,7 @@ export class Errors implements IErrors { | |||
} catch (ex) { | |||
const loggerLevel: string = $injector.resolve("logger").getLevel().toUpperCase(); | |||
const printCallStack = this.printCallStack || loggerLevel === "TRACE" || loggerLevel === "DEBUG"; | |||
const message = printCallStack ? resolveCallStack(ex) : `\x1B[31;1m${ex.message}\x1B[0m`; | |||
const message = printCallStack ? resolveCallStack(ex) : isInteractive() ? `\x1B[31;1m${ex.message}\x1B[0m` : ex.message; |
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 seems this probably will affect Sidekick/KinveyStudio but I'm not sure what exactly will be the impact.
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 might be better to split the conditions in two separate lines for readability of the code.
c7a8221
to
c5a8767
Compare
PR Checklist
Related to: #4373