-
Notifications
You must be signed in to change notification settings - Fork 232
Add test to ignore dot-files #2983
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
Conversation
import 'utils.dart'; | ||
|
||
void main() { | ||
setUp(d.validPackageWithDotFiles.create); |
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.
Since validPackageWithDotFiles
is only used in this file, can we maybe just move it into this file.
}); | ||
|
||
expect(pub.stdout, neverEmits('.dart_tool')); | ||
expect(pub.stdout, neverEmits('.github')); |
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.
You might want to also test that it does emit test_pkg.dart
otherwise, this test will pass when there is no output on stdout :D
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 facing some weird issue while doing this, can you help me with it?
I have added expect(pub.stdout, emits('test_pkg.dart'));
line and it fails.
log
00:00 +0: Check if package doesn't include dot-files
00:17 +0 -1: Check if package doesn't include dot-files [E]
Expected: should emit an event that 'test_pkg.dart'
Actual: <Instance of 'StreamQueue<String>'>
Which: emitted • Uploading...
which emitted an event that is different.
Expected: test_pkg.d ...
Actual: Uploading. ...
^
Differ at offset 0
�[38;5;244mfail�[39;49m
�[38;5;244m_expect.<fn>�[39;49m
�[38;5;244mdart:async/zone.dart 1362:47 _rootRunUnary�[39;49m
�[38;5;244mdart:async/zone.dart 1265:19 _CustomZone.runUnary�[39;49m
�[38;5;244mdart:async/future_impl.dart 152:18 _FutureListener.handleValue�[39;49m
�[38;5;244mdart:async/future_impl.dart 704:45 Future._propagateToListeners.handleValueCallback�[39;49m
�[38;5;244mdart:async/future_impl.dart 733:32 Future._propagateToListeners�[39;49m
�[38;5;244mdart:async/future_impl.dart 539:5 Future._completeWithValue�[39;49m
�[38;5;244mdart:async-patch/async_patch.dart 254:13 _completeOnAsyncReturn�[39;49m
�[38;5;244mpackage:test_api/src/expect/stream_matcher.dart _StreamMatcher.matchAsync.<fn>�[39;49m
Consider enabling the flag chain-stack-traces to receive more detailed exceptions.
For example, 'pub run test --chain-stack-traces'.
Process `pub lish` was killed with SIGKILL in a tear-down. Output:
[e] FINE: Pub 0.1.2+3
[e] FINE: Archiving and publishing Instance of 'Package'.
MSG : Publishing test_pkg 1.0.0 to http://localhost:50192:
| |-- CHANGELOG.md
| |-- LICENSE
| |-- README.md
| |-- lib
�[38;5;248m| | '-- test_pkg.dart�[39;49m
| '-- pubspec.yaml
[e] FINE: Creating .tar.gz stream containing:
[e] | .\README.md
[e] | .\pubspec.yaml
[e] | .\LICENSE
�[38;5;248m[e] | .\lib\test_pkg.dart�[39;49m
[e] | .\CHANGELOG.md
[e] IO : Spawning "cmd /c git --version" in C:\Users\darshan\AppData\Local\Temp\dart_test_16d2815\myapp\.
[e] IO : Finished git. Exit code 0.
[e] | stdout:
[e] | | git version 2.31.1.windows.1
[e] | Nothing output on stderr.
[e] FINE: Determined git command git.
[e] IO : Spawning "cmd /c git check-ignore --quiet ." in C:\Users\darshan\AppData\Local\Temp\dart_test_16d2815\myapp\.
[e] IO : Finished git. Exit code 128.
[e] | Nothing output on stdout.
[e] | stderr:
[e] | | fatal: not a git repository (or any of the parent directories): .git
[e] IO : Reading binary file .\README.md.
[e] IO : Read 24 bytes from .\README.md.
[e] IO : Reading binary file .\CHANGELOG.md.
[e] IO : Read 22 bytes from .\CHANGELOG.md.
[e] IO : Get versions from http://localhost:50192/api/packages/test_pkg.
[e] IO : HTTP GET http://localhost:50192/api/packages/test_pkg
[e] | Accept: application/vnd.pub.v2+json
[e] | X-Pub-OS: windows
[e] | X-Pub-Command: publish
[e] | X-Pub-Session-ID: 90D97F1C-1F5C-402D-8C66-8A4950675360
[e] | X-Pub-Environment: test-environment
[e] | user-agent: Dart pub 0.1.2+3
[e] IO : HTTP response 404 Not Found for GET http://localhost:50192/api/packages/test_pkg
[e] | took 0:00:00.260965
[e] | date: Tue, 11 May 2021 18:49:53 GMT
[e] | content-length: 39
[e] | x-frame-options: SAMEORIGIN
[e] | content-type: text/plain; charset=utf-8
[e] | x-xss-protection: 1; mode=block
[e] | x-content-type-options: nosniff
[e] | server: dart:io with Shelf
MSG :
| Publishing is forever; packages cannot be unpublished.
| Policy details are available at https://pub.dev/policy
MSG :
| Do you want to publish test_pkg 1.0.0 (y/N)?
[e] FINE: Showing confirm message:
[e] | Do you want to publish test_pkg 1.0.0
[e] FINE: Loading OAuth2 credentials.
[e] FINE: Saving OAuth2 credentials.
[e] IO : Writing 199 characters to text file C:\Users\darshan\AppData\Local\Temp\dart_test_16d2815\cache\credentials.json.
MSG : Uploading...
[e] IO : HTTP GET http://localhost:50192/api/packages/versions/new
[e] | Accept: application/vnd.pub.v2+json
[e] | authorization: <censored>
[e] | X-Pub-OS: windows
[e] | X-Pub-Command: publish
[e] | X-Pub-Session-ID: 90D97F1C-1F5C-402D-8C66-8A4950675360
[e] | X-Pub-Environment: test-environment
[e] | user-agent: Dart pub 0.1.2+3
[e] IO : HTTP response 200 OK for GET http://localhost:50192/api/packages/versions/new
[e] | took 0:00:00.094118
[e] | date: Tue, 11 May 2021 18:49:53 GMT
[e] | content-length: 86
[e] | x-frame-options: SAMEORIGIN
[e] | content-type: application/json
[e] | x-xss-protection: 1; mode=block
[e] | x-content-type-options: nosniff
[e] | server: dart:io with Shelf
00:17 +0 -1: Some tests failed.
Unhandled exception:
Dummy exception to set exit code.
Exited (255)
In logs you can see that test_pkg.dart
is present.
@tusharojha This test would also resolve both the issues as it tests that all the dot-files are excluded from the package by default. |
Hey @jonasfj there is some issues with these CI can you rerun them again? |
Retriggered CI... maybe rebase this will fix some of it. |
@jonasfj all green! |
Thanks this is awesome :) |
This PR adds test to verify that dot-files not included while publishing the package.