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

cli: allow execute custom test command #550

Merged
merged 10 commits into from
Jul 29, 2021

Conversation

fanatid
Copy link
Contributor

@fanatid fanatid commented Jul 27, 2021

Closes #426

Usage example:

anchor test --cmd "npx ts-node node_modules/.bin/tape tests/*.ts"

@armaniferrante
Copy link
Member

What do you think of adding this to the [scripts] section instead of the --cmd option?

So your example turns into

[scripts]
test = "npx ts-node node_modules/.bin/tape tests/*.ts"

Then run anchor test.

@fanatid
Copy link
Contributor Author

fanatid commented Jul 27, 2021

If we add test field to scripts section which will be used by anchor test what does anchor run test should do?

@armaniferrante
Copy link
Member

armaniferrante commented Jul 27, 2021

If we add test field to scripts section which will be used by anchor test what does anchor run test should do?

Perhaps the same as anchor test? I'm not sure.

I'm thinking it'll be convenient for some of the scripts to have special behavior similar to npm, for deploys, tests, and publishing builds (once that's ready).

@armaniferrante
Copy link
Member

Shall we add a simple test in one of the examples?

@fanatid
Copy link
Contributor Author

fanatid commented Jul 28, 2021

Yeah, I thought about example and where we should document the new feature. Maybe we should introduce breaking change and require test field in scripts section? i.e. move mocha/ts-mocha from cli binary to config and create it by default?

@armaniferrante
Copy link
Member

Yeah, I thought about example and where we should document the new feature. Maybe we should introduce breaking change and require test field in scripts section? i.e. move mocha/ts-mocha from cli binary to config and create it by default?

I don't have strong opinions. Let's file an issue and consider the breaking change separately.

@fanatid
Copy link
Contributor Author

fanatid commented Jul 28, 2021

Updated.

  • Use command from [scripts] + test
  • On anchor init add default [scripts] + test for mocha/ts-mocha
  • Instead file allow to pass custom arguments

@armaniferrante armaniferrante merged commit 690c413 into coral-xyz:master Jul 29, 2021
@fanatid fanatid deleted the cli-custom-test-cmd branch July 30, 2021 04:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow other test framework than mocha for anchor test.
2 participants