Skip to content

Commit ad32a53

Browse files
authored
Merge pull request #168 from akd-io/feature/add-test-live-script
Add test:live script
2 parents 78ec69d + 01d8bab commit ad32a53

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"test:small": "yarn build && node lib/tests/e2e/manual-test.js --debug --package-manager=pnpm --styling=css-modules",
5252
"test:large": "yarn build && node lib/tests/e2e/manual-test.js --debug --package-manager=pnpm --styling=emotion --react-hook-form --formik --prettier --formatting-pre-commit-hook --chakra --framer-motion --github-actions",
5353
"test:cna": "yarn build && node lib/tests/e2e/test-cna.js",
54+
"test:live": "yarn build && node lib/tests/e2e/test-live.js",
5455
"print:help": "yarn build && ./bin-test/run-prod --help",
5556
"print:version": "yarn build && ./bin-test/run-prod --help",
5657
"version": "oclif-dev readme && git add README.md",

src/tests/e2e/test-live.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import chalk from "chalk"
2+
import endent from "endent"
3+
import { v4 as uuidv4 } from "uuid"
4+
import { prettyCommand } from "../../main/helpers/pretty-command"
5+
import { runCommand } from "../../main/run-command"
6+
import { checkFormattingLintingBuild } from "./helpers/check-formatting-linting-build"
7+
import { exitWithError } from "./helpers/exit-with-error"
8+
import { logTestInfo } from "./test-logging"
9+
;(async () => {
10+
try {
11+
const projectName = uuidv4()
12+
const runDirectory = `../create-next-stack-tests/${projectName}`
13+
14+
const command = "npx"
15+
const args = [
16+
"create-next-stack@latest",
17+
...process.argv.slice(2),
18+
runDirectory,
19+
]
20+
21+
logTestInfo("Running command:", prettyCommand(command, args))
22+
23+
await runCommand(command, args, { stdio: "inherit" })
24+
25+
await checkFormattingLintingBuild(runDirectory)
26+
27+
logTestInfo("")
28+
logTestInfo(endent`
29+
${chalk.green("Test successful!")}
30+
31+
To open the project in vscode, run:
32+
33+
${chalk.cyan(`code ${runDirectory}`)}
34+
`)
35+
logTestInfo("")
36+
} catch (error) {
37+
exitWithError(error)
38+
}
39+
})()

0 commit comments

Comments
 (0)