-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(create-plugin): exit-code should be non-zero when an error occurs (…
…#2760) Co-authored-by: Tuan Pham <[email protected]>
- Loading branch information
1 parent
2586a7a
commit 0186ba8
Showing
3 changed files
with
72 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
packages/create-plugin/__e2e__/fixtures/forbiddenCharacters.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import type { TestPattern } from "../e2e.test"; | ||
import { | ||
ANSWER_NO, | ||
CREATE_PLUGIN_COMMAND, | ||
DEFAULT_ANSWER, | ||
} from "../utils/constants"; | ||
import { getBoundMessage } from "../../src/messages"; | ||
|
||
const m = getBoundMessage("en"); | ||
let outputDir: string; | ||
let expectedStderr: string; | ||
const isWindows = process.platform === "win32"; | ||
if (isWindows) { | ||
outputDir = ":"; | ||
expectedStderr = `Could not create a plug-in project. Error:\\nEINVAL: invalid argument, mkdir '.*:'`; | ||
} else { | ||
outputDir = "/"; | ||
expectedStderr = `Error: ${outputDir} already exists. Choose a different directory`; | ||
} | ||
|
||
export const pattern: TestPattern = { | ||
description: | ||
"#JsSdkTest-11 Should throw an error when the output directory contains forbidden characters", | ||
input: { | ||
command: CREATE_PLUGIN_COMMAND, | ||
outputDir: outputDir, | ||
questionsInput: [ | ||
{ | ||
question: m("Q_NameEn"), | ||
answer: "test11-name", | ||
}, | ||
{ | ||
question: m("Q_DescriptionEn"), | ||
answer: "test11-description", | ||
}, | ||
{ | ||
question: m("Q_SupportJa"), | ||
answer: DEFAULT_ANSWER, | ||
}, | ||
{ | ||
question: m("Q_SupportZh"), | ||
answer: DEFAULT_ANSWER, | ||
}, | ||
{ | ||
question: m("Q_WebsiteUrlEn"), | ||
answer: DEFAULT_ANSWER, | ||
}, | ||
{ | ||
question: m("Q_MobileSupport"), | ||
answer: ANSWER_NO, | ||
}, | ||
{ | ||
question: m("Q_EnablePluginUploader"), | ||
answer: ANSWER_NO, | ||
}, | ||
], | ||
}, | ||
expected: { | ||
failure: { | ||
stderr: expectedStderr, | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters