@hkvstore/taco-cli
Version:
taco-cli is a command-line interface for rapid Apache Cordova development (forked from Microsoft taco-cli)
513 lines (511 loc) • 29.7 kB
JavaScript
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
/// <reference path="../../typings/should.d.ts"/>
/// <reference path="../../typings/mocha.d.ts"/>
/// <reference path="../../typings/rimraf.d.ts"/>
/// <reference path="../../typings/wrench.d.ts"/>
/// <reference path="../../typings/tacoUtils.d.ts"/>
/// <reference path="../../typings/tacoKits.d.ts"/>
/// <reference path="../../typings/tacoTestsUtils.d.ts"/>
;
/* tslint:disable:no-var-requires */
// var require needed for should module to work correctly
// Note not import: We don't want to refer to shouldModule, but we need the require to occur since it modifies the prototype of Object.
var shouldModule = require("should");
/* tslint:enable:no-var-requires */
/* tslint:disable:no-var-requires */
// Special case to allow using color package with index signature for style rules
var colors = require("colors/safe");
/* tslint:enable:no-var-requires */
var fs = require("fs");
var os = require("os");
var path = require("path");
var Q = require("q");
var rimraf = require("rimraf");
var util = require("util");
var wrench = require("wrench");
var kitHelper = require("../cli/utils/kitHelper");
var TacoErrorCodes = require("../cli/tacoErrorCodes");
var tacoUtils = require("taco-utils");
var TemplateManager = require("../cli/utils/templateManager");
var tacoTestsUtils = require("taco-tests-utils");
var tacoPackageLoader = tacoUtils.TacoPackageLoader;
var TacoUtilsErrorCodes = tacoUtils.TacoErrorCode;
var utils = tacoUtils.UtilHelper;
var MemoryStream = tacoTestsUtils.MemoryStream;
var CommandHelper = require("./utils/commandHelper");
describe("taco create", function () {
var tacoFileCount = 1;
var cordovaDefaultProjectFileCount = 13; // 6 files and 7 folders
// The following numbers are for: "plugins", "hooks", "platforms" and ".cordova" folders, and "hooks\readme.md" and ".cordova\cordova.config" files. If our templates ever start to include
// these files, then to avoid double counting them, we must reduce the counts in this dictionary.
var cordovaFileCounts = {
"4.3.0-Kit": 6,
"4.3.1-Kit": 4,
"5.1.1-Kit": 4 // 1 file and 3 folders
};
var expectedKitTacoJsonKeyValues = {
"4.3.1-Kit": { kit: "4.3.1-Kit", "cordova-cli": "4.3.1" },
"5.1.1-Kit": { kit: "5.1.1-Kit", "cordova-cli": "5.1.1" }
};
var expectedCliTacoJsonKeyValues = {
"4.3.0": { "cordova-cli": "4.3.0" },
"4.3.1": { "cordova-cli": "4.3.1" },
"5.1.1": { "cordova-cli": "5.1.1" }
};
// Shared test variables
var templateManager;
var tacoKitsErrors;
// Project info
var testAppId = "testId";
var testAppName = "testAppName";
var testTemplateId = "testTemplate";
var testKitId = "testKit";
// Important paths
var runFolder = path.resolve(os.tmpdir(), "taco_cli_create_test_run");
var tacoHome = path.join(runFolder, "taco_home");
var copyFromPath = path.resolve(__dirname, "resources", "templates", "testKit", "testTemplate");
var testTemplateKitSrc = path.resolve(__dirname, "resources", "templates", testKitId);
var testTemplateSrc = path.join(testTemplateKitSrc, testTemplateId);
// Commands for the different end to end scenarios to test
var successPrefix = "success";
var failurePrefix = "failure";
var successScenarios = {
1: util.format("%s --kit 4.3.1-Kit --template typescript %s %s {}", getProjectPath(successPrefix, 1), testAppId, testAppName),
2: util.format("%s --kit 5.1.1-Kit --template blank %s %s", getProjectPath(successPrefix, 2), testAppId, testAppName),
3: util.format("%s --kit 4.3.1-Kit --template typescript %s", getProjectPath(successPrefix, 3), testAppId),
4: util.format("%s --kit 4.3.1-Kit --template blank", getProjectPath(successPrefix, 4)),
5: util.format("%s --kit 5.1.1-Kit --template", getProjectPath(successPrefix, 5)),
6: util.format("%s --kit 4.3.1-Kit", getProjectPath(successPrefix, 6)),
7: util.format("%s --template blank", getProjectPath(successPrefix, 7)),
8: util.format("%s --template", getProjectPath(successPrefix, 8)),
9: util.format("%s --copy-from %s", getProjectPath(successPrefix, 9), copyFromPath),
10: util.format("%s --cordova 4.3.0", getProjectPath(successPrefix, 10)),
11: util.format("%s --unknownParameter", getProjectPath(successPrefix, 11)),
12: util.format("%s --kit", getProjectPath(successPrefix, 12)),
13: util.format("%s --template typescript", getProjectPath(successPrefix, 13))
};
var failureScenarios = {
1: util.format("%s --kit unknown", getProjectPath(failurePrefix, 1)),
2: util.format("%s --template unknown", getProjectPath(failurePrefix, 2)),
3: util.format("%s --kit 5.1.1-Kit --template typescript --copy-from %s", getProjectPath(failurePrefix, 3), copyFromPath),
4: util.format("%s --kit 5.1.1-Kit --cordova 4.2.0", getProjectPath(failurePrefix, 4)),
5: util.format("%s --cordova 4.3.0 --template typescript", getProjectPath(failurePrefix, 5)),
6: util.format("%s --kit 4.3.1-Kit --template typescript %s %s {}", getProjectPath(failurePrefix, 6), testAppId, testAppName),
7: util.format("%s --kit 5.1.1-Kit --copy-from unknownCopyFromPath", getProjectPath(failurePrefix, 7)),
8: util.format("%s --cordova unknownCliVersion", getProjectPath(failurePrefix, 8)),
9: util.format("%s 42", getProjectPath(failurePrefix, 9)),
10: "",
11: util.format("%s/invalid/project/path", getProjectPath(failurePrefix, 11)),
12: util.format("%s", getProjectPath(failurePrefix, 12))
};
function getProjectPath(suitePrefix, scenario) {
return path.join(runFolder, suitePrefix + scenario);
}
function createProject(scenario, scenarioList) {
var create = CommandHelper.getCommand("create");
return create.run(scenarioList[scenario].split(" "));
}
function countProjectItemsRecursive(projectPath) {
if (!fs.existsSync(projectPath)) {
return 0;
}
var files = wrench.readdirSyncRecursive(projectPath);
return files.length;
}
function verifyTacoJsonKeyValues(projectPath, keyValues) {
var tacoJsonPath = path.resolve(projectPath, "taco.json");
if (!fs.existsSync(tacoJsonPath)) {
throw new Error("Taco.json file not found");
}
var tacoJson = require(tacoJsonPath);
tacoJson.should.be.eql(tacoJson);
}
function runScenarioWithExpectedFileCount(scenario, expectedFileCount, tacoJsonFileContents) {
return createProject(scenario, successScenarios)
.then(function () {
var projectPath = getProjectPath(successPrefix, scenario);
var fileCount = countProjectItemsRecursive(projectPath);
fileCount.should.be.exactly(expectedFileCount);
if (tacoJsonFileContents) {
verifyTacoJsonKeyValues(projectPath, tacoJsonFileContents);
}
});
}
function runScenario(scenario, kitUsed, templateUsed, tacoJsonFileContents) {
return templateManager.getTemplateEntriesCount(kitUsed, templateUsed)
.then(function (templateEntries) {
var totalEntries = templateEntries + tacoFileCount + cordovaFileCounts[kitUsed];
return runScenarioWithExpectedFileCount(scenario, totalEntries, tacoJsonFileContents);
});
}
function runFailureScenario(scenario, expectedErrorCode) {
return createProject(scenario, failureScenarios)
.then(function () {
throw new Error("Scenario succeeded when it should have failed");
}, function (err) {
if (expectedErrorCode) {
err.errorCode.should.equal(expectedErrorCode);
}
return Q.resolve(null);
});
}
before(function (done) {
// Set ResourcesManager to test mode
process.env["TACO_UNIT_TEST"] = true;
// Set a temporary location for taco_home
process.env["TACO_HOME"] = tacoHome;
// Force KitHelper to fetch the package fresh
kitHelper.kitPackagePromise = null;
// Instantiate the persistent templateManager
templateManager = new TemplateManager(kitHelper);
// Delete existing run folder if necessary
rimraf.sync(runFolder);
// Create the run folder for our tests
wrench.mkdirSyncRecursive(runFolder, 511); // 511 decimal is 0777 octal
// Load taco-kits error codes
tacoPackageLoader.lazyRequire("taco-kits", "taco-kits").then(function (tacoKits) {
tacoKitsErrors = tacoKits.TacoErrorCode;
done();
});
});
after(function (done) {
kitHelper.kitPackagePromise = null;
rimraf(runFolder, done);
});
describe("Success scenarios", function () {
it("Success scenario 1 [path, id, name, cordovaConfig, kit, template]", function (done) {
var scenario = 1;
// Should use kit 4.3.1-Kit and template typescript
runScenario(scenario, "4.3.1-Kit", "typescript", expectedKitTacoJsonKeyValues["4.3.1-Kit"]).done(function () { return done(); }, done);
});
it("Success scenario 2 [path, id, name, kit, template]", function (done) {
var scenario = 2;
// Should use kit 5.1.1-Kit and template blank
runScenario(scenario, "5.1.1-Kit", "blank", expectedKitTacoJsonKeyValues["5.1.1-Kit"]).done(function () { return done(); }, done);
});
it("Success scenario 3 [path, id, kit, template]", function (done) {
var scenario = 3;
// Should use kit 4.3.1-Kit and template typescript
runScenario(scenario, "4.3.1-Kit", "typescript", expectedKitTacoJsonKeyValues["4.3.1-Kit"]).done(function () { return done(); }, done);
});
it("Success scenario 4 [path, kit, template]", function (done) {
var scenario = 4;
// Should use kit 4.3.1-Kit and template blank
runScenario(scenario, "4.3.1-Kit", "blank", expectedKitTacoJsonKeyValues["4.3.1-Kit"]).done(function () { return done(); }, done);
});
it("Success scenario 5 [path, kit, template (no value)]", function (done) {
var scenario = 5;
// Should use kit 5.1.1-Kit and template blank
runScenario(scenario, "5.1.1-Kit", "blank", expectedKitTacoJsonKeyValues["5.1.1-Kit"]).done(function () { return done(); }, done);
});
it("Success scenario 6 [path, kit]", function (done) {
var scenario = 6;
// Should use kit 4.3.1-Kit and template blank
runScenario(scenario, "4.3.1-Kit", "blank", expectedKitTacoJsonKeyValues["4.3.1-Kit"]).done(function () { return done(); }, done);
});
it("Success scenario 7 [path, template]", function (done) {
var scenario = 7;
// Should use kit 5.1.1-Kit and template blank
runScenario(scenario, "5.1.1-Kit", "blank", expectedKitTacoJsonKeyValues["5.1.1-Kit"]).done(function () { return done(); }, done);
});
it("Success scenario 8 [path, template (no value)]", function (done) {
var scenario = 8;
// Should use kit 5.1.1-Kit and template blank
runScenario(scenario, "5.1.1-Kit", "blank", expectedKitTacoJsonKeyValues["5.1.1-Kit"]).done(function () { return done(); }, done);
});
it("Success scenario 9 [path, copy-from]", function (done) {
var scenario = 9;
// copy-from custom assets: 2 files and 1 folder
// Kit 5.1.1-Kit: Cordova adds 2 files and 4 folders
var totalEntries = 9 + tacoFileCount;
runScenarioWithExpectedFileCount(scenario, totalEntries, expectedKitTacoJsonKeyValues["5.1.1-Kit"]).done(function () { return done(); }, done);
});
it("Success scenario 10 [path, cli]", function (done) {
var scenario = 10;
// CLI 4.2.0 + default Cordova project
// TACO: adds 1 file
var totalEntries = cordovaDefaultProjectFileCount + tacoFileCount;
runScenarioWithExpectedFileCount(scenario, totalEntries, expectedCliTacoJsonKeyValues["4.3.0"]).done(function () { return done(); }, done);
});
it("Success scenario 11 [path, extra unknown parameter]", function (done) {
var scenario = 11;
// Should use kit 5.1.1-Kit and template blank
runScenario(scenario, "5.1.1-Kit", "blank", expectedKitTacoJsonKeyValues["5.1.1-Kit"]).done(function () { return done(); }, done);
});
it("Success scenario 12 [path, kit (empty)]", function (done) {
var scenario = 12;
// Should use kit 5.1.1-Kit and template blank
runScenario(scenario, "5.1.1-Kit", "blank", expectedKitTacoJsonKeyValues["5.1.1-Kit"]).done(function () { return done(); }, done);
});
it("Success scenario 13 [path, template (typescript)]", function (done) {
var scenario = 13;
// Should use kit 5.1.1-Kit and template typescript
runScenario(scenario, "5.1.1-Kit", "typescript", expectedKitTacoJsonKeyValues["5.1.1-Kit"]).done(function () { return done(); }, done);
});
});
describe("Failure scenarios", function () {
it("Failure scenario 1 [path, kit (unknown value)]", function (done) {
// Create command should fail if --kit was specified with an unknown value
var scenario = 1;
runFailureScenario(scenario, tacoKitsErrors.TacoKitsExceptionInvalidKit).done(function () { return done(); }, done);
});
it("Failure scenario 2 [path, template (unknown value)]", function (done) {
// If a template is not found, create command should fail with an appropriate message
var scenario = 2;
runFailureScenario(scenario, tacoKitsErrors.TacoKitsExceptionInvalidTemplate).done(function () { return done(); }, done);
});
it("Failure scenario 3 [path, kit, template, copy-from]", function (done) {
// Create command should fail when both --template and --copy-from are specified
var scenario = 3;
runFailureScenario(scenario, TacoErrorCodes.CommandCreateNotTemplateIfCustomWww).done(function () { return done(); }, done);
});
it("Failure scenario 4 [path, kit, cli]", function (done) {
// Create command should fail when both --kit and --cordova are specified
var scenario = 4;
runFailureScenario(scenario, TacoErrorCodes.CommandCreateNotBothCordovaCliAndKit).done(function () { return done(); }, done);
});
it("Failure scenario 5 [path, cli, template]", function (done) {
// Create command should fail when both --cordova and --template are specified
var scenario = 5;
runFailureScenario(scenario, TacoErrorCodes.CommandCreateNotBothTemplateAndCordovaCli).done(function () { return done(); }, done);
});
it("Failure scenario 6 [path (value is an existing project)]", function (done) {
// Create command should fail when the specified path is a non-empty existing folder (Cordova error)
var scenario = 6;
var copyDest = getProjectPath(failurePrefix, scenario);
wrench.mkdirSyncRecursive(copyDest, 511); // 511 decimal is 0777 octal
utils.copyRecursive(testTemplateSrc, copyDest)
.then(function () {
return runFailureScenario(scenario);
})
.done(function () { return done(); }, done);
});
it("Failure scenario 7 [path, copy-from (unknown path)]", function (done) {
// Create command should fail when --copy-from is specified with a path that doesn't exist (Cordova error)
var scenario = 7;
runFailureScenario(scenario).done(function () { return done(); }, done);
});
it("Failure scenario 8 [path, cli (unknown value)]", function (done) {
// Create command should fail when specified cli version doesn't exist
var scenario = 8;
runFailureScenario(scenario, TacoUtilsErrorCodes.PackageLoaderInvalidPackageVersionSpecifier).done(function () { return done(); }, done);
});
it("Failure scenario 9[path, appId (invalid value)]", function (done) {
// Create command should fail when an invalid app ID is specified (Cordova error)
var scenario = 9;
runFailureScenario(scenario).done(function () { return done(); }, done);
});
it("Failure scenario 10 [(NO path)]", function (done) {
// Create command should fail gracefully when the user doesn't provide a path to 'taco create'
var scenario = 10;
runFailureScenario(scenario, TacoErrorCodes.CommandCreateNoPath).done(function () { return done(); }, done);
});
it("Failure scenario 11 [path (invalid)]", function (done) {
// Create command should fail gracefully when the user provides an invalid path to 'taco create'
var scenario = 11;
runFailureScenario(scenario, TacoErrorCodes.CommandCreateInvalidPath).done(function () { return done(); }, done);
});
it("Failure scenario 12 [path (existing)]", function (done) {
// Create command should fail gracefully when the user provides an existing, non-empty path to 'taco create'
var scenario = 12;
var projectPath = getProjectPath(failurePrefix, scenario);
wrench.mkdirSyncRecursive(path.join(projectPath, "some", "nested", "folders"), 511); // 511 decimal is 0777 octal
runFailureScenario(scenario, TacoErrorCodes.CommandCreatePathNotEmpty).done(function () { return done(); }, done);
});
});
describe("Onboarding experience", function () {
// because of function overloading assigning "(buffer: string, cb?: Function) => boolean" as the type for
// stdoutWrite just doesn't work
var stdoutWrite = process.stdout.write; // We save the original implementation, so we can restore it later
var memoryStdout;
beforeEach(function () {
memoryStdout = new MemoryStream; // Each individual test gets a new and empty console
process.stdout.write = memoryStdout.writeAsFunction(); // We'll be printing into an "in-memory" console, so we can test the output
});
after(function () {
// We just need to reset the stdout just once, after all the tests have finished
process.stdout.write = stdoutWrite;
});
var tenSpaces = " ";
var tenMinuses = "----------";
function testCreateForArguments(createCommandLineArguments, expectedMessages, alternativeExpectedMessages, done) {
// Some messages are only printed the first time something is executed. When we run all the tests
// all those messages don't get printed, but if we only run the onboarding tests, they are the first
// tests to run, so they do get printed. We accept both options and we validate we got one of them
var create = CommandHelper.getCommand("create");
create.run(createCommandLineArguments).done(function () {
var expected = expectedMessages.join("\n");
var actual = colors.strip(memoryStdout.contentsAsText()); // We don't want to compare the colors
actual = actual.replace(/ {10,}/g, tenSpaces); // We don't want to count spaces when we have a lot of them, so we replace it with 10
actual = actual.replace(/-{10,}/g, tenMinuses); // We don't want to count -----s when we have a lot of them, so we replace it with 10 (They also depend dynamically on the path length)
actual = actual.replace(/ +$/gm, ""); // We also don't want trailing spaces
actual = actual.replace(/ \.+ ?\n +/gm, " ..... "); // We undo the word-wrapping
actual = actual.replace(/ *\n +\(/gm, " ("); // We undo the word-wrapping
actual = actual.replace(/\n\n /gm, "\n "); // We undo the word-wrapping
actual = actual.replace(/ \.+ /gm, " ..... "); // We want all the points to always be 5 points .....
if (expectedMessages.every(function (msg) { return actual.indexOf(msg) >= 0; }) || alternativeExpectedMessages.every(function (msg) { return actual.indexOf(msg) >= 0; })) {
done();
}
else {
done(new Error("Bad onboarding for " + createCommandLineArguments));
}
}, function (arg) {
done(arg);
});
}
var downloadingDependenciesOutput = ["",
"PackageLoaderDownloadingMessage",
"",
"PackageLoaderDownloadCompletedMessage"];
it("prints the onboarding experience when using a kit", function (done) {
var projectPath = getProjectPath("onboarding-experience", 1);
var firstPart = [
" ----------",
" CommandCreateStatusTableNameDescription ..... HelloTaco",
" CommandCreateStatusTableIDDescription ..... io.taco.hellotaco",
" CommandCreateStatusTableLocationDescription ..... " + projectPath,
" CommandCreateStatusTableKitVersionDescription ..... 4.3.1-Kit",
" ----------"];
var lastPart = [
"CommandCreateSuccessProjectTemplate",
"OnboardingExperienceTitle",
" * HowToUseChangeToProjectFolder",
" * HowToUseCommandPlatformAddPlatform",
" * HowToUseCommandInstallReqsPlugin",
" * HowToUseCommandAddPlugin",
" * HowToUseCommandSetupRemote",
" * HowToUseCommandBuildPlatform",
" * HowToUseCommandEmulatePlatform",
" * HowToUseCommandRunPlatform",
"",
"HowToUseCommandHelp",
"HowToUseCommandDocs",
""];
testCreateForArguments([projectPath, "--kit", "4.3.1-Kit"], firstPart.concat(lastPart), firstPart.concat(downloadingDependenciesOutput, lastPart), done);
});
it("prints the onboarding experience when not using a kit", function (done) {
var projectPath = getProjectPath("onboarding-experience", 2);
var firstPart = [
" ----------",
" CommandCreateStatusTableNameDescription ..... HelloTaco",
" CommandCreateStatusTableIDDescription ..... io.taco.hellotaco",
" CommandCreateStatusTableLocationDescription ..... " + projectPath,
" CommandCreateStatusTableCordovaCLIVersionDescription ..... 5.1.1",
" ----------"];
var lastPart = [
"CommandCreateSuccessProjectCLI",
"OnboardingExperienceTitle",
" * HowToUseChangeToProjectFolder",
" * HowToUseCommandPlatformAddPlatform",
" * HowToUseCommandInstallReqsPlugin",
" * HowToUseCommandAddPlugin",
" * HowToUseCommandSetupRemote",
" * HowToUseCommandBuildPlatform",
" * HowToUseCommandEmulatePlatform",
" * HowToUseCommandRunPlatform",
"",
"HowToUseCommandHelp",
"HowToUseCommandDocs",
""];
testCreateForArguments([projectPath, "--cordova", "5.1.1"], firstPart.concat(lastPart), firstPart.concat(downloadingDependenciesOutput, lastPart), done);
});
it("it adds (Deprecated) to a deprecated kit", function (done) {
var projectPath = getProjectPath("onboarding-experience", 3);
var firstPart = [
" ----------",
" CommandCreateStatusTableNameDescription ..... HelloTaco",
" CommandCreateStatusTableIDDescription ..... io.taco.hellotaco",
" CommandCreateStatusTableLocationDescription ..... " + projectPath,
" CommandCreateStatusTableKitVersionDescription ..... 4.3.0-Kit (CommandKitListDeprecatedKit)",
" ----------"];
var lastPart = [
"CommandCreateWarningDeprecatedKit",
"CommandCreateSuccessProjectTemplate",
"OnboardingExperienceTitle",
" * HowToUseChangeToProjectFolder",
" * HowToUseCommandPlatformAddPlatform",
" * HowToUseCommandInstallReqsPlugin",
" * HowToUseCommandAddPlugin",
" * HowToUseCommandSetupRemote",
" * HowToUseCommandBuildPlatform",
" * HowToUseCommandEmulatePlatform",
" * HowToUseCommandRunPlatform",
"",
"HowToUseCommandHelp",
"HowToUseCommandDocs",
""];
testCreateForArguments([projectPath, "--kit", "4.3.0-Kit"], firstPart.concat(lastPart), firstPart.concat(downloadingDependenciesOutput, lastPart), done);
});
it("it adds (Default) to a default kit", function (done) {
var projectPath = getProjectPath("onboarding-experience", 4);
kitHelper.getDefaultKit().done(function (defaultKitId) {
var firstPart = [
" ----------",
" CommandCreateStatusTableNameDescription ..... HelloTaco",
" CommandCreateStatusTableIDDescription ..... io.taco.hellotaco",
" CommandCreateStatusTableLocationDescription ..... " + projectPath,
" CommandCreateStatusTableKitVersionDescription ..... " + defaultKitId + " (CommandKitListDefaultKit)",
" ----------"];
var lastPart = [
"CommandCreateSuccessProjectTemplate",
"OnboardingExperienceTitle",
" * HowToUseChangeToProjectFolder",
" * HowToUseCommandPlatformAddPlatform",
" * HowToUseCommandInstallReqsPlugin",
" * HowToUseCommandAddPlugin",
" * HowToUseCommandSetupRemote",
" * HowToUseCommandBuildPlatform",
" * HowToUseCommandEmulatePlatform",
" * HowToUseCommandRunPlatform",
"",
"HowToUseCommandHelp",
"HowToUseCommandDocs",
""];
testCreateForArguments([projectPath, "--kit", defaultKitId], firstPart.concat(lastPart), firstPart.concat(downloadingDependenciesOutput, lastPart), done);
});
});
});
describe("Telemetry properties", function () {
var cliVersion = require("../package.json").version;
function createProjectAndVerifyTelemetryProps(args, expectedProperties, done) {
var create = CommandHelper.getCommand("create");
// Create a dummy test project with no platforms added
create.run(args).done(function (telemetryParameters) {
telemetryParameters.should.be.eql(expectedProperties);
done();
}, done);
}
it("Returns the expected telemetry properties for a kit project created with the Blank template", function (done) {
var projectPath = getProjectPath("Telemetry properties for Create command", 1);
var expected = {
cliVersion: { isPii: false, value: cliVersion },
kit: { isPii: false, value: "5.1.1-Kit" },
template: { isPii: false, value: "blank" },
"options.kit": { isPii: false, value: "5.1.1-Kit" }
};
createProjectAndVerifyTelemetryProps([projectPath, "--kit", "5.1.1-Kit"], expected, done);
});
it("Returns the expected telemetry properties for a kit project created with TypeScript template", function (done) {
var projectPath = getProjectPath("Telemetry properties for Create command", 2);
var expected = {
cliVersion: { isPii: false, value: cliVersion },
kit: { isPii: false, value: "5.1.1-Kit" },
template: { isPii: false, value: "typescript" },
"options.kit": { isPii: false, value: "5.1.1-Kit" },
"options.template": { isPii: false, value: "typescript" }
};
createProjectAndVerifyTelemetryProps([projectPath, "--kit", "5.1.1-Kit", "--template", "typescript"], expected, done);
});
it("Returns the expected telemetry properties for a CLI project", function (done) {
var projectPath = getProjectPath("Telemetry properties for Create command", 3);
var expected = {
cliVersion: { isPii: false, value: cliVersion },
cordova: { isPii: false, value: "4.3.0" },
"options.cordova": { isPii: false, value: "4.3.0" }
};
createProjectAndVerifyTelemetryProps([projectPath, "--cordova", "4.3.0"], expected, done);
});
});
});
//# sourceMappingURL=create.js.map