mirror of
https://github.com/denoland/deno.git
synced 2025-07-07 21:35:07 +00:00

Some checks are pending
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
57 lines
1.3 KiB
JavaScript
57 lines
1.3 KiB
JavaScript
// deno-fmt-ignore-file
|
|
// deno-lint-ignore-file
|
|
|
|
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
|
// Taken from Node 23.9.0
|
|
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
|
|
|
'use strict';
|
|
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const { test } = require('node:test');
|
|
|
|
test('No args', () => {
|
|
assert.throws(
|
|
() => { assert.fail(); },
|
|
{
|
|
code: 'ERR_ASSERTION',
|
|
name: 'AssertionError',
|
|
message: 'Failed',
|
|
operator: 'fail',
|
|
actual: undefined,
|
|
expected: undefined,
|
|
generatedMessage: true,
|
|
stack: /Failed/
|
|
}
|
|
);
|
|
});
|
|
|
|
test('One arg = message', () => {
|
|
assert.throws(() => {
|
|
assert.fail('custom message');
|
|
}, {
|
|
code: 'ERR_ASSERTION',
|
|
name: 'AssertionError',
|
|
message: 'custom message',
|
|
operator: 'fail',
|
|
actual: undefined,
|
|
expected: undefined,
|
|
generatedMessage: false
|
|
});
|
|
});
|
|
|
|
test('One arg = Error', () => {
|
|
assert.throws(() => {
|
|
assert.fail(new TypeError('custom message'));
|
|
}, {
|
|
name: 'TypeError',
|
|
message: 'custom message'
|
|
});
|
|
});
|
|
|
|
test('Object prototype get', () => {
|
|
Object.prototype.get = () => { throw new Error('failed'); };
|
|
assert.throws(() => assert.fail(''), { code: 'ERR_ASSERTION' });
|
|
delete Object.prototype.get;
|
|
});
|