-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix crash when Promise rejects with null #6897
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6897 +/- ##
=======================================
Coverage 66.98% 66.98%
=======================================
Files 250 250
Lines 10358 10358
Branches 3 3
=======================================
Hits 6938 6938
Misses 3419 3419
Partials 1 1
Continue to review full report at Codecov.
|
Hey @Pajn, I'm not a core contributor on this project so take my advice with a grain of salt, but here's my 2 cents. I suggest you go down the path of writing an end to end test for this. I've tried this locally with your changes and this test works. This file is located /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
'use strict';
import runJest from '../runJest';
import path from 'path';
const {cleanup, writeFiles} = require('../Utils');
const DIR = path.resolve('../promise-reject');
beforeEach(() => cleanup(DIR));
afterEach(() => cleanup(DIR));
test('', () => {
writeFiles(DIR, {
'package.json': '{}',
'promise_reject.test.js': `
test('test', () => {
return Promise.reject(null)
});
`,
});
const {stdout, stderr, status} = runJest(DIR);
expect(stdout).toBe('');
expect(stderr).toMatch(/Failed: null/);
expect(status).toBe(1);
}); Perhaps one of the senior contributors can weigh in on this? |
You can do Thanks for weighing in @natealcedo! |
Hey @Pajn, do you still wanna work on this? I don't mind carrying on from here :) |
Sorry, I forgot to update here and then forgot the whole issue. I had trouble finding where to make the change. Please take over if you want as you probably can navigate the code much better than I. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Fixes #6896
Jest crashed / Shows test failure from exception inside Kest
Test story:
Help wanted!
How do I test this? Adding a simple unittest to is_error does not really show how it fixes the actual problem.