Skip to content

'document' is become null randomly in amplify. #9056

Closed
@nickoan

Description

@nickoan

🐛 Bug Report

error message:

TypeError: Cannot read property 'body' of null at getActiveElement

the unit test will randomly fail because of top exception.
and it not just occurring in a specific unit test. it can be anywhere a cross of different test case.

some of test even not using DOM object.

example:

test('example' , async () => {
    expect(
      // doing some validate checking using aws sdk.
      await validateAwsTokenMethod(token, validUserInfo)
    ).toEqual(invalidCognitoExpectedResult);
  });

and I'm using:
jest: 24.9.0
also was tried change to jest-environment-jsdom-thirteen.
same happens.

any idea about this case?
Thanks.

To Reproduce

it is working fine in my mac and the docker containers (eg. awslinux2, ubuntu) in my mac.
but in AWS amplify, it's occurring sometimes, maybe (30% probability);

Expected behavior

the document should not be null.

Link to repl or repo (highly encouraged)

envinfo

Linux 4.14.143-91.122.amzn1.x86_64
"/root/.nvm/versions/node/v10.16.0/bin/node" "/root/.nvm/versions/node/v10.16.0/bin/npm" "run" "test-coverage"
node v10.16.0
npm  v6.9.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions