Skip to content

Allow testing src directly #1396

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

Merged
merged 10 commits into from
Jan 10, 2020
Merged

Allow testing src directly #1396

merged 10 commits into from
Jan 10, 2020

Conversation

dobromir-hristov
Copy link
Contributor

@dobromir-hristov dobromir-hristov commented Jan 7, 2020

Description

This PR allows testing the src files directly, instead of the old way, by building the package first.
The main advantages are speed and debugging. In-code breakpoints now should work properly.
Watch mode also works very fast.

The main changes were:

  1. Remove the ~vue/test-utils alias, as it was causing more problems than it was solving.
  2. Swap inside webpack the dist of both test-utils and server-utils, with their src, only when in dev testing mode.
  3. Allow the old tests against the build to be run. This ensures the end user gets a fully working suite.
  4. Change both test-utils and server-test-utils exports from a default exported object to a named export. This should not affect usage after building the package, as we are using cjs format in the end. Adjust where necessary.
  5. Rename all references to the old aliases.
  6. Add an extra script command to allow testing only in dev mode. This should not change in any way the existing flow.

How to run

If you want to run the tests against the source:

yarn test:unit:only:dev

Thanks to Bogdan for helping debug the initial Webpack config.

Copy link
Member

@lmiller1990 lmiller1990 left a comment

Choose a reason for hiding this comment

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

I'll pull this down and try it out hopefully in the next day or two, but everything looks like it makes sense... awesome job, I'm really excited to use the watcher for the tests.

Just to confirm my suspicion, when the Karma tests run it still runs the "old" way which is to bundle the entire project and load the dist file?

@dobromir-hristov
Copy link
Contributor Author

Yep. We only run against the src if you run that command :)
I have tested both workflows and all pass + ci also passes.

@lmiller1990
Copy link
Member

lmiller1990 commented Jan 8, 2020

Great... if it all works the same, sounds good to me. Just left one comment.

Copy link
Member

@afontcu afontcu left a comment

Choose a reason for hiding this comment

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

Looks great! Just added a minor nitpick suggestion.

👍

Co-Authored-By: Adrià Fontcuberta <[email protected]>
@lmiller1990 lmiller1990 merged commit 5d892bb into dev Jan 10, 2020
@dobromir-hristov dobromir-hristov deleted the feat/allow-testing-src-directly branch January 10, 2020 08:07
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.

4 participants