Skip to content

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

Merged
merged 4 commits into from
Jun 3, 2021
Merged

Conversation

SirusCodes
Copy link
Contributor

This PR adds test to verify that dot-files not included while publishing the package.

@google-cla google-cla bot added the cla: yes label May 5, 2021
import 'utils.dart';

void main() {
setUp(d.validPackageWithDotFiles.create);
Copy link
Member

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'));
Copy link
Member

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

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'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
Copy link
Contributor

I think including a test for dartdoc could resolve both #2967 and #2979.

@SirusCodes
Copy link
Contributor Author

@tusharojha This test would also resolve both the issues as it tests that all the dot-files are excluded from the package by default.

@SirusCodes
Copy link
Contributor Author

Hey @jonasfj there is some issues with these CI can you rerun them again?

@jonasfj
Copy link
Member

jonasfj commented Jun 3, 2021

Retriggered CI... maybe rebase this will fix some of it.

@SirusCodes
Copy link
Contributor Author

@jonasfj all green!

@jonasfj jonasfj merged commit 610254f into dart-lang:master Jun 3, 2021
@jonasfj
Copy link
Member

jonasfj commented Jun 3, 2021

Thanks this is awesome :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants