use of org.eclipse.n4js.cli.helper.CliCompileResult in project n4js by eclipse.
the class N4jscInitTest method yarnWrongLocation2.
/**
* test yarn at wrong location
*/
@Test
public void yarnWrongLocation2() throws Exception {
// create environment
N4jscTestOptions options = INIT().setWorkingDirectory(cwd.toPath()).yes().workspaces();
n4jsc(options, SUCCESS);
assertEquals("TestInit\n" + "- package.json\n" + "+ packages\n" + " + my-project\n" + " - package.json\n" + " + src\n" + " + src-gen\n" + "", FileUtils.serializeFileTree(cwd));
// test
options = INIT().yes().setWorkingDirectory(cwd.toPath()).workspaces();
CliCompileResult result = n4jsc(options, INIT_ERROR_WORKING_DIR);
assertEquals("ERROR-410 (Error: Unsupported working directory): Current working directory must not contain a package.json file. Note:\n" + " In case you like to add the n4js property to an existing project, use option --n4js.\n" + " In case you like to add a project to an existing workspace project, use options -w -c.", result.getStdOut());
}
use of org.eclipse.n4js.cli.helper.CliCompileResult in project n4js by eclipse.
the class N4jscInitTest method yarnWrongLocation3.
/**
* test yarn at wrong location
*/
@Test
public void yarnWrongLocation3() throws Exception {
// create environment
N4jscTestOptions options = INIT().setWorkingDirectory(cwd.toPath()).yes().workspaces();
n4jsc(options, SUCCESS);
assertEquals("TestInit\n" + "- package.json\n" + "+ packages\n" + " + my-project\n" + " - package.json\n" + " + src\n" + " + src-gen\n" + "", FileUtils.serializeFileTree(cwd));
// test
options = INIT().yes().setWorkingDirectory(cwd.toPath().resolve("packages")).workspaces().scope();
CliCompileResult result = n4jsc(options, INIT_ERROR_WORKING_DIR);
assertEquals("ERROR-410 (Error: Unsupported working directory): When creating a scoped package the parent directory of current working directory must start with '@'. Note:\n" + " In case you like to create a new project in a subfolder of the current working directory, use option -c.", result.getStdOut());
}
use of org.eclipse.n4js.cli.helper.CliCompileResult in project n4js by eclipse.
the class N4jscInitTest method yarnWrongLocation1Scope.
/**
* test yarn at wrong location
*/
@Test
public void yarnWrongLocation1Scope() throws Exception {
// create environment
N4jscTestOptions options = INIT().setWorkingDirectory(cwd.toPath()).yes().workspaces();
n4jsc(options, SUCCESS);
assertEquals("TestInit\n" + "- package.json\n" + "+ packages\n" + " + my-project\n" + " - package.json\n" + " + src\n" + " + src-gen\n" + "", FileUtils.serializeFileTree(cwd));
// test
File newProject = new File(cwd, "packages");
options = INIT().yes().setWorkingDirectory(newProject.toPath()).scope();
CliCompileResult result = n4jsc(options, INIT_ERROR_WORKING_DIR);
assertEquals("ERROR-410 (Error: Unsupported working directory): When creating a scoped package the parent directory of current working directory must start with '@'. Note:\n" + " In case you like to create a new project in a subfolder of the current working directory, use option -c.", result.getStdOut());
}
use of org.eclipse.n4js.cli.helper.CliCompileResult in project n4js by eclipse.
the class N4jscInitTest method otherName.
/**
* test another project name
*/
@Test
public void otherName() throws Exception {
String answers = "otherName";
N4jscTestOptions options = INIT().setWorkingDirectory(cwd.toPath()).answers(answers);
CliCompileResult result = n4jsc(options, SUCCESS);
npmInstall(cwd.toPath());
result = n4jsc(IMPLICIT_COMPILE(cwd).setWorkingDirectory(cwd.toPath()), SUCCESS);
// there are no files to transpile
assertEquals(0, result.getTranspiledFilesCount());
String packagejsonContents = Files.readString(cwd.toPath().resolve(PACKAGE_JSON));
assertTrue(packagejsonContents.contains(" \"name\": \"otherName\",\n"));
}
use of org.eclipse.n4js.cli.helper.CliCompileResult in project n4js by eclipse.
the class N4jscInitTest method optionsErrorYesScope.
/**
* --scope test.
*/
@Test
public void optionsErrorYesScope() throws Exception {
File subfolder = new File(cwd, "nonScopeFolder/scopedProject");
subfolder.mkdir();
N4jscTestOptions options = INIT().setWorkingDirectory(subfolder.toPath()).yes().scope();
CliCompileResult result = n4jsc(options, INIT_ERROR_WORKING_DIR);
assertEquals("ERROR-410 (Error: Unsupported working directory): When creating a scoped package the parent directory of current working directory must start with '@'. Note:\n" + " In case you like to create a new project in a subfolder of the current working directory, use option -c.", result.getStdOut());
}
Aggregations