fix: superfluous dir message when dir === cwd (#1138)
This commit is contained in:
@@ -352,11 +352,13 @@ await generate(resolvedDirectory, manifest);
|
|||||||
// not leak personal info (e.g. `/Users/MyName`)
|
// not leak personal info (e.g. `/Users/MyName`)
|
||||||
console.log("\n%cProject initialized!\n", "color: green; font-weight: bold");
|
console.log("\n%cProject initialized!\n", "color: green; font-weight: bold");
|
||||||
|
|
||||||
console.log(
|
if (unresolvedDirectory !== ".") {
|
||||||
`Enter your project directory using %ccd ${unresolvedDirectory}%c.`,
|
console.log(
|
||||||
"color: cyan",
|
`Enter your project directory using %ccd ${unresolvedDirectory}%c.`,
|
||||||
"",
|
"color: cyan",
|
||||||
);
|
"",
|
||||||
|
);
|
||||||
|
}
|
||||||
console.log(
|
console.log(
|
||||||
"Run %cdeno task start%c to start the project. %cCTRL-C%c to stop.",
|
"Run %cdeno task start%c to start the project. %cCTRL-C%c to stop.",
|
||||||
"color: cyan",
|
"color: cyan",
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import {
|
|||||||
retry,
|
retry,
|
||||||
TextLineStream,
|
TextLineStream,
|
||||||
} from "./deps.ts";
|
} from "./deps.ts";
|
||||||
|
import * as path from "$std/path/mod.ts";
|
||||||
|
import { assertNotMatch } from "https://deno.land/std@0.178.0/testing/asserts.ts";
|
||||||
|
|
||||||
type FileTree = {
|
type FileTree = {
|
||||||
type: "file";
|
type: "file";
|
||||||
@@ -371,3 +373,27 @@ Deno.test("fresh-init error(help)", async function (t) {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Deno.test("fresh-init .", async function (t) {
|
||||||
|
// Preparation
|
||||||
|
const tmpDirName = await Deno.makeTempDir();
|
||||||
|
|
||||||
|
await t.step("execute init command", async () => {
|
||||||
|
const cliProcess = new Deno.Command(Deno.execPath(), {
|
||||||
|
args: [
|
||||||
|
"run",
|
||||||
|
"-A",
|
||||||
|
path.join(Deno.cwd(), "init.ts"),
|
||||||
|
".",
|
||||||
|
],
|
||||||
|
cwd: tmpDirName,
|
||||||
|
stdin: "null",
|
||||||
|
stdout: "piped",
|
||||||
|
stderr: "piped",
|
||||||
|
});
|
||||||
|
const { code, stdout } = await cliProcess.output();
|
||||||
|
const output = new TextDecoder().decode(stdout);
|
||||||
|
assertNotMatch(output, /Enter your project directory/);
|
||||||
|
assertEquals(code, 0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user