image-sequencer icon indicating copy to clipboard operation
image-sequencer copied to clipboard

test cli steps parsing

Open daemon1024 opened this issue 4 years ago • 5 comments

Ref #1747

Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!

  • [ ] tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR -- or run tests locally with npm run test-all
  • [ ] code is in uniquely-named feature branch and has no merge conflicts
  • [ ] PR is descriptively titled
  • [ ] ask @publiclab/is-reviewers for help, in a comment below
  • [ ] Insert-step functionality is working correct as expected.

We're happy to help you get this ready -- don't be afraid to ask for help, and don't be discouraged if your tests fail at first!

If tests do fail, click on the red X to learn why by reading the logs.

Please be sure you've reviewed our contribution guidelines at https://publiclab.org/contributing-to-public-lab-software Please make sure to get at least two reviews before asking for merging the PR as that would make the PR more reliable on our part Thanks!

daemon1024 avatar Mar 07 '21 22:03 daemon1024

gitpod-io[bot] avatar Mar 07 '21 22:03 gitpod-io[bot]

I am facing a few roadblocks while making this test.

  1. I am not sure why node test/cli/*.js isn't running the newly created file.
  2. Even after using async/await it doesn't wait for the cli to stop processing, the program proceeds right after it warns about 'Output directory will remain empty till execution'
  3. When I try to read the error logs, it seems that the exit call stops the execution of test too.

Any kind of help appreciated

cc @jywarren @HarshKhandeparkar

daemon1024 avatar Mar 07 '21 22:03 daemon1024

Does node test/cli/steps.js work by itself? I'm pretty stumped too here, i wonder if it's something simple we're overlooking...

jywarren avatar Mar 12 '21 17:03 jywarren

Does node test/cli/steps.js work by itself?

Yup, I have attached the output below

I'm pretty stumped too here, i wonder if it's something simple we're overlooking...

Me too 😓

Here's the output, running *.js should match all the files, running steps.js individually does work.

$ node test/cli/*.js

TAP version 13
# testing save sequence function
 Your sequence was saved successfully!!
ok 1 creation success
ok 2 creation fail

1..2
# tests 2
# pass  2

# ok
$ node test/cli/steps.js 
TAP version 13
# testing steps parsing
Please wait 
 output directory generated will be empty until the execution is complete
ok 1 Steps parsed successfully

1..1
# tests 1
# pass  1

# ok

daemon1024 avatar Mar 12 '21 22:03 daemon1024

Also I made the test pass by adding blocking code, but I don't think that would be the right way to proceed, what are your opinion about it?

daemon1024 avatar Mar 12 '21 22:03 daemon1024