-
Notifications
You must be signed in to change notification settings - Fork 42
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
Replace local tests with E2E tests #60
Conversation
@@ -64,6 +64,6 @@ function run(str, opts, isWatch) { | |||
'\n' | |||
); | |||
} | |||
process.exit(err.code || 1); | |||
process.exit(typeof err.code == 'number' ? err.code : 1); |
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.
Caught this bug while running these tests - some NodeJS errors have the .code
property set to a string, which if you pass here will cause the process to exit cleanly
66f8f4d
to
a83f6f6
Compare
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 🙌
Can rely on --preserve-symlinks-main flag when things get complicated (i.e. uninstalling karmatic's devDep on webpack)
So task fails if test fail
a83f6f6
to
6c923e2
Compare
To unblock rollup integration, I'm going to go ahead and merge this change, but I'm happy to address any other concerns people have. Just @-mention me :) |
While working on #59, I wanted a way to test that our rollup code worked as expected. That rabbit hole lead me here 😅
This PR replaces the "local" test suite we had with what I'm calling E2E tests. The
e2e-test
directory contains sub directories that model how a user of karmatic might use karmatic. Each subdir contains a package.json, some source code, and some tests. To run the tests we just runnpm install
in each directory and runkarmatic
in that directory (therun-e2e-tests.mjs
script automates this)Each e2e test package.json includes karmatic using a local
file:../..
reference so the local karmatic source is symlinked into the node_modules folder of the e2e tests so they test the local build output.While this kind of test is a little overkill for karmatic now, I think it really becomes useful in light of #59 because of how we do webpack/rollup detection. Since we determine which bundler to use based on what is installed, we need to run tests in directories that either have webpack or rollup installed, not both. Because of this, we can't just install webpack and rollup and devDeps cause our local tests will only ever run using webpack since that is the preferred bundler if it present. This testing infra allows us to use different kinds of setups to verify karmatic works as expected.
I hope a lot of this becomes easier with npm v7's workspace support.
EDIT: Oh, I forgot to mention - the
webpack-default
test includes all the tests that were previous test suite