question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tests are failing with SDK 27

See original GitHub issue

Tests are failing with sdk 27 even in the example project.

Environment

Packages: (wanted => installed)
  expo: ^27.0.1 => 27.0.1
  react: 16.3.1 => 16.3.1
  react-native: https://github.com/expo/react-native/archive/sdk-27.0.0.tar.gz => 0.55.2

Steps to Reproduce

(Write your steps here:)

  1. exp init test
  2. Chose tab layout
  3. cd test
  4. npm install
  5. npm test

Expected Behavior

Test should run fine.

Actual Behavior

Actual test output:

PASS  components/__tests__/StyledText-test.js

RUNS  __tests__/App-test.js

Test Suites: 1 passed, 1 of 2 total
Tests:       1 passed, 1 total
Snapshots:   1 passed, 1 total
Time:        3s/app/test/node_modules/react-native/Libraries/Interaction/TaskQueue.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){'use strict';var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();function _classCallCheck(instance,Constructor){if(!(instance instanceof Construc

TypeError: TaskQueue: Error with task : Cannot read property 'Object.<anonymous>' of null
   at Runtime._execModule (/app/test/node_modules/jest-runtime/build/index.js:447:72)
   at Runtime.requireModule (/app/test/node_modules/jest-runtime/build/index.js:265:14)
   at Runtime.requireModuleOrMock (/app/test/node_modules/jest-runtime/build/index.js:337:19)
   at parseErrorStack (/app/test/node_modules/react-native/Libraries/Core/Devtools/parseErrorStack.js:1:179)
   at updateWarningMap (/app/test/node_modules/react-native/Libraries/ReactNative/YellowBox.js:1:3858)
   at BufferedConsole.Object.<anonymous>.console.warn (/app/test/node_modules/react-native/Libraries/ReactNative/YellowBox.js:1:2598)
   at Component.measureInWindow (/app/test/node_modules/react-native/jest/setup.js:1:2534)
   at SafeView._this._onLayout (/app/test/node_modules/react-native
RUNS  __tests__/App-test.js

Test Suites: 1 passed, 1 of 2 total
Tests:       1 passed, 1 total
Snapshots:   1 passed, 1 total
Time:        5s

Not sure if it’s a expo related bug. After upgrading my project from sdk 26 to 27 it appears.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

6reactions
MainAerocommented, Apr 30, 2018

The tests are failing (or running forever) when a console warn message occurs. Which is the case in the example project:

console.warn node_modules/react-native/Libraries/ReactNative/YellowBox.js:85
      Calling .measureInWindow() in the test renderer environment is not supported. Instead, mock out your components that use findNodeHandle with replacements that don't rely on the native environment.

This will trigger a call to parseErrorStack() a react-native devtools library method. Inside this method a other module is required. The require call is done after torn down of jest which will lead to the unexpected behavior of jest.

My workaround for now is to add require('stacktrace-parser'); to my own setupJest.js file:

package.json:

...
"jest": {
    "preset": "jest-expo",
    "setupTestFrameworkScriptFile": "./setupJest"
},
...

setupJest.js:

require('stacktrace-parser');
...

I will investigate further how to get a serious fix for that.

0reactions
idecommented, Nov 12, 2019

The original repro commands with the current version of Expo (SDK 35) work now:

expo init test
# follow setup instructions. i used yarn instead of npm.
cd test
yarn test
# tests pass

tests

Read more comments on GitHub >

github_iconTop Results From Across the Web

Robolectric does not support API level 27 - Stack Overflow
I am using 3.3.2 Version of Roboelectric for Testing in my Android application. ... Is roboelectirc is not supported with SDK version 27...
Read more >
How to Fix “Failed to install the following Android SDK ...
Step 1: In Android Studio go to Tools > SDK Manager. Step 2: Go to the SDK Tools tab as shown in the...
Read more >
SDK Build Tools release notes - Android Developers
Android SDK Build-Tools is a component of the Android SDK required for building Android apps. It's installed in the <sdk>/build-tools/ directory.
Read more >
Setting Up Android SDK and NDK for Unreal
If you do not use the default SDK path, it is possible for SetupAndroid.bat to fail during a later step, as it will...
Read more >
Get started testing for Android with Firebase Test Lab - Google
Any uncaught exception will cause a test failure. ... Test Lab devices usually run on the latest version of the Google Play services...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found