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

pub outdated: added clear message for null safe packages #2898

Merged
merged 3 commits into from
Mar 12, 2021

Conversation

tusharojha
Copy link
Contributor

Description

The pub outdated --mode=null-safety command gives confusing comments for packages that are already null safe. I have added a message i.e. All dependencies opt in to null-safety. in a case when there are no dependencies shown inside the table.

Fixes #2745

@sigurdm PTAL and suggest changes if any.

@google-cla google-cla bot added the cla: yes label Mar 5, 2021
Copy link
Contributor

@sigurdm sigurdm left a comment

Choose a reason for hiding this comment

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

This will also need some testing.

Look in test/outdated/outdated_test.dart and see if you can make a test-case that prints this.

lib/src/command/outdated.dart Outdated Show resolved Hide resolved
@tusharojha
Copy link
Contributor Author

I have added the message to mode please review it!

Also, for adding a unit test I tried creating a test case as follows:

 test('null-safety already migrated', () async {
    await servePackages((builder) => builder
      ..serve('foo', '1.0.0', pubspec: {
        'environment': {'sdk': '>=2.9.0 < 3.0.0'}
      })
      ..serve('foo', '2.0.0', deps: {
        'bar': '2.0.0'
      }, pubspec: {
        'environment': {'sdk': '>=2.12.0 < 3.0.0'}
      })
      ..serve('bar', '1.0.0', pubspec: {
        'environment': {'sdk': '>=2.9.0 < 3.0.0'}
      })
      ..serve('bar', '2.0.0', deps: {
        'foo': '2.0.0'
      }, pubspec: {
        'environment': {'sdk': '>=2.12.0 < 3.0.0'}
      }));

    await d.dir(appPath, [
      d.pubspec({
        'name': 'app',
        'version': '1.0.0',
        'dependencies': {
          'foo': '^2.0.0',
          'bar': '^2.0.0',
        },
        'environment': {'sdk': '>=2.12.0 < 3.0.0'},
      }),
    ]).create();

    await pubGet(environment: {'_PUB_TEST_SDK_VERSION': '2.13.0'});

    await variations('null_safety_already_migrated',
        environment: {'_PUB_TEST_SDK_VERSION': '2.13.0'});
  });

But I am facing a problem in creating the golden file for it! Can you please guide me on how to create a golden file for the same?

@sigurdm
Copy link
Contributor

sigurdm commented Mar 9, 2021

Yes - you should be able to create the golden file by running the test. If the golden file doesn't exist it will be created. If it exists the actual value will be compared with the file.

@tusharojha
Copy link
Contributor Author

@sigurdm I have added the test case. Kindle review, and suggest changes if any.

Copy link
Contributor

@sigurdm sigurdm left a comment

Choose a reason for hiding this comment

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

LGTM

@sigurdm
Copy link
Contributor

sigurdm commented Mar 12, 2021

Big thanks for the contribution!

@sigurdm sigurdm merged commit 79f3a8b into dart-lang:master Mar 12, 2021
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.

The output of dart pub outdated --mode=null-safety is pretty confusing for a package that's already ...ready
2 participants