-
Notifications
You must be signed in to change notification settings - Fork 46
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
Major Jest Upgrades #1082
Major Jest Upgrades #1082
Conversation
…js and *.data.js test files
…allow component tests to use modern JS libraries
…in order to use helper libraries for testing web components
…compile Pattern Lab before running any Jest tests
…ool to help evaluate the state of the DOM inside components being tested
…t to assist with debugging VRT issues until full Github integration is wired up
…pdate Twig renderer calls to compile even faster
… using JIT (just in time) compiling
…he script's name itself
… + image task work only have to happen once
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved 👍 Love that we can now use ES6 in our test files and that we can exclude supporting files like *.data.js
. Good stuff! Ran locally and start/test/build
all worked as expected.
One question... I ran npm run test
after doing a full clean
and setup
and the button Jest test took ~30 seconds. Ran it again, took ~15 seconds. Ran it again, took ~8 seconds. How/why does this get faster each time? Is this expected?
Thanks @danielamorse! The faster subsequent test runs are probably related to a few different things (all related to caching):
Also, fwiw, I think there’s still a couple additional optimizations we might be able to try out to speed things up even further — running a test within 30s is just the ballpark max time I’m shooting for with this initial round of updates! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All test are passing. I have the same results as @danielamorse first test take 30s then every next is shorter. My quickest test was 10s. I noticed that bolt-button
tests are the longest ones. The test is on the top of the list but is finished as last ones. I think is related to a new testing approach.
Great work, i happy that we can use ES6 in test and i like new approach. Maybe we can move renderTwig
and renderTwigString
to separate file because i think we will be using this functions in all our tests. One more time great job.
const globby = require('globby'); | ||
const testFilesToIgnore = globby.sync([ | ||
'./packages/components/**/*/__tests__/*.e2e.js', | ||
'./packages/components/**/*/__tests__/*.data.js' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This testFilesToIgnore don't cover figure-data.js
this looking files with .data.js
and bolt-figure
component use figure-data.js
. Please correct me if i'm wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, my bad i saw that you change figure-data.js
to figure.data.js
:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome. Bonus points for super clean and readable git commits!
Thanks guys!! |
Jira
http://vjira2:8080/browse/BDS-1041
Summary
Major upgrades to Jest to support testing web component rendering in a browser and web page instance that's generated automatically, in addition to adding the ability to run visual regression tests on these.
Details
Jest-specific Updates
*.e2e.js
and*.data.js
test filesJest Test-specific Updates
How to test