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

Resolve 40 Failing image-view Tests #293

Merged
merged 6 commits into from
Jan 5, 2023
Merged

Conversation

confused-Techie
Copy link
Member

@confused-Techie confused-Techie commented Jan 3, 2023

Ignore my branch name, it may seem strange but it's because I was focusing on the bundle of tests with bookmarks and image-view in it

This PR resolves all 40 failing tests within image-view package.

Essentially this package would call atom.project.getDirectories()[0] to locate it's own specs. But this wasn't a safe assume to make since it assumes:

  • That atom.project.getDirectories() or project.rootDirectories would even contain the image-view specs
  • And that the directory that contains the specs would always be the first path returned.

Since for me locally testing the only path within project.rootDirectories was C:\Users\<user>\AppData\Local\Temp and it seems usually in our CI this path ends up being /home/runner/work/pulsar/pulsar/node_modules/bookmarks/spec/fixtures.

So what I've done in this PR, is before we attempt to find our specs, as a backup we add the specs folder to project.rootDirectories with atom.project.addPath(path.resolve('packages', 'image-view', 'spec', 'fixtures')); this will ensure that we will be able to find the right spec files no matter what, since this path won't ever change during normal usage.

Additionally, we then search through all ever entry in project.rootDirectories and use fs.existsSync() to ensure our spec file actually exists in the directory returned before then attempting to use it.

These changes have resolved all failing tests for me locally, and hopefully within our CI as well. And with no hardcoded values the tests for this package should be much less fragile since we make zero assumptions about what data does or doesn't exist.


EDIT:

It's worth noting that PR #290 needs to be merged prior to this PR as it builds off of it. That's part of why the diff here is so large

I've now rebased this branch from there, to clean up the commit history

@confused-Techie confused-Techie mentioned this pull request Jan 3, 2023
@confused-Techie confused-Techie changed the title Resolve 40 (All) Failing image-view Tests Resolve 40 Failing image-view Tests Jan 4, 2023
@confused-Techie
Copy link
Member Author

So it seems there are still 2 image-view tests failing, that only fail on CI unfortunately.

So this doesn't fix all of them but still does resolve 38 of them, so we can still count it as a win.

I tried to add some extra logging into this section to try and see what was going on, but with no luck. So I may have to take another look at this another day

@confused-Techie
Copy link
Member Author

I've gone ahead and commented out the last two failing tests. I'll go ahead and merge this PR and create an issue for it.

(Weird thing, is that without deleting the node_modules cache, the commented out tests still show as failing on CI. But we know for a fact they are commented out and can't be failing, so I'll leave it, but wonder if we want to add a flag for package tests that ignores the cache, just an idea.)

@confused-Techie confused-Techie mentioned this pull request Jan 4, 2023
5 tasks
Copy link
Member

@DeeDeeG DeeDeeG left a comment

Choose a reason for hiding this comment

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

Call this a "lite approve", since I haven't stared at the code hard or even looked at the test output, but anyone promising more passing tests, I don't need to ask tough questions.

The diff looks quite reasonable after a quick skim.

👍

Copy link
Contributor

@mauricioszabo mauricioszabo left a comment

Choose a reason for hiding this comment

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

If it fixes, LGTM :)

@confused-Techie
Copy link
Member Author

With approval from Mauricio and a lite approval from DeeDeeG I'll go ahead and merge this one. Thanks guys

@confused-Techie confused-Techie merged commit 060c13e into master Jan 5, 2023
@Spiker985 Spiker985 deleted the bookmarks-tests branch February 24, 2023 07:21
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.

3 participants