Skip to content

Assigning t.context a value in beforeEach results in a Flow error #1340

@gajus

Description

@gajus

Description

Assigning t.context a value in beforeEach results in a Flow error.

Test Source

// @flow

test.beforeEach(async (t) => {
  t.context = {};
});

Error Message & Stack Trace

test/interceptors/cache/index.js:19
 19:   t.context = {};
       ^^^^^^^^^ assignment of property `context`. Property cannot be assigned on any member of intersection type
 19:   t.context = {};
       ^ intersection
  Member 1:
   83: type TestContext = AssertContext & {
                          ^^^^^^^^^^^^^ AssertContext. See: node_modules/ava/index.js.flow:83
  Error:
   19:   t.context = {};
           ^^^^^^^ property `context`. Property not found in
   83: type TestContext = AssertContext & {
                          ^^^^^^^^^^^^^ object type. See: node_modules/ava/index.js.flow:83
  Member 2:
   83: type TestContext = AssertContext & {
                                          ^ object type. See: node_modules/ava/index.js.flow:83
  Error:
   19:   t.context = {};
           ^^^^^^^ property `context`. Property not found in
   83: type TestContext = AssertContext & {
                                          ^ object type. See: node_modules/ava/index.js.flow:83

Config

N/A

Command-Line Arguments

N/A

Environment

Node.js v7.7.1
darwin 16.5.0
0.18.2
4.1.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions