build_test 0.8.0  build_test: ^0.8.0 copied to clipboard
build_test: ^0.8.0 copied to clipboard
Utilities for writing unit tests of Builders.
build_test #
  Testing utilities for users of package:build.
  
  
    
  
  
    
  
  
    
  
  
    
  
  
    
  
Installation #
This package is intended to only be as a development dependency for users
of package:build, and should not be used in any production code. Simply
add to your pubspec.yaml:
dev_dependencies:
  build_test:
Usage #
See the test folder in the build package for more examples.
Resolve source code for testing #
Using resolveAsset and
resolveSource, you can resolve Dart source code into a
static element model, suitable for probing and using within tests of code you
might have written for a Builder:
test('should resolve a simple dart file', () async {
  var resolver = await resolveSource(r'''
    library example;
    class Foo {}
  ''');
  var libExample = resolver.getLibraryByName('example');
  expect(libExample.getType('Foo'), isNotNull);
});
Run a Builder within a test environment #
Using testBuilder, you can run a functional test of a
Builder, including feeding specific assets, and more. It automatically
creates an in-memory representation of various utility classes.