Comments (8)
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.
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.
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.
Hmm, for some reason using master stopped my process.on('exit', ...)
handler from ever firing... Any idea why?
from ava.
Also, I can't get rejectionHandled
to fire :( tearing my hair out...
from ava.
@LinusU Maybe just use tape
for testing that module then.
from ava.
I think I got everything working, except for the rejectionHandled
... Let's continue the discussion in that repo
from ava.
Closed via: c5d02f1
from ava.
Related Issues (20)
- ava + dynamic tests + sinon.useFakeTimers have weird behaviour - tests fail with no clear error HOT 1
- npx ava -r dotenv-flow/config not working
- AVA hangs after all tests pass HOT 2
- Support a proper junit reporter
- Monorepo with babel aliases support HOT 1
- The watch mode does not work in v6 HOT 4
- Ability to run a mixed test code base using node:test HOT 2
- Azure DevOps output handler
- Typescript with VS Code debug issue
- config to control handling for tests that 'Failed to exit' - v6+ issue HOT 3
- Ava fails to run in watch mode via CLI HOT 2
- Documentation Request: Using a Node Custom Loader
- Add support for `--env-file=` flag for node 20 in `nodeArguments`
- Spurious "previous failures in test files that were not rerun" in watch mode HOT 2
- registerCompletionHandler can't be used in CommonJS project HOT 1
- Allow regexes in `t.like` HOT 2
- failing async test ends in timeout instead of go to catch clause
- `t.throws` doesn't recognize falsy thrown values
- `t.inRange`
- Ava won't work with yarn workspaces package named `business-logic` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ava.