-
Notifications
You must be signed in to change notification settings - Fork 78
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
Add offline mode #2483
base: main
Are you sure you want to change the base?
Add offline mode #2483
Conversation
Sorry for the delay on this @RossComputerGuy! Overall, this change looks good to me, but we should add some tests before landing. |
73346a6
to
e1105ac
Compare
I've gone ahead and rebased it. I will look into getting tests in shortly. |
Can't figure out how the test should be done, I see there's configuration tests but none invoke read. |
I think you can either add a test like this or something similar to what's done in this file. Basically, you'll just want a test that runs |
e1105ac
to
e2abbf1
Compare
Ok, I added the test. |
@@ -30,6 +30,14 @@ void main() { | |||
Process? serveProcess; | |||
Directory? tempDir0; | |||
|
|||
final testScript = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really sure what's going on with these lines. Could we not get the package directory simply by doing p.dirname(p.dirname(Platform.script.toFilePath())
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That gives me /tmp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah right, because the test runner generates an entrypoint...
In that case, I think we should continue to activate webdev
from pub instead of using --source path
. This test should still work as long as we don't run dart pub get
on the created project before running webdev serve --offline
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh ok, I was assuming we would do it the way I did so new updates would actually work. I was getting an error saying --offline
wasn't a recognized flag even if I did activate it outside the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, that's a great point. Given that, I think we should move the test to webdev/test/integration_test.dart
. The tests there run webdev
from source so we won't have to worry about publishing before this new test will pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tbf, I could see how it could fit into both. Especially since once the next update is published and this PR is in that, then the flag would be available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've got the test added to the integration set.
e2abbf1
to
418f680
Compare
418f680
to
6fbec3a
Compare
--offline
flag which is useful for sandbox/networkless build systems such as Nix.Contribution guidelines:
dart format
.Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.