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

Some checks are pending
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
ci / pre-build (push) Waiting to run
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 / test release windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
55 lines
1.6 KiB
JavaScript
55 lines
1.6 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';
|
|
|
|
// Do not read filesystem when creating AssertionError messages for code in
|
|
// builtin modules.
|
|
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const EventEmitter = require('events');
|
|
const e = new EventEmitter();
|
|
e.on('hello', assert);
|
|
|
|
if (process.argv[2] !== 'child') {
|
|
const tmpdir = require('../common/tmpdir');
|
|
tmpdir.refresh();
|
|
const { spawnSync } = require('child_process');
|
|
|
|
let threw = false;
|
|
try {
|
|
e.emit('hello', false);
|
|
} catch (err) {
|
|
const frames = err.stack.split('\n');
|
|
const [, filename, line, column] = frames[1].match(/\((.+):(\d+):(\d+)\)/);
|
|
// Spawn a child process to avoid the error having been cached in the assert
|
|
// module's `errorCache` Map.
|
|
|
|
const { output, status, error } =
|
|
spawnSync(process.execPath,
|
|
[process.argv[1], 'child', filename, line, column],
|
|
{ cwd: tmpdir.path, env: process.env });
|
|
assert.ifError(error);
|
|
assert.strictEqual(status, 0, `Exit code: ${status}\n${output}`);
|
|
threw = true;
|
|
}
|
|
assert.ok(threw);
|
|
} else {
|
|
const { writeFileSync } = require('fs');
|
|
const [, , , filename, line, column] = process.argv;
|
|
const data = `${'\n'.repeat(line - 1)}${' '.repeat(column - 1)}` +
|
|
'ok(failed(badly));';
|
|
|
|
writeFileSync(filename, data);
|
|
assert.throws(
|
|
() => e.emit('hello', false),
|
|
{
|
|
message: 'false == true'
|
|
}
|
|
);
|
|
}
|