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

scoped_providers_should_specify_dependencies lint gets triggered in tests #3047

Closed
lockieRichter opened this issue Oct 28, 2023 · 3 comments
Closed
Assignees
Labels
bug Something isn't working needs triage

Comments

@lockieRichter
Copy link
Contributor

Describe the bug
The scoped_providers_should_specify_dependencies lint from the riverpod_lint warning gets triggered when running unit tests with ProviderScope.

To Reproduce
This happens for the example test from the docs.

testWidgets('override repositoryProvider', (tester) async {
  await tester.pumpWidget(
    ProviderScope(
      overrides: [
        // Override the behavior of repositoryProvider to return
        // FakeRepository instead of Repository.
        repositoryProvider.overrideWithValue(FakeRepository())
        // We do not have to override `todoListProvider`, it will automatically
        // use the overridden repositoryProvider
      ],
      child: MyApp(),
    ),
  );
});

Expected behavior
No warning should be generated as this is the reccomended way to override behaviour during a test.

@lockieRichter
Copy link
Contributor Author

lockieRichter commented Oct 28, 2023

Closing as this is not a bug now that I look a little closer, this is more of an issue that I need to specify the dependencies in the test file. Will read #2913 and see if that helps.

@lockieRichter
Copy link
Contributor Author

Have raised #3048, as I couldn't find the answers I was looking for

@rrousselGit
Copy link
Owner

This is a bug
The issue is #2355

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

2 participants