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

test: add integration testing #357

Merged
merged 26 commits into from
Feb 28, 2024
Merged

test: add integration testing #357

merged 26 commits into from
Feb 28, 2024

Conversation

sockmaster27
Copy link
Contributor

Fixes #341

@sockmaster27
Copy link
Contributor Author

sockmaster27 commented Feb 21, 2024

TODO:

  • Use TypeScript in tests
  • Fix issue where tests always fail on first run
  • Signal when extension is ready instead of waiting
  • Fix Unable to resolve filesystem provider with relative file path 'flixcompiler:141183124/CHANGELOG'
  • Write FlixRelease to somewhere persistent to avoid downloading compiler every time (unless it should just be part of the test?)
  • GitHub action

@sockmaster27
Copy link
Contributor Author

  • Fix issue where tests always fail on first run

Seems to be entirely dependent on the existence of .vscode-test/user-data/Workspaces/<some number>/workspace.json.
If this does not exist the test will quit after encountering the first await.

@sockmaster27 sockmaster27 marked this pull request as draft February 22, 2024 19:59
@sockmaster27
Copy link
Contributor Author

Got this far with GitHub action

- run: |
        apt-get update -y
        apt-get install libnss3-dev libgdk-pixbuf2.0-dev libgtk-3-dev libxss-dev -y
        apt-get install libasound2 -y
        # Run tests through Xvfb to give Electron a screen to draw to
        apt-get install xvfb -y
        xvfb-run -a npm test

But currently blocked by

| Warning: vkCreateInstance: Found no drivers!
| Warning: vkCreateInstance failed with VK_ERROR_INCOMPATIBLE_DRIVER

@magnus-madsen
Copy link
Member

Does the internet say anything about that? You would think it would be possible to run on GitHub CI since VSCode and GitHub are both Microsoft.

@magnus-madsen
Copy link
Member

@sockmaster27
Copy link
Contributor Author

https://code.visualstudio.com/api/working-with-extensions/continuous-integration#github-actions

This was the one I followed, but at least when running locally with act, it needs a lot of extra installations.
Perhaps it works when running it on the real thing. I can try pushing it.

The installations also take quite a lot of time each run, so either way, it might also be preferable to create a Docker image to run on.

@magnus-madsen
Copy link
Member

Do you want to wrap this PR up and then we can try GitHub CI in a new PR? I think that would be best.

@magnus-madsen
Copy link
Member

Ill give some feedback on the code.

package.json Show resolved Hide resolved
test/hover.test.js Outdated Show resolved Hide resolved
test/hover.test.js Outdated Show resolved Hide resolved
test/testWorkspace/Main.flix Outdated Show resolved Hide resolved
])
assert.strictEqual(r[0].contents[0].value, '\n```flix\nType\n```\n')
})
})
Copy link
Member

Choose a reason for hiding this comment

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

I think testing the HoverProvider is a good start, if we have like 5-10 tests.

Then I think we should test inline diagnostics on a separate broken program.

But what I would also like is to check that:

  • Adding a Flix file works.
  • Removing a Flix file works.
  • A project with a Flix toml and some dependencies works.

Essentially I am more worried about the "stuff around" than the providers, because if the HoverProvider works probably all the other providers work. What could break is the integration.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we should just treat this PR as an introduction of the setup, then we can write some actual test cases in another one.

Copy link
Member

Choose a reason for hiding this comment

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

Ok,, we can wait with the file manipulation stuff, but lets get the rest done in this PR.

test/util.js Outdated Show resolved Hide resolved
@magnus-madsen
Copy link
Member

Write FlixRelease to somewhere persistent to avoid downloading compiler every time (unless it should just be part of the test?)

Lets let it be part of the test!

@sockmaster27
Copy link
Contributor Author

Do you want to wrap this PR up and then we can try GitHub CI in a new PR? I think that would be best.

It should be working as is, so sounds good 👍

@magnus-madsen
Copy link
Member

Do you want to wrap this PR up and then we can try GitHub CI in a new PR? I think that would be best.

It should be working as is, so sounds good 👍

Roger. So if you cleanup my comments then we merge it in. Then in a subsequent PR we can fiddle with the GitHub CI part.

Copy link
Member

@mlutze mlutze left a comment

Choose a reason for hiding this comment

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

Can we also get a Readme about how to run the tests?

@magnus-madsen
Copy link
Member

Can we also get a Readme about how to run the tests?

Yes please. @sockmaster27 Can you add it to README.md?

@sockmaster27
Copy link
Contributor Author

  • Fix Unable to resolve filesystem provider with relative file path 'flixcompiler:141183124/CHANGELOG'

Can't figure out what causes this but it seems harmless

@sockmaster27 sockmaster27 marked this pull request as ready for review February 26, 2024 15:38
@magnus-madsen magnus-madsen merged commit ded4c45 into flix:master Feb 28, 2024
4 checks passed
@magnus-madsen
Copy link
Member

Merged! What are the next steps?

@sockmaster27 sockmaster27 deleted the test branch February 28, 2024 07:05
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.

Add automated integration tests
3 participants