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

[Internals] Improve unit tests #4262

Merged
merged 2 commits into from
Jan 24, 2020
Merged

Conversation

himynameisdave
Copy link
Contributor

While implementing #3311 (and adding some unit tests for some new util functions I wrote), I noticed that the existing unit tests:

  • are broken (specifically this case).
  • are never run on CI / anywhere.

This ticket fixes the first item by making the test more valuable and testing the real case that it was meant to catch (for Windows filenames -- see #3862).

It addresses the second issue by adding unit testing to the CI tasks. Not sure if this is actually something we want seeing as we're only testing one module (for now).

I hope that this encourages more unit testing in the future (although I think the integration/other tests are probably solid enough already). In general I think unit tests are pretty cheap, but one thing they are good for (especially in a large OS project) is for documenting how code works, making it easier for folks new to the project to understand. 👍

Resolves #4261

@himynameisdave
Copy link
Contributor Author

Question: can/should we merge the Lint + Unit CI tasks into one, so that the dependencies only need to be installed once?

@himynameisdave himynameisdave changed the title Improve unit tests [Internals] Improve unit tests Jan 21, 2020
@@ -10,7 +10,7 @@ describe('get_name_from_filename', () => {
assert.equal(get_name_from_filename('path/to/Widget/index.svelte'), 'Widget');
});

it('handles unusual filenames', () => {
Copy link

Choose a reason for hiding this comment

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

I don't think you want to replace these lines but add a case for Windows instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Conduitry Conduitry merged commit bf006a4 into sveltejs:master Jan 24, 2020
@himynameisdave himynameisdave deleted the issues/4261 branch January 24, 2020 16:36
jesseskinner pushed a commit to jesseskinner/svelte that referenced this pull request Feb 27, 2020
taylorzane pushed a commit to taylorzane/svelte that referenced this pull request Dec 17, 2020
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.

[Internals] Broken unit test when running test:unit
2 participants