Skip to content
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

Improve test command prompt #30

Merged
merged 3 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ All notable changes to this project will be documented in this file. See [standa

### [0.0.43](https://github.com/BuilderIO/micro-agent/compare/v0.0.42...v0.0.43) (2024-06-12)


### Features

* detect if in a valid project and generate one if not ([b8a5731](https://github.com/BuilderIO/micro-agent/commit/b8a5731e82fd5541c738cdf094870fbac035386b))
- detect if in a valid project and generate one if not ([b8a5731](https://github.com/BuilderIO/micro-agent/commit/b8a5731e82fd5541c738cdf094870fbac035386b))

### [0.0.42](https://github.com/BuilderIO/micro-agent/compare/v0.0.41...v0.0.42) (2024-06-12)

Expand Down
9 changes: 0 additions & 9 deletions src/helpers/add-numbers.ts

This file was deleted.

17 changes: 14 additions & 3 deletions src/helpers/get-test-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,27 @@ export async function getTestCommand({
{
role: 'user',
content: dedent`
Here is my package.json. I want to run a single command to run the tests (e.g. "npm run test"). The tests should not run in watch mode, they should
exit once completed. Bonus points if the command only runs this specific test \`${testFilePath}\` such as \`npm test -- ${
Here is my package.json. I want to run a single command to execute the tests. The tests should not run in watch mode.
If there is a test script in the package.json, use that script. For example, \`npm test\`.
The command should filter and run the specific test file at \`${testFilePath}\`. For example, \`npm test -- ${
testFilePath.split('/').pop()!.split('.')[0]
}\`.

Here are sample npm test commands without watch mode that work for some popular testing libraries:
- Jest: \`npm test -- ${
testFilePath.split('/').pop()!.split('.')[0]
} --no-watch \`
- Vitest: \`npm test -- ${
testFilePath.split('/').pop()!.split('.')[0]
} --run \`

<package-json>
${packageJson}
</package-json>

If there are no testing libraryes in the package.json, \`npx vitest ...\` is a good option.
If no testing libraries are found in the package.json, use \`npx vitest run ${
testFilePath.split('/').pop()!.split('.')[0]
}\` as a fallback.
`,
},
],
Expand Down
Loading