Mocha JUnit reporter UnhandledPromiseRejectionWarning - javascript

I'm trying to make this example work in my Azure Devops Pipeline.
https://mochajs.org/#getting-started
First I tried to have my own tests already but after I keep getting the following error I reverted to the basic example but still I'm getting this error:
mocha test --reporter mocha-junit-reporter
========================== Starting Command Output ===========================
"C:\windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "d:\a\_temp\3909d6a6-de56-4ad9-9fb2-b94c5529546b.cmd""
(node:2160) UnhandledPromiseRejectionWarning: TypeError: Cannot convert undefined or null to object
at Function.keys (<anonymous>)
at Object.help (C:\npm\prefix\node_modules\mocha\node_modules\yargs\lib\usage.js:240:22)
at Object.self.showHelp (C:\npm\prefix\node_modules\mocha\node_modules\yargs\lib\usage.js:432:15)
at Array.<anonymous> (C:\npm\prefix\node_modules\mocha\lib\cli\cli.js:53:13)
at Object.fail (C:\npm\prefix\node_modules\mocha\node_modules\yargs\lib\usage.js:41:17)
at C:\npm\prefix\node_modules\mocha\node_modules\yargs\lib\command.js:246:36
(node:2160) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:2160) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Finishing: Test Mocha
I've tried running it in both a windows and linux container but can't see any difference.
This is my file structure
index.html
app.js
package.json
style.css
readme.md
-test
test.js
This is the content of the package.json
{
"scripts": {
"test": "mocha"
}
}
This is the contact of the test\test.js file
var assert = require('assert');
describe('Array', function() {
describe('#indexOf()', function() {
it('should return -1 when the value is not present', function() {
assert.equal([1, 2, 3].indexOf(4), -1);
});
});
});
The html and app.js file are for now now interesting I assume because they aren't called anywhere.
Here is also the pipeline defenition:
pool:
name: Azure Pipelines
demands: npm
steps:
- task: Npm#1
displayName: 'npm install'
inputs:
verbose: false
- script: 'npm install --save-dev mocha'
displayName: 'Install Mocha'
- script: 'npm install --save-dev mocha-junit-reporter'
displayName: 'Install Reporter'
- script: |
npm i --save-dev chai
displayName: 'Install Chai'
- script: 'npm test'
displayName: 'Test Mocha'
continueOnError: true
- powershell: |
ls "$(System.DefaultWorkingDirectory)"
displayName: 'PowerShell Script'
- task: PublishTestResults#2
displayName: 'Publish Test Results **/test-results.xml'
inputs:
testResultsFiles: '**/test-results.xml'
condition: succeededOrFailed()
- task: ArchiveFiles#1
displayName: 'Archive files'
inputs:
rootFolder: '$(System.DefaultWorkingDirectory)'
includeRootFolder: false
archiveType: zip
- task: PublishBuildArtifacts#1
displayName: 'Publish Artifact: drop'
When I try to run it without the reporter then it gives an output and the tests are done, I just get this error when adding the reporter. I also tried to use the xunit reporter instead but then I get the same error.
What am I missing here? Anyone knows why I get this error and how I can prevent it?
I'm not much of a javascript code myself I'm more at home in other languages and mostly do this to setup automatic testing for other programmers.

Related

IPFSAccessController.save ERROR: Error: Deprecated, use .toString()

i'm only trying to launch the exemple of the app kit OrbitDB which is :
import OrbitDB from "orbit-db";
import IPFS from "ipfs";
async function main () {
// Create IPFS instance
const ipfsOptions = { repo : './ipfs', }
const ipfs = await IPFS.create(ipfsOptions)
// Create OrbitDB instance
const orbitdb = await OrbitDB.createInstance(ipfs)
// Create database instance
const db = await orbitdb.keyvalue('ipfs_db')
}
main()
you can find it here : https://github.com/dappkit/aviondb#using-nodejs
but the problem is when i launch it, i got these errors :
Swarm listening on /ip4/127.0.0.1/tcp/4002/p2p/12D3KooWM7D9NdMhtxyiWiKH4XVpuZW5oDu9MbWxFmEzLsG9UynM
Swarm listening on /ip4/192.168.1.53/tcp/4002/p2p/12D3KooWM7D9NdMhtxyiWiKH4XVpuZW5oDu9MbWxFmEzLsG9UynM
Swarm listening on /ip4/127.0.0.1/tcp/4003/ws/p2p/12D3KooWM7D9NdMhtxyiWiKH4XVpuZW5oDu9MbWxFmEzLsG9UynM
IPFSAccessController.save ERROR: Error: Deprecated, use .toString()
at CID.get toBaseEncodedString [as toBaseEncodedString] (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/multiformats/cjs/src/cid.js:94:11)
at Object.writeCbor [as write] (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/aviondb/node_modules/orbit-db-access-controllers/node_modules/orbit-db-io/index.js:62:14)
at async IPFSAccessController.save (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/aviondb/node_modules/orbit-db-access-controllers/src/ipfs-access-controller.js:46:13)
at async Function.create (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/aviondb/node_modules/orbit-db-access-controllers/src/access-controllers.js:68:20)
at async OrbitDB._determineAddress (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/aviondb/node_modules/orbit-db/src/OrbitDB.js:331:37)
(node:8397) UnhandledPromiseRejectionWarning: Error: `undefined` is not supported by the IPLD Data Model and cannot be encoded
at undefinedEncoder (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/#ipld/dag-cbor/cjs/index.js:47:9)
at objectToTokens (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/cborg/cjs/lib/encode.js:175:20)
at Object (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/cborg/cjs/lib/encode.js:149:9)
at objectToTokens (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/cborg/cjs/lib/encode.js:184:10)
at Object (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/cborg/cjs/lib/encode.js:149:9)
at objectToTokens (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/cborg/cjs/lib/encode.js:184:10)
at encodeCustom (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/cborg/cjs/lib/encode.js:214:18)
at Object.encode (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/cborg/cjs/lib/encode.js:236:10)
at Object.encode (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/#ipld/dag-cbor/cjs/index.js:85:41)
at put (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/ipfs-core/src/components/dag/put.js:35:25)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:8397) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:8397) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
i seriously don't know what to do, i tried to clear the cache, to delete node_modules and package-lock.json, and do a npm install, but nothing changed, i got the same error, do you have any idea to fix this ?
This error clearly points to an incompatibility between IPFS and OrbitDB.
The latest version of js-ipfs that OrbitDB v0.26.1 supports is 0.55.4.
You should change the ipfs (or ipfs-core) version in your package.json to ^0.55.4.
Note: The upcoming OrbitDB v0.27, will support the latest IPFS version.

Errors with compiling Zig to wasm32-freestanding

I am trying to compile Zig functions to a freestanding WebAssembly module using the wasm32-freestanding target. The official documentation has a section explaining how to do this, but with a recent version of Zig (0.8.0) I get errors when trying to instantiate the resulting module with JavaScript.
// file: main.zig
export fn add(a: i32, b: i32) i32 {
return a +% b;
}
// file: test.js
WebAssembly.instantiate((function() {
const source = require("fs").readFileSync("main.o");
return new Uint8Array(source);
})(), { env: {} }).then(wasm => {
const add = wasm.instance.exports.add;
console.log(add(1, 2));
});
$ zig version
0.8.0
$ node --version
14.17.3
$ zig build-obj main.zig -target wasm32-freestanding -dynamic -OReleaseFast
$ wc -c main.o # the generated code has extension `.o` instead of `.wasm`
135
$ node test.js
(node:2449) UnhandledPromiseRejectionWarning: LinkError: WebAssembly.instantiate(): Import #0 module="env" function="__linear_memory" error: memory import must be a WebAssembly.Memory object
(Use `node --trace-warnings ...` to show where the warning was created)
(node:2449) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:2449) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Inspecting the generated wasm module shows that it attempts to import a value called __linear_memory from the scope env. Naturally this fails as I am not providing such an import. However, the example project zig-wasm-test includes a WASM module (compiled with an old version of Zig) which does not include these imports.
What am I doing wrong here? Should I just be providing a __linear_memory export to the module even though it isn't used?
You should try using build-lib instead of build-obj.

UnhandledPromiseRejectionWarning: TypeError: Converting circular structure to JSON with Jest + Angular

Using the jest-preset-angular to perform the unit test, but got an warning as UnhandledPromiseRejectionWarning: TypeError: Converting circular structure to JSON not sure what causing the error, due to this the application is stuck and not running the other unit test.
PASS src/app/pages/result/result-filter/result-filter.component.spec.ts (6.251 s)
PASS src/app/pages/result/search-navigation/search-navigation.component.spec.ts
PASS src/app/pages/result/filter-modal/filter-modal.component.spec.ts (5.699 s)
PASS src/app/app.component.spec.ts
PASS src/app/pages/test-type/test-type.component.spec.ts (12.857 s)
(node:3280) UnhandledPromiseRejectionWarning: TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Object'
| property 'element' -> object with constructor 'Object'
| property 'componentProvider' -> object with constructor 'Object'
--- property 'parent' closes the circle
at stringify (<anonymous>)
at writeChannelMessage (internal/child_process/serialization.js:117:20)
at process.target._send (internal/child_process.js:808:17)
at process.target.send (internal/child_process.js:706:19)
at reportSuccess (/Users/macbook/Projects/Playtime Projects/IDP/Idp.Bx.Ui/idp/node_modules/jest-worker/build/workers/processChild.js:67:11)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:3280) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:3280) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:3281) UnhandledPromiseRejectionWarning: TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Object'
| property 'element' -> object with constructor 'Object'
| property 'componentProvider' -> object with constructor 'Object'
--- property 'parent' closes the circle
at stringify (<anonymous>)
at writeChannelMessage (internal/child_process/serialization.js:117:20)
at process.target._send (internal/child_process.js:808:17)
at process.target.send (internal/child_process.js:706:19)
at reportSuccess (/Users/macbook/Projects/Playtime Projects/IDP/Idp.Bx.Ui/idp/node_modules/jest-worker/build/workers/processChild.js:67:11)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:3281) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:3281) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:3279) UnhandledPromiseRejectionWarning: TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Object'
| property 'element' -> object with constructor 'Object'
| property 'componentProvider' -> object with constructor 'Object'
--- property 'parent' closes the circle
at stringify (<anonymous>)
at writeChannelMessage (internal/child_process/serialization.js:117:20)
at process.target._send (internal/child_process.js:808:17)
at process.target.send (internal/child_process.js:706:19)
at reportSuccess (/Users/macbook/Projects/Playtime Projects/IDP/Idp.Bx.Ui/idp/node_modules/jest-worker/build/workers/processChild.js:67:11)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:3279) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:3279) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
RUNS src/app/pages/location/location.component.spec.ts
RUNS src/app/pages/signup/signup.component.spec.ts
RUNS src/app/pages/login/login.component.spec.ts
Test Suites: 10 passed, 10 of 20 total
Tests: 16 passed, 16 total
Snapshots: 1 obsolete, 5 passed, 5 total
Time: 2180 s
I am not sure how to run the node --trace-warnings. Looks like it a serialization issue, even it is just a warning but not sure where is the issue. Is there any better way to find the exception
Run jest with --detectOpenHandles. This will show you what is actually wrong with your test spec. For me, there were missing Angular Material imports and service mocks. You may be prompted to add the BrowserAnimationsModule, as Nambi alluded to in his answer
package.json:
"test": "jest --detectOpenHandles"
This message usually appears, if there is an error, that does not resolve into a standard exception.
As mentioned by #JamesBarret using jests detect open handle feature will provide you with a nice error message, telling you what the real problem behind this message is.
The handle --detectOpenHandles mentioned in the other message is deprecated though and was replaced with --detect-open-handles.
You can just use: (on your cli)
jest --detect-open-handles
Or in a package.json file:
"test": "jest --detect-open-handles"
Or as it was in my case an angular test:
ng test --detect-open-handles
Adding my answer to help someone if missed.
In my case i have missed to import
import { BrowserAnimationsModule } from '#angular/platform-browser/animations';
Able to find the issue only when running one of the test case in isolation.
The issue was with the async operation, so writing the test case with below, solve the issue for me
describe('DateSelectionComponent', () => {
let component: DateSelectionComponent;
let fixture: ComponentFixture<DateSelectionComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [DateSelectionComponent, SafePipe],
imports: [
SharedModule,
NgReduxTestingModule,
RouterTestingModule.withRoutes([])
],
providers: [
{
provide: PageAPIActions, useValue: { setPageState() { } }
}
]
}).compileComponents();
fixture = TestBed.createComponent(DateSelectionComponent);
component = fixture.componentInstance;
// Don't use Object.defineProperty when assigning value to class properties
component.page$ = of('value');
component.page = { destination: 'value' };
component.startDate = new NgbDate(2019, 2, 27);
component.minDate = new NgbDate(2019, 2, 27);
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
it('Should Match Snapshot', () => {
expect(fixture.debugElement.nativeElement).toMatchSnapshot()
});
});
In my situation, the cryptic error was triggered by not importing HttpClientModule into the test file. More details here.
I had this same issue when running jest with --watch. Removing --watch stopped the error.
Looks like the error is due to some async operation being done. Try wrapping your unit test inside a waitForAsync function.

Invalid locator using Protractor and Cucumber

I'm trying to execude a code using protractor but i am obtaining this issue :
[12:48:45] I/direct - Using ChromeDriver directly...
..
(node:34588) UnhandledPromiseRejectionWarning: TypeError: Invalid locator
at Object.check [as checkedLocator] (C:\Users\karro\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\by.js:275:9)
at Driver.findElements (C:\Users\karro\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver.js:1041:18)
at C:\Users\karro\AppData\Roaming\npm\node_modules\protractor\built\element.js:159:44Error
at ElementArrayFinder.applyAction_ (C:\Users\karro\AppData\Roaming\npm\node_modules\protractor\built\element.js:459:27)
at ElementArrayFinder. [as sendKeys] (C:\Users\karro\AppData\Roaming\npm\node_modules\protractor\built\element.js:91:29)
at ElementFinder. [as sendKeys] (C:\Users\karro\AppData\Roaming\npm\node_modules\protractor\built\element.js:831:22)
at World. (C:\Users\karro\WebstormProjects\ProtractorTest\test\banking.ts:17:36)
(node:34588) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:34588) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:34588) UnhandledPromiseRejectionWarning: TypeError: Invalid locator
at Object.check [as checkedLocator] (C:\Users\karro\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\by.js:275:9)
at Driver.findElements (C:\Users\karro\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver.js:1041:18)
at C:\Users\karro\AppData\Roaming\npm\node_modules\protractor\built\element.js:159:44Error
at ElementArrayFinder.applyAction_ (C:\Users\karro\AppData\Roaming\npm\node_modules\protractor\built\element.js:459:27)
at ElementArrayFinder. [as sendKeys] (C:\Users\karro\AppData\Roaming\npm\node_modules\protractor\built\element.js:91:29)
at ElementFinder. [as sendKeys] (C:\Users\karro\AppData\Roaming\npm\node_modules\protractor\built\element.js:831:22)
at World. (C:\Users\karro\WebstormProjects\ProtractorTest\test\banking.ts:18:37)
(node:34588) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
1 scenario (1 passed)
I have installed the next :
npm install -g protractor
npm install --save-dev protractor cucumber protractor-cucumber-framework chai chai-as-promised
npm install cucumber-html-reporter --save-dev
npm install mocha -g
npm install mocha --save-dev
And this is my code :
Login.feature:
Feature: Example
Scenario: Login Success
When I try to login with valid credentials
banking.ts:
let {defineSupportCode} = require('cucumber');
let chai = require('chai').use(require('chai-as-promised'));
let expect = chai.expect;
var { browser, by, element }= require ('protractor');
var {Given} = require('cucumber');
var {When} = require('cucumber');
var {Then} = require('cucumber');
var {setDefaultTimeout} = require('cucumber');
setDefaultTimeout(60 * 1000);
When('I try to login with valid credentials', function() {
browser.get('http://juliemr.github.io/protractor-demo/');
element(by.name=('first')).sendKeys('1234');
element(by.name=('second')).sendKeys('2356');
});
conf.js:
'use strict';exports.config = {directConnect: true,//Running chrome
Capabilities: { browserName: 'chrome'
},
specs: ['../features/*.feature'],//set framework options
framework: 'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'), //just maximizing window before testing
onPrepare: function(){
browser.waitForAngularEnabled(false);
browser.driver.manage().window().maximize();
} ,//Create html report
"types": ["chai", "cucumber", "node"],
"typeRoots": [ "../node_modules/#types"],
onComplete: () => {
var reporter = require('cucumber-html-reporter');
var options = {
theme: 'bootstrap',
jsonFile: './results.json',
//output: './results.html',
reportSuiteAsScenarios: true,
launchReport: true,
metadata: {
"App Version":"0.3.2",
"Test Environment": "STAGING",
"Browser": "Chrome 54.0.2840.98",
"Platform": "Windows 10",
"Parallel": "Scenarios",
"Executed": "Remote"
},
output: './report/cucumber_report.html',
};
reporter.generate(options);
},//set cucumber options
cucumberOpts: {
require: ['../test/banking.ts'],
strict: true,
// format: [], //don't put 'Pretty' as it is depreciated
'dry-run': false,
compiler: [],
format: 'json:results.json', //make sure you are not using multi-capabilities
},
SELENIUM_PROMISE_MANAGER: false,
};
I have added also a screenshot about my project is done.
Could anyone help me? thank you in advance.

Naming collision in react native app start

I'm using the out-of-the box react native framework to try to build a new app.
i used the following commands ind CMD (Windows 10).
node -v:
v8.12.0
npm -v:
6.4.1
mkdir react-native-workspace
cd react-native-workspace
npm install -g create-react-native-app
create-react-native-app Exercise2
cd Exercise2
npm start
ERROR 12:42 (node:15564) UnhandledPromiseRejectionWarning: Error: jest-haste-map: #providesModule naming collision: Duplicate module
name: my-new-project Paths:
C:\Users\wp_99\Dokumenter\react-native-workspace\Exercise2\package.json
collides with
C:\Users\wp_99\Documents\react-native-workspace\Exercise2\package.json
This error is caused by a #providesModule declaration with the same
name across two different files.
at setModule (C:\Users\wp_99\Documents\react-native-workspace\Exercise2\node_modules\metro\node_modules\jest-haste-map\build\index.js:462:17)
at workerReply (C:\Users\wp_99\Documents\react-native-workspace\Exercise2\node_modules\metro\node_modules\jest-haste-map\build\index.js:512:9)
at
at process._tickCallback (internal/process/next_tick.js:189:7) ERROR 12:42 (node:15564) UnhandledPromiseRejectionWarning: Unhandled
promise rejection. This error originated either by throwing inside of
an async function without a catch block, or by rejecting a promise
which was not handled with .catch(). (rejection id: 2) (node:15564)
[DEP0018] DeprecationWarning: Unhandled promise rejections are
deprecated. In the future, promise rejections that are not handled
will terminate the Node.js process with a non-zero exit code.
It's a bug in the metro-bundler. You should create rn-cli.config.js and add this configuration to it:
For react-native>=0.57
const blacklist = require('metro-config/src/defaults/blacklist');
module.exports = {
resolver:{
blacklistRE: blacklist([
/nodejs-assets\/.*/,
/android\/.*/,
/ios\/.*/
])
},
};
react-native < 0.57
const blacklist = require('metro/src/blacklist');
module.exports = {
getBlacklistRE: function() {
return blacklist([
/nodejs-assets\/.*/,
/android\/.*/,
/ios\/.*/
]);
},
};
You can read more here.
I've added the following to rn-cli.config.js
const blacklist = require('metro-config/src/defaults/blacklist');
module.exports = {
resolver: {
blacklistRE: blacklist([
/node_modules\/.*\/node_modules\/react-native\/.*/,
])
},
};

Categories