Code Monkey home page Code Monkey logo

Comments (8)

LinusU avatar LinusU commented on May 17, 2024

You are actually already using this, which funnily enough breaks the tests that I'm trying to write for loud-rejection 😆

Ava is built with meow which includes loud-rejection.

Man was it annoying to track down as well,

const org = process.on;
process.on = function () {
    console.trace(arguments);
    org.apply(this, arguments);
}

const fn = require('./');
const test = require('ava');
fn();

function fire() {
    return new Promise(function (resolve, reject) {
        setImmediate(function () {
            const org = console.error
            console.error = function () {
                console.error = org
                console.trace(arguments) // <------ Finally manage to find it with this
            }
            reject(new Error('unicorn'));
        });
    });
}

from ava.

LinusU avatar LinusU commented on May 17, 2024

Another fun fact, calling console.trace recursively will run out of memory before hitting max recursion. Found this out the hard way...

<--- Last few GCs --->

    5200 ms: Mark-sweep 1391.4 (1505.2) -> 1172.0 (1220.2) MB, 35.6 / 0 ms [allocation failure] [GC in old space requested].
    5218 ms: Mark-sweep 1172.0 (1220.2) -> 1172.0 (1212.2) MB, 18.1 / 0 ms [allocation failure] [GC in old space requested].
    5238 ms: Mark-sweep 1172.0 (1212.2) -> 1171.7 (1211.2) MB, 19.8 / 0 ms [last resort gc].
    5252 ms: Mark-sweep 1171.7 (1211.2) -> 1171.7 (1211.2) MB, 13.7 / 0 ms [last resort gc].


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x3ec84df37399 <JS Object>
    1: replace(aka replace) [native string.js:~146] [pc=0x230e9b6af485] (this=0x23a9be604101 <Very long string[151036881]>,N=0x3ec84dfb84b1 <JS RegExp>,O=0x3b956bc4e539 <String[2]: \'>)
    2: 0x53c78d8eaf9 <Symbol: 224142380 <String[14]: Symbol.replace>> [/Users/linus/coding/loud-rejection/node_modules/ava/node_modules/babel-core/node_modules/core-js/modules/$.fix-re-wks.js:~15] [pc=0x230e9ae9...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
[1]    6026 abort      node_modules/.bin/ava

from ava.

sindresorhus avatar sindresorhus commented on May 17, 2024

Oh, damn... Although, in the next version of AVA we're spawing each test file in it's own process, so we'll have to explicitly include it then. Try using AVA master as dependency for now. Example: https://github.com/sindresorhus/got/blob/f4cf6c7b44d047d505ed1fdf3a4e361b743bdfc2/package.json#L64

from ava.

LinusU avatar LinusU commented on May 17, 2024

Hmm, for some reason using master stopped my process.on('exit', ...) handler from ever firing... Any idea why?

from ava.

LinusU avatar LinusU commented on May 17, 2024

Also, I can't get rejectionHandled to fire :( tearing my hair out...

from ava.

sindresorhus avatar sindresorhus commented on May 17, 2024

@LinusU Maybe just use tape for testing that module then.

from ava.

LinusU avatar LinusU commented on May 17, 2024

I think I got everything working, except for the rejectionHandled... Let's continue the discussion in that repo

from ava.

jamestalmage avatar jamestalmage commented on May 17, 2024

Closed via: c5d02f1

from ava.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.