over_react_test 2.5.2

  • Readme
  • Changelog
  • Installing
  • 71

OverReact Test #

Pub Build Status Test Coverage Documentation

A library for testing OverReact components.

Using it in your project #

  1. Import it into your test files:

     import 'package:over_react_test/over_react_test.dart';
  2. Add the test/pub_serve transformer to your pubspec.yaml after the over_react transformer.

     - over_react
     - test/pub_serve:
         $include: test/**_test{.*,}.dart
     - $dart2js
  3. Use the --pub-serve option when running your tests:

     $ pub run test --pub-serve=8081 test/your_test_file.dart

    Note: 8081 is the default port used, but your project may use something different. Be sure to take note of the output when running pub serve to ensure you are using the correct port.

Naming Conventions #

Variables and Types #

UsageActual TypeSuggested Referencing
render and render helper functionsReactComponent |Elementinstance
Component classReactClasstype
VDOM Instance (invoked UiProps)ReactElement-ReactElement or not suffixed
findDomNode, queryByTestId, etc.Elementnode
The Dart componentreact.Component (backed by ReactComponent)dartInstance
Invoked UiFactoryUiPropsbuilder


test('my test' () {
  var sampleBuilder = Sample();
  var sampleReactElement = sampleBuilder(); // Or var sample = sampleBuilder();
  var instance = render(sampleInstance);
  SampleComponent sampleDartInstance = getDartComponent(instance);
  var sampleNode = findDomNode(instance);

Test IDs #

When coming up with test ID strings:

  • DO NOT use spaces; space-delimited strings will be treated as separate test IDs

    Just like CSS class names, you can use multiple test IDs together, and use any one of them to target a given component/node.

  • PREFER following our naming scheme for consistency across projects:


    We recommend including a library abbreviation and component name within a test ID so that it's easy to track down where that ID came from.

    Namespacing (.<subpart>) can be added however it makes sense.

    Finally, test IDs should be descriptive and useful in the context of tests.


    • wsd.DatepickerPrimitive.goToSelectedButton
    • sox.AbstractDataLayoutGroup.headerBlock.title
  • CONSIDER adding multiple IDs to serve different purposes

    for (var i = 0; i < items.length; i++) {
      // ...
      // ...

    With the output of above code, you can:

    • target all of the Bar component's menu items using foo.Bar.menuItem
    • target the 4th item using foo.Bar.menuItem.3
    • target the item corresponding to an item with id baz123 using foo.Bar.menuItem.baz123

    This won't always be needed, but it comes in handy in certain cases.

Documentation #

You would never skip reading the docs for a new language you are asked to learn, so please don't skip over reading our API documentation either.

Contributing #

Yes please! (Please read our contributor guidelines first)

Versioning #

The over_react_test library adheres to Semantic Versioning:

  • Any API changes that are not backwards compatible will bump the major version (and reset the minor / patch).
  • Any new functionality that is added in a backwards-compatible manner will bump the minor version (and reset the patch).
  • Any backwards-compatible bug fixes that are added will bump the patch version.

OverReact Test Changelog #

2.0.0 #

New Features

  • Dart 2 compatible!

Breaking Changes

  • The getComponentPropKeys() and testPropForwarding() functions have been removed, as they depended on dart:mirrors. Once there is a Dart-2-only release of over_react, this function will be re-added and will rely on information generated by the builder rather than using mirrors.

  • The commonComponentTests() function no longer calls testPropForwarding() since it has been removed. In other words, the shouldTestPropForwarding parameter is effectively a no-op until testPropForwarding() can be re-added.

1.1.1 #

Bugs Fixed

  • Sync common component test src with the lib it originated from.

1.1.0 #

New Features

  • #11: Add some test utilities that were left in over_react when the library was first created.

1.0.1 #


  • #8: Update prop error message to make it more DDC friendly

1.0.0 #

Initial public release of library.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  over_react_test: ^2.5.2

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:over_react_test/over_react_test.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Oct 15, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21


Detected platforms: web

Primary library: package:over_react_test/over_react_test.dart with components: html, js.

Health suggestions

Fix lib/src/over_react_test/common_component_util.dart. (-8.63 points)

Analysis of lib/src/over_react_test/common_component_util.dart reported 18 hints, including:

line 15 col 8: Unused import: 'dart:collection'.

line 19 col 47: The name CssClassPropsMixin is shown, but not used.

line 19 col 67: The name DomPropsMixin is shown, but not used.

line 20 col 26: The name ReactPropsMixin is shown, but not used.

line 20 col 43: The name UbiquitousDomPropsMixin is shown, but not used.

Fix lib/src/over_react_test/react_util.dart. (-6.31 points)

Analysis of lib/src/over_react_test/react_util.dart reported 13 hints, including:

line 69 col 5: DO use curly braces for all flow control structures.

line 85 col 21: DO use curly braces for all flow control structures.

line 129 col 62: Use = to separate a named parameter from its default value.

line 135 col 27: Use = to separate a named parameter from its default value.

line 263 col 62: Use = to separate a named parameter from its default value.

Fix lib/src/over_react_test/jacket.dart. (-1.99 points)

Analysis of lib/src/over_react_test/jacket.dart reported 4 hints:

line 48 col 28: Use = to separate a named parameter from its default value.

line 49 col 22: Use = to separate a named parameter from its default value.

line 66 col 97: Use = to separate a named parameter from its default value.

line 66 col 123: Use = to separate a named parameter from its default value.

Fix additional 4 files with analysis or formatting issues. (-2.99 points)

Additional issues in the following files:

  • lib/src/over_react_test/js_component.dart (3 hints)
  • lib/src/over_react_test/dom_util.dart (2 hints)
  • lib/src/over_react_test/custom_matchers.dart (1 hint)
  • lib/src/over_react_test/validation_util.dart (Run dartfmt to format lib/src/over_react_test/validation_util.dart.)

Maintenance suggestions

The package description is too short. (-18 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and over_react_test.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.24.3 <3.0.0
js ^0.6.1+1 0.6.1+1
matcher ^0.12.1+4 0.12.5
over_react >=2.4.0 <4.0.0 2.5.3+dart2 3.0.0-alpha.2+dart2
react >=4.7.0 <6.0.0 4.9.2 5.0.0-alpha.1
test >=0.12.34 <2.0.0 1.9.1
Transitive dependencies
analyzer 0.38.5
args 1.5.2
async 2.4.0
boolean_selector 1.0.5
build 1.2.0
built_collection 4.2.2
built_redux 7.5.5
built_value 6.7.1
charcode 1.1.2
cli_repl 0.2.0+1
collection 1.14.12
colorize 2.0.0
convert 2.1.1
crypto 2.1.3
csslib 0.16.1
dart2_constant 1.0.2+dart2
dart_style 1.3.1
fixnum 0.10.9
front_end 0.1.27
glob 1.1.7
html 0.14.0+3
http 0.12.0+2
http_multi_server 2.1.0
http_parser 3.1.3
intl 0.15.8 0.16.0
io 0.3.3
kernel 0.3.27
logging 0.11.3+2
meta 1.1.7
mime 0.9.6+3
multi_server_socket 1.0.2
node_preamble 1.4.8
package_config 1.1.0
package_resolver 1.0.10
path 1.6.4
pedantic 1.8.0+1
platform_detect 1.3.5
pool 1.4.0
pub_semver 1.4.2
quiver 2.0.5
sass 1.23.0
shelf 0.7.5
shelf_packages_handler 1.0.4
shelf_static 0.2.8
shelf_web_socket 0.2.3
source_gen 0.9.4+5
source_map_stack_trace 1.1.5
source_maps 0.10.8
source_span 1.5.5
stack_trace 1.9.3
stream_channel 2.0.0
stream_transform 0.0.19
string_scanner 1.0.5
term_glyph 1.1.0
test_api 0.2.8
test_core 0.2.12
transformer_utils 0.2.3
tuple 1.0.3
typed_data 1.1.6
vm_service 1.2.0 2.1.1
w_common 1.20.1
w_flux 2.10.4
watcher 0.9.7+12
web_socket_channel 1.1.0
yaml 2.2.0
Dev dependencies
build_runner >=0.6.0+1 <2.0.0
build_test >=0.9.4 <=0.11.0
build_web_compilers >=0.2.0 <2.0.0
coverage >=0.10.0 <0.12.4 0.13.3
dart_dev ^2.0.4
dependency_validator ^1.2.4