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

test for scaffolding #194

Open
robmcguinness opened this issue Mar 27, 2019 · 4 comments
Open

test for scaffolding #194

robmcguinness opened this issue Mar 27, 2019 · 4 comments

Comments

@robmcguinness
Copy link
Contributor

robmcguinness commented Mar 27, 2019

Write a unit test that runs the cli command for scaffolding projects and test to ensure artifacts are installed properly.

@MichaelDimmitt
Copy link
Contributor

MichaelDimmitt commented May 8, 2019

Hi rob; Not sure if there is already a framework for scaffolding @availity/workflow

However, using Jest,

I Wrote an integration test that scaffolds the cli. After the cli is scaffolded you have the ability to unit test the project however you want.

test_results

Unfortunately it takes 1min 35 seconds to scaffold the cli on my local computer.
However, once the project is scaffolded unit tests after that bottleneck will run quickly.

I am looking for alternative ideas or other cli's that have a better solution.

The test suite uses child_process {exec} and can be found at:
https://github.com/MichaelDimmitt/simp-js_term/blob/master/terminal.test.js

Used jest because it seemed to agree with the javascript in the project.
However, another candidate test suite for the cli commands would be a bash test suite "bats" https://opensource.com/article/19/2/testing-bash-bats

Next I am going to look at create-react-app to see how they attack the test.

Feedback appreciated.

@MichaelDimmitt
Copy link
Contributor

https://github.com/facebook/create-react-app/blob/master/test/fixtures/__shared__/test-setup.js

Here is how create react app does their Setup and creates their CLI.
It looks like create-react-app uses a util for setup that takes a template and runs yarnpkg install.
https://github.com/facebook/create-react-app/blob/master/test/fixtures/__shared__/util/setup.js#L54

create-react-app uses execa ... "a better child_process"

@MichaelDimmitt
Copy link
Contributor

MichaelDimmitt commented May 10, 2019

@robmcguinness, are these comments heading in the right direction?

The example is an integration test that allows unit tests after the project is scaffolded.

Using Jest test suite, each test does wait on the previous test to finish.
my example that scaffolds availity workflow: https://github.com/MichaelDimmitt/simp-js_term/blob/master/terminal.test.js#L31

I did not open a pr because I need to research how to ignore the test when normally running the test suite since the scaffold test takes 1minute 40seconds to run.

I think it would be a good test for the travis-ci but not necessarily for developers running the test suite before every commit.

@robmcguinness
Copy link
Contributor Author

@MichaelDimmitt sorry haven't to time fully review. Quick pass of code looks good. Appreciate the research but I'll need a little more time to review.

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

No branches or pull requests

2 participants