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

Script to test single service #622

Merged
merged 2 commits into from
Aug 24, 2020

Conversation

atrovato
Copy link
Contributor

@atrovato atrovato commented Dec 1, 2019

Pull Request check-list

To ensure your Pull Request can be accepted as fast as possible, make sure to review and check all of these items:

  • If your changes affects code, did your write the tests?
  • Are tests passing? (npm test on both front/server)
  • Is the linter passing? (npm run eslint on both front/server)
  • Did you run prettier? (npm run prettier on both front/server)
  • If your changes modify the API (REST or Node.js), did you modify the API documentation? (Documentation is based on comments in code)
  • If you are adding a new features/services which needs explanation, did you modify the user documentation? See the GitHub repo and the website.
  • Did you add fake requests data for the demo mode (front/src/config/demo.json) so that the demo website is working without a backend? (if needed) See https://demo.gladysassistant.com.

NOTE: these things are not required to open a PR and can be done afterwards / while the PR is open.

Description of change

Add script to test single service.
Usage SERVICE=zwave npm run test-service

@Pierre-Gilles
Copy link
Contributor

Nice! Could it be possible to have a parameters instead of a env variable? Like :

npm run test-service zwave

?

@atrovato
Copy link
Contributor Author

atrovato commented Dec 3, 2019

I searched for, but didn't find anything for npm scripts using command args.
I'll search more this evening.

@atrovato
Copy link
Contributor Author

atrovato commented Dec 3, 2019

I can't find any other simple solution.

@atrovato atrovato force-pushed the test-service branch 2 times, most recently from 039bf15 to e527e78 Compare December 7, 2019 08:47
@hotfix31
Copy link
Contributor

I think it's possible:
https://docs.npmjs.com/cli/run-script#description

As of npm@2.0.0, you can use custom arguments when executing scripts. The special option -- is used by getopt to delimit the end of the options. npm will pass all the arguments after the -- directly to your script:
npm run test -- --grep="pattern"
The arguments will only be passed to the script specified after npm run and not to any pre or post script.

@atrovato
Copy link
Contributor Author

I may mis something, but I can't make it work.
It will be easier to create a JS file to handle param and execute service tests.

@atrovato
Copy link
Contributor Author

Updated to npm run test-service --service=tasmota

@atrovato atrovato requested a review from Pierre-Gilles August 19, 2020 12:41
@codecov
Copy link

codecov bot commented Aug 19, 2020

Codecov Report

Merging #622 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #622   +/-   ##
=======================================
  Coverage   93.49%   93.49%           
=======================================
  Files         428      428           
  Lines        5578     5578           
=======================================
  Hits         5215     5215           
  Misses        363      363           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8dc3a24...7caad6a. Read the comment docs.

@Pierre-Gilles
Copy link
Contributor

Merci pour cette PR ! :) Je regarde la semaine prochaine lors de mes jours Gladys.

@Pierre-Gilles Pierre-Gilles merged commit 496e3a5 into GladysAssistant:master Aug 24, 2020
@Pierre-Gilles
Copy link
Contributor

Thanks for your PR !

I updated the doc with the script:

https://gladysassistant.com/fr/docs/api/setup-development-environnement#lancer-les-tests-dun-seul-service

R6n0 pushed a commit to R6n0/Gladys that referenced this pull request Dec 2, 2020
Co-authored-by: Pierre-Gilles Leymarie <pierregilles.leymarie@gmail.com>
@atrovato atrovato deleted the test-service branch November 28, 2021 20:32
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.

3 participants