summaryrefslogtreecommitdiff
path: root/tests/node_compat/test/parallel/test-dgram-socket-buffer-size.js
diff options
context:
space:
mode:
authorNathan Whitaker <17734409+nathanwhit@users.noreply.github.com>2024-07-23 20:12:08 -0700
committerGitHub <noreply@github.com>2024-07-24 03:12:08 +0000
commit29934d558c188fdc3406706da19921ca5a389383 (patch)
treee8fb644f7f90df9ceb32c9bdbba9367aaad833c2 /tests/node_compat/test/parallel/test-dgram-socket-buffer-size.js
parent52ababc4bf948904092cff54c2ab8b91f6b9b443 (diff)
fix(node): Run node compat tests listed in the `ignore` field (and fix the ones that fail) (#24631)
The intent is that those tests will be executed, but our check that the files are up to date won't overwrite the contents of the tests. This is useful when a test needs some manual edits to work. It turns out we weren't actually running them. --- This ended up turning into a couple of small bug fixes to get the tests passing: - We weren't canonicalizing the exec path properly (it sometimes still had `..` or `.` in it) - We weren't accepting strings in `process.exit` There was one failure I couldn't figure out quickly, so I disabled the test for now, and filed a follow up issue: #24694
Diffstat (limited to 'tests/node_compat/test/parallel/test-dgram-socket-buffer-size.js')
-rw-r--r--tests/node_compat/test/parallel/test-dgram-socket-buffer-size.js25
1 files changed, 11 insertions, 14 deletions
diff --git a/tests/node_compat/test/parallel/test-dgram-socket-buffer-size.js b/tests/node_compat/test/parallel/test-dgram-socket-buffer-size.js
index b2fc33262..85cc583cc 100644
--- a/tests/node_compat/test/parallel/test-dgram-socket-buffer-size.js
+++ b/tests/node_compat/test/parallel/test-dgram-socket-buffer-size.js
@@ -2,8 +2,8 @@
// deno-lint-ignore-file
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
-// Taken from Node 16.13.0
-// This file is automatically generated by "node/_tools/setup.ts". Do not modify this file manually
+// Taken from Node 18.12.1
+// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
// Flags: --expose-internals
'use strict';
@@ -19,8 +19,6 @@ const {
UV_ENOTSOCK
} = internalBinding('uv');
-// Note error test amendments from Node due to Deno formatting errors slightly
-// differently.
function getExpectedError(type) {
const code = common.isWindows ? 'ENOTSOCK' : 'EBADF';
const message = common.isWindows ?
@@ -53,18 +51,18 @@ function getExpectedError(type) {
socket.setSendBufferSize(8192);
}, (err) => {
assert.strictEqual(
- inspect(err).replace(/^ +at .*\n/gm, ""),
- `ERR_SOCKET_BUFFER_SIZE [SystemError]: ${errorObj.message}\n` +
+ inspect(err).replace(/^ +at .*\n/gm, ''),
+ `SystemError: ${errorObj.message}\n` +
" code: 'ERR_SOCKET_BUFFER_SIZE',\n" +
- " info: {\n" +
+ ' info: {\n' +
` errno: ${errorObj.info.errno},\n` +
` code: '${errorObj.info.code}',\n` +
` message: '${errorObj.info.message}',\n` +
` syscall: '${errorObj.info.syscall}'\n` +
- " },\n" +
- ` errno: [Getter/Setter],\n` +
- ` syscall: [Getter/Setter]\n` +
- "}"
+ ' },\n' +
+ ` errno: [Getter/Setter: ${errorObj.info.errno}],\n` +
+ ` syscall: [Getter/Setter: '${errorObj.info.syscall}']\n` +
+ '}'
);
return true;
});
@@ -102,15 +100,14 @@ function getExpectedError(type) {
const socket = dgram.createSocket('udp4');
socket.bind(common.mustCall(() => {
- badBufferSizes.forEach((badBufferSize) => {
+ for (const badBufferSize of badBufferSizes) {
assert.throws(() => {
socket.setRecvBufferSize(badBufferSize);
}, errorObj);
-
assert.throws(() => {
socket.setSendBufferSize(badBufferSize);
}, errorObj);
- });
+ }
socket.close();
}));
}