Skip to content

Adding Jest to Vue App and setting up test files - #98

Merged
monicakochofar merged 15 commits into
developfrom
mk-jest-vue
Oct 3, 2023
Merged

Adding Jest to Vue App and setting up test files#98
monicakochofar merged 15 commits into
developfrom
mk-jest-vue

Conversation

@monicakochofar

@monicakochofar monicakochofar commented Sep 29, 2023

Copy link
Copy Markdown
Contributor

This one became a doozy because of the new vue/test-utils library syntax, and ensuring our tests recognize the Vuetify Library/Vue-feather library, etc.

Here are the changes:

  • added base test files for all components (to be built upon)
  • updated READme with JEST notes
  • added a jest config with necessary properties to allow our tests to run smoothly
  • added jest test compatibility for Vuetify

commands

Ensure you are in app_vue folder from root

cd app_vue/

to run all tests:

npm test

to run a single test:

npm test -- <relative test.js path here>

// for ex. : ` npm test -- app_vue/src/components/shared/pointAddressField.test.js`

to view code coverage visually, ensure you have run npm test for the most recent, then open the following file in your browser:

app_vue/src/test/coverage/index.html

@monicakochofar

Copy link
Copy Markdown
Contributor Author

noteable difference in our folder structure, i think naming the test file similar to the component ensures they show up grouped together and easy to access:
image

there is also a test/coverage folder that holds our coverage report! this structure gets generated after npm test command:
image
Important note: this folder is exclusively related to JEST and does not hold any features in our app

@BallardRobinett BallardRobinett left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looking good! For some reason the sensorSideBarRoutes test is failing for me though and I can't figure out why. Do we want to get these to trigger on push with github actions for a future card?

nice work!

@monicakochofar

monicakochofar commented Sep 29, 2023

Copy link
Copy Markdown
Contributor Author

looking good! For some reason the sensorSideBarRoutes test is failing for me though and I can't figure out why. Do we want to get these to trigger on push with github actions for a future card?

nice work!

Thank you for testing it! Can you paste the error youre getting?

on my end when running npm test I see a coverage report, but scrolling up i see the component is passing:

image

And to your second question--Would love to get these to be triggered on push for our PRs!

@BallardRobinett

Copy link
Copy Markdown
Contributor

looking good! For some reason the sensorSideBarRoutes test is failing for me though and I can't figure out why. Do we want to get these to trigger on push with github actions for a future card?
nice work!

Thank you for testing it! Can you paste the error youre getting?

on my end when running npm test I see a coverage report, but scrolling up i see the component is passing:

image And to your second question--Would love to get these to be triggered on push for our PRs!

image

@monicakochofar

monicakochofar commented Sep 30, 2023

Copy link
Copy Markdown
Contributor Author

@BallardRobinett so turns out was missing a capitalization in the import statement! try giving it another shot now just pushed a fix.

strange that i never got the error on my end

@BallardRobinett

Copy link
Copy Markdown
Contributor

all tests passing for me now, nice work

@monicakochofar
monicakochofar merged commit 8d99092 into develop Oct 3, 2023
@monicakochofar
monicakochofar deleted the mk-jest-vue branch October 6, 2023 23:09
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.

2 participants