Skip to content

fix: show correct messages on tns test init command #4080

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

Merged
merged 1 commit into from
Oct 30, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/commands/test-init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,10 @@ class TestInitCommand implements ICommand {
await this.$pluginsService.add('nativescript-unit-test-runner', this.$projectData);

const testsDir = path.join(this.$projectData.appDirectoryPath, 'tests');
const relativeTestsDir = path.relative(this.$projectData.projectDir, testsDir);
let shouldCreateSampleTests = true;
if (this.$fs.exists(testsDir)) {
this.$logger.info('app/tests/ directory already exists, will not create an example test project.');
this.$logger.info(`${relativeTestsDir} directory already exists, will not create an example test project.`);
shouldCreateSampleTests = false;
}

Expand All @@ -113,9 +114,9 @@ class TestInitCommand implements ICommand {

if (shouldCreateSampleTests && this.$fs.exists(exampleFilePath)) {
this.$fs.copyFile(exampleFilePath, path.join(testsDir, 'example.js'));
this.$logger.info('\nExample test file created in app/tests/'.yellow);
this.$logger.info(`\nExample test file created in ${relativeTestsDir}`.yellow);
} else {
this.$logger.info('\nPlace your test files under app/tests/'.yellow);
this.$logger.info(`\nPlace your test files under ${relativeTestsDir}`.yellow);
}

this.$logger.info('Run your tests using the "$ tns test <platform>" command.'.yellow);
Expand Down