magic-commit icon indicating copy to clipboard operation
magic-commit copied to clipboard

write a basic unit test for the command line app

Open warengonzaga opened this issue 1 year ago • 26 comments

Summary:

There's a basic test.js file in the root directory; however, it is not the actual test for the current version of the command-line app. We need a tailored unit test for the command-line app.

Goal:

Write a unit test specifically for the current version and feature of the command line app.

Let me know if you want to take this issue or have questions.

warengonzaga avatar Oct 04 '24 18:10 warengonzaga

Hi, Waren. I would like to work on this, may I try this?

gitdevjin avatar Oct 04 '24 19:10 gitdevjin

hi sir,i would also like to try this.

Abhinav-Bansal751 avatar Oct 04 '24 20:10 Abhinav-Bansal751

Hey @gitdevjin and @Abhinav-Bansal751 feel free to submit your PR.

warengonzaga avatar Oct 05 '24 00:10 warengonzaga

@warengonzaga Thanks! :)

gitdevjin avatar Oct 05 '24 03:10 gitdevjin

Let me know which one of you can take it @Abhinav-Bansal751 @gitdevjin? So I can assign this issue.

warengonzaga avatar Oct 06 '24 06:10 warengonzaga

@warengonzaga I'll take it

gitdevjin avatar Oct 06 '24 06:10 gitdevjin

@warengonzaga I'll take it

Done! ✨

warengonzaga avatar Oct 06 '24 09:10 warengonzaga

Hi Waren, I tried to install your tool using npm install -g magicc but I couldn't even run it. Maybe my Macbook's problem. I tried all the solutions that are available Online, but none of them worked for me. I also tried to install it locally following Contributing.md. But it didn't work either. I am going to try to make it work. However, if I can't figure it out until tomorrow, I'll let you know; then probably you should assign others. Thanks!

gitdevjin avatar Oct 11 '24 03:10 gitdevjin

@gitdevjin Hey there. To install it locally, you must follow the following for your tests.

  1. yarn install
  2. yarn setup

Since you are using a MacBook, it should work as expected because it uses Linux commands.

I wouldn't recommend installing it using npm or yarn globally.

warengonzaga avatar Oct 11 '24 03:10 warengonzaga

Otherwise, you can use CodeSpaces and do the changes there.

warengonzaga avatar Oct 11 '24 03:10 warengonzaga

for those who are trying it in windows,and getting rm not recognized as internal or external command,try putting rmdir /s /q dist in clean script.This is for windows.now run npm run build,then npm run setup.Then u can use magicc command ig.I have Had got some peer dependency issues while doing npm install , and i resolved it with npm install --legacy-peer-deps.Hope it helps

Abhinav-Bansal751 avatar Oct 11 '24 04:10 Abhinav-Bansal751

@Abhinav-Bansal751 might be a good addition to script in package.json file?

Then add yarn setup:windows command.

warengonzaga avatar Oct 11 '24 04:10 warengonzaga

Yes ,I have added "setup:windows":"rmdir /s /q dist && yarn build" in my latest commit to add context to git message PR. pls see to it.

Abhinav-Bansal751 avatar Oct 11 '24 05:10 Abhinav-Bansal751

I think you replaced the code there; kindly take a look at my suggested changes. https://github.com/warengonzaga/magic-commit/pull/14#discussion_r1796464222

@Abhinav-Bansal751

warengonzaga avatar Oct 11 '24 06:10 warengonzaga

for those who are trying it in windows,and getting rm not recognized as internal or external command,try putting rmdir /s /q dist in clean script.This is for windows.now run npm run build,then npm run setup.Then u can use magicc command ig.I have Had got some peer dependency issues while doing npm install , and i resolved it with npm install --legacy-peer-deps.Hope it helps

I fixed this already @Abhinav-Bansal751 the easiest way to fix this is to remove those dependencies and add it again so that we can get the latest version. 😊

Because of that, it breaks our automated way to publish the NPM package.

warengonzaga avatar Oct 12 '24 06:10 warengonzaga

@gitdevjin how's your setup? Are you able to make any progress here? Let us know, I'm always here to help.

warengonzaga avatar Oct 12 '24 06:10 warengonzaga

for those who are trying it in windows,and getting rm not recognized as internal or external command,try putting rmdir /s /q dist in clean script.This is for windows.now run npm run build,then npm run setup.Then u can use magicc command ig.I have Had got some peer dependency issues while doing npm install , and i resolved it with npm install --legacy-peer-deps.Hope it helps

I fixed this already @Abhinav-Bansal751 the easiest way to fix this is to remove those dependencies and add it again so that we can get the latest version. 😊

Because of that, it breaks our automated way to publish the NPM package.

ohk,i didnt know about that earlier.

Abhinav-Bansal751 avatar Oct 12 '24 06:10 Abhinav-Bansal751

Hi @warengonzaga. The application is now running; however, I'm encountering issues with the test suite. It seems that ava isn't recognizing the React syntax.

gitdevjin avatar Oct 12 '24 06:10 gitdevjin

We can remove Ava or XO there, as long as we can test if the CLI works properly.

warengonzaga avatar Oct 12 '24 06:10 warengonzaga

I'm not familiar with Ava and XO. It came with Ink when I generated the project. According to Copilot, Ava is used for running tests while Xo is used to lint the React. You can choose any other linting or test suite that suits our purpose. @gitdevjin

warengonzaga avatar Oct 12 '24 06:10 warengonzaga

@gitdevjin what's the progress here?

warengonzaga avatar Oct 19 '24 17:10 warengonzaga

What about using this @gitdevjin? https://github.com/vadimdemedes/ink?tab=readme-ov-file#testing

warengonzaga avatar Oct 20 '24 06:10 warengonzaga

@warengonzaga I apologize for the delayed response; I was occupied with midterms. I appreciate your suggestion and will give it a try. If I encounter any issues, I’ll reach out for help. Thank you for your understanding!

gitdevjin avatar Oct 20 '24 15:10 gitdevjin

No worries, @gitdevjin, just checking if you're stuck. I'm here to help.

warengonzaga avatar Oct 21 '24 01:10 warengonzaga

@warengonzaga I tried working on the test configuration issue, but I couldn’t get it to work. I think it might be best to assign it to someone else. Sorry for the trouble.

gitdevjin avatar Oct 25 '24 07:10 gitdevjin

Alright, thanks, @gitdevjin. Might someone be interested in working on this?

warengonzaga avatar Feb 10 '25 08:02 warengonzaga