How to use the stack-utils.prototype function in stack-utils

To help you get started, we’ve selected a few stack-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github avajs / ava / test / fixture / trigger-worker-exception / hack.js View on Github external
'use strict';

const StackUtils = require('stack-utils');

const original = StackUtils.prototype.parseLine;
let restored = false;
let restoreAfterFirstCall = false;
StackUtils.prototype.parseLine = function (line) {
	if (restored) {
		return original.call(this, line);
	}

	if (restoreAfterFirstCall) {
		restored = true;
	}

	throw new Error('Forced error');
};

exports.restoreAfterFirstCall = () => {
	restoreAfterFirstCall = true;
github avajs / ava / test / fixture / trigger-worker-exception / hack.js View on Github external
'use strict';

const StackUtils = require('stack-utils');

const original = StackUtils.prototype.parseLine;
let restored = false;
let restoreAfterFirstCall = false;
StackUtils.prototype.parseLine = function (line) {
	if (restored) {
		return original.call(this, line);
	}

	if (restoreAfterFirstCall) {
		restored = true;
	}

	throw new Error('Forced error');
};

exports.restoreAfterFirstCall = () => {
	restoreAfterFirstCall = true;
};

stack-utils

Captures and cleans stack traces

MIT
Latest version published 2 years ago

Package Health Score

77 / 100
Full package analysis