File size: 1,165 Bytes
866079c
 
 
 
 
 
b0336a8
 
866079c
 
b0336a8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
866079c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:flutter_tools/src/dart/pub.dart';

final class ThrowingPub implements Pub {
  const ThrowingPub();

  @override
  Never noSuchMethod(Invocation invocation) {
    throw UnsupportedError(
      'Attempted to invoke pub during test, which otherwise was unexpected. '
      'This error may be caused by either changing the implementation details '
      'of the Flutter CLI in where the "Pub" class is now being used, or '
      'adding a unit test that transitively depends on "Pub".\n'
      '\n'
      'Possible options for resolution:\n'
      ' 1. Refactor the code or test to not rely on "Pub".\n'
      ' 2. Create and use a test-appropriate Fake (grep for "implements Pub") '
      '    for example code across the test/ repo. It is possible that the '
      '    file you are editing already has an appropriate Fake.\n'
      ' 3. Use "FakePubWithPrimedDeps" if your code will transitively call '
      '    "dart pub deps --json" and you need a realistic output.',
    );
  }
}