Skip to content

fix: validate test init before executing the test command#4381

Merged
DimitarTachev merged 2 commits into
releasefrom
tachev/validate-test
Feb 25, 2019
Merged

fix: validate test init before executing the test command#4381
DimitarTachev merged 2 commits into
releasefrom
tachev/validate-test

Conversation

@DimitarTachev

Copy link
Copy Markdown
Contributor

PR Checklist

Related to: #4373

@ghost ghost assigned DimitarTachev Feb 22, 2019
@ghost ghost added the new PR label Feb 22, 2019
@DimitarTachev

Copy link
Copy Markdown
Contributor Author

run ci

Comment thread 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'

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread lib/commands/test.ts Outdated
protected $options: IOptions,
protected $platformEnvironmentRequirements: IPlatformEnvironmentRequirements,
protected $errors: IErrors) {
super("android");

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread lib/commands/test.ts
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,

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread lib/common/errors.ts
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;

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor

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.

@DimitarTachev
DimitarTachev merged commit 90ba02c into release Feb 25, 2019
@ghost ghost removed the new PR label Feb 25, 2019
@DimitarTachev
DimitarTachev deleted the tachev/validate-test branch February 25, 2019 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants