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

[WIP] Add suitePath getter #2281

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

[WIP] Add suitePath getter #2281

wants to merge 3 commits into from

Conversation

jakemac53
Copy link
Contributor

@jakemac53 jakemac53 commented Sep 11, 2024

Possible resolution to #110.

Adds a suitePath getter which gives the package relative path to the current suite if it is available.

  • Only works in the test runner itself (we could maybe support some other scenarios if we wanted, using Platform.script on the VM and Uri.base on the web).
  • On the web, Uri.base already actually contains the full path including the suite, so you don't want to use this there which is a bit weird. On the VM you want to do something like Uri.base.resolve(suitePath).resolve(<some-suite-relative-path>).
    • We could consider instead providing a function for resolving suite relative paths, or make this API give you the absolute path to the suite (which would be an http URI on the web).
    • We could also add a <base> tag to the html page, setting it to be the package root.

I also expanded the test coverage in test_api to VM/chrome and all compilers, just to ensure this works everywhere.

@jakemac53 jakemac53 requested a review from a team as a code owner September 11, 2024 21:14
@jakemac53 jakemac53 marked this pull request as draft September 11, 2024 21:14
Copy link

PR Health

Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

Package publish validation ✔️
Package Version Status
package:checks 0.3.1-wip WIP (no publish necessary)
package:test 1.25.9-wip WIP (no publish necessary)
package:test_api 0.7.4-wip WIP (no publish necessary)
package:test_core 0.6.6-wip WIP (no publish necessary)

Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.

@natebosch
Copy link
Member

@matanlurey would you be able to put together a prototype of your intended usage so we can confirm whether this solves the problem?

@jakemac53
Copy link
Contributor Author

This is only meant to solve the original problem stated in #110, which is getting the path to the test script. It does not help with getting access to the package root, but Uri.base does already give you that (whenever using the test runner).

@natebosch
Copy link
Member

but Uri.base does already give you that

Does this get impacted by changes to the working directory?

@jakemac53
Copy link
Contributor Author

Does this get impacted by changes to the working directory?

Probably, although I don't know for sure. But, that is partially why I like just exposing the relative suite path. We can be out of the business of the rest of it, which isn't really in our control. We can provide suggestions with caveats (like using Uri.base), which will work for most, but we don't guarantee them or support them directly.

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.

2 participants