mirror of
https://github.com/denoland/deno.git
synced 2024-12-20 22:34:46 -05:00
fb24fd37c9
This PR enables node compat test cases found passing by using the tool added in #27122 The percentage of passing test case increases from 16.16% to 30.43% by this change.
66 lines
1.8 KiB
JavaScript
66 lines
1.8 KiB
JavaScript
// deno-fmt-ignore-file
|
|
// deno-lint-ignore-file
|
|
|
|
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
|
// Taken from Node 20.11.1
|
|
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
|
|
|
// Flags: --expose-internals
|
|
'use strict';
|
|
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const { aggregateTwoErrors } = require('internal/errors');
|
|
|
|
assert.strictEqual(aggregateTwoErrors(null, null), null);
|
|
|
|
{
|
|
const err = new Error();
|
|
assert.strictEqual(aggregateTwoErrors(null, err), err);
|
|
}
|
|
|
|
{
|
|
const err = new Error();
|
|
assert.strictEqual(aggregateTwoErrors(err, null), err);
|
|
}
|
|
|
|
{
|
|
const err0 = new Error('original');
|
|
const err1 = new Error('second error');
|
|
|
|
err0.code = 'ERR0';
|
|
err1.code = 'ERR1';
|
|
|
|
const chainedError = aggregateTwoErrors(err1, err0);
|
|
assert.strictEqual(chainedError.message, err0.message);
|
|
assert.strictEqual(chainedError.code, err0.code);
|
|
assert.deepStrictEqual(chainedError.errors, [err0, err1]);
|
|
}
|
|
|
|
{
|
|
const err0 = new Error('original');
|
|
const err1 = new Error('second error');
|
|
const err2 = new Error('third error');
|
|
|
|
err0.code = 'ERR0';
|
|
err1.code = 'ERR1';
|
|
err2.code = 'ERR2';
|
|
|
|
const chainedError = aggregateTwoErrors(err2, aggregateTwoErrors(err1, err0));
|
|
assert.strictEqual(chainedError.message, err0.message);
|
|
assert.strictEqual(chainedError.code, err0.code);
|
|
assert.deepStrictEqual(chainedError.errors, [err0, err1, err2]);
|
|
}
|
|
|
|
{
|
|
const err0 = new Error('original');
|
|
const err1 = new Error('second error');
|
|
|
|
err0.code = 'ERR0';
|
|
err1.code = 'ERR1';
|
|
|
|
const chainedError = aggregateTwoErrors(null, aggregateTwoErrors(err1, err0));
|
|
assert.strictEqual(chainedError.message, err0.message);
|
|
assert.strictEqual(chainedError.code, err0.code);
|
|
assert.deepStrictEqual(chainedError.errors, [err0, err1]);
|
|
}
|