-
Notifications
You must be signed in to change notification settings - Fork 273
feat: add generate command #410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
||
const statementArgs: any[] = [t.stringLiteral(plan.steps[0])]; | ||
|
||
if (plan.options?.requiresAuth) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simple implementation to support tests that require authentication. The ENVs can be supplied during the initial setup (that will be interactive).
const formattedCode = await formatCode(rawFileContent, this.rootDir); | ||
const lintedCode = await lintCode(formattedCode, this.rootDir); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Best effort to ensure the test file matches local format and linting rules.
const lintedCode = await lintCode(formattedCode, this.rootDir); | ||
|
||
try { | ||
await fs.mkdir(SHORTEST_DIR_PATH, { recursive: true }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a new folder shortest
within the project root. It is gitignored, so it can be added to the repo.
}).code; | ||
} | ||
|
||
private async getTestPlans(): Promise<TestPlan[]> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the MVP, no check has been added to ensure the plan is the current version, the current branch/commit match, etc.
Note
Experimental feature
Follow-up on #407
New command
npx shortest generate
Generates
shortest/functional.test.ts
test file using the test plans fromtest-plan.json
file.Samples: https://gist.github.com/rmarescu/fb1ac56d2ae048d2d16a9b8d2f6ed356