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

Replace bash test to TS using shelljs #251

Merged
merged 42 commits into from
Nov 25, 2022
Merged

Conversation

Nathan-SL
Copy link
Contributor

@Nathan-SL Nathan-SL commented Nov 8, 2022

Usage related changes

Development related changes

  • Tests written inside test_case/check.sh have been removed and instead test_case/check.ts will be used.
  • Tests are now initiated using npx mocha

Checklist:

  • Formatted the code
  • No linter errors + tried to avoid introducing linter warnings
  • Performed a self-review of the code
  • Rebased to the last commit of the target branch (or merged it into my branch)
  • Documented the changes
  • Updated the test directory (with a test case consisting of network.json, hardhat.config.ts, check.sh)
  • Linked issues which this PR resolves
  • All tests are passing (for external contributors who don't have access to the CI/CD pipeline)

Copy link
Collaborator

@FabijanC FabijanC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to directly use shelljs for something that's natively supported in node.js (cp, rm, mv, potentially others)

Also, when a check.ts file is introduced, the corresponding check.sh can be deleted. I think it would be easier to review if both were visible at the same time in the Files changed part of the PR.

@Nathan-SL
Copy link
Contributor Author

Nathan-SL commented Nov 15, 2022

Here I've used exec("cp ...") instead of fs.copyFileSync() due to fs.copyFileSync() failure for archive mode copying.

@FabijanC
Copy link
Collaborator

How much trouble would it be to also convert test.sh to e.g. TS? Doesn't have to be done in this PR, just asking for a future improvement.

scripts/test.sh Outdated Show resolved Hide resolved
test/utils/utils.ts Outdated Show resolved Hide resolved
test/utils/utils.ts Outdated Show resolved Hide resolved
test/utils/utils.ts Outdated Show resolved Hide resolved
test/recompilation-tests/hardhat-test/check.ts Outdated Show resolved Hide resolved
test/configuration-tests/with-sources-path/check.ts Outdated Show resolved Hide resolved
test/general-tests/postman/check.ts Outdated Show resolved Hide resolved
test/integrated-devnet-tests/with-stderr-to-file/check.ts Outdated Show resolved Hide resolved
@Nathan-SL
Copy link
Contributor Author

How much trouble would it be to also convert test.sh to e.g. TS? Doesn't have to be done in this PR, just asking for a future improvement.

I'd say not much trouble. It can be handled in a similar fashion like what this PR achieves.

Copy link
Collaborator

@FabijanC FabijanC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some conversations were resolved (even though no commit link was provided) so I marked them as resolved. But some I left unresolved since they don't look addressed to me.

StarknetPluginError in tests should be replaced with some kind of assertion error (it can be explicitly thrown, or implicitly - through e.g. chai expectations).

test/utils/deploy-funded-account.ts Outdated Show resolved Hide resolved
test/utils/utils.ts Outdated Show resolved Hide resolved
test/general-tests/starknet-verify/check.ts Outdated Show resolved Hide resolved
test/utils/cli-functions.ts Outdated Show resolved Hide resolved
test/general-tests/postman/check.ts Outdated Show resolved Hide resolved
test/general-tests/hardhat-run/check.ts Outdated Show resolved Hide resolved
scripts/test.sh Outdated Show resolved Hide resolved
@Nathan-SL
Copy link
Contributor Author

Some conversations were resolved (even though no commit link was provided) so I marked them as resolved. But some I left unresolved since they don't look addressed to me.

StarknetPluginError in tests should be replaced with some kind of assertion error (it can be explicitly thrown, or implicitly - through e.g. chai expectations).

f4cedb1

test/utils/deploy-funded-account.ts Outdated Show resolved Hide resolved
test/utils/utils.ts Outdated Show resolved Hide resolved
test/utils/utils.ts Outdated Show resolved Hide resolved
test/utils/utils.ts Outdated Show resolved Hide resolved
test/utils/utils.ts Outdated Show resolved Hide resolved
@FabijanC FabijanC merged commit 3183645 into master Nov 25, 2022
@FabijanC FabijanC deleted the replace-bash-to-shelljs branch November 25, 2022 08:57
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.

Replace bash tests with JS
2 participants