summaryrefslogtreecommitdiff
path: root/cli/tests/node_compat/test/common
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/node_compat/test/common')
-rw-r--r--cli/tests/node_compat/test/common/child_process.js2
-rw-r--r--cli/tests/node_compat/test/common/dns.js10
-rw-r--r--cli/tests/node_compat/test/common/hijackstdio.js2
-rw-r--r--cli/tests/node_compat/test/common/index.mjs2
-rw-r--r--cli/tests/node_compat/test/common/tmpdir.js13
5 files changed, 21 insertions, 8 deletions
diff --git a/cli/tests/node_compat/test/common/child_process.js b/cli/tests/node_compat/test/common/child_process.js
index c12994e5c..b860d7697 100644
--- a/cli/tests/node_compat/test/common/child_process.js
+++ b/cli/tests/node_compat/test/common/child_process.js
@@ -52,5 +52,5 @@ module.exports = {
cleanupStaleProcess,
logAfterTime,
kExpiringChildRunTime,
- kExpiringParentTimer
+ kExpiringParentTimer,
};
diff --git a/cli/tests/node_compat/test/common/dns.js b/cli/tests/node_compat/test/common/dns.js
index 5c7ba39b3..54df6a55e 100644
--- a/cli/tests/node_compat/test/common/dns.js
+++ b/cli/tests/node_compat/test/common/dns.js
@@ -20,11 +20,11 @@ const types = {
MX: 15,
TXT: 16,
ANY: 255,
- CAA: 257
+ CAA: 257,
};
const classes = {
- IN: 1
+ IN: 1,
};
// Naïve DNS parser/serializer.
@@ -41,7 +41,7 @@ function readDomainFromPacket(buffer, offset) {
const { nread, domain } = readDomainFromPacket(buffer, offset + length);
return {
nread: 1 + length + nread,
- domain: domain ? `${chunk}.${domain}` : chunk
+ domain: domain ? `${chunk}.${domain}` : chunk,
};
}
// Pointer to another part of the packet.
@@ -50,7 +50,7 @@ function readDomainFromPacket(buffer, offset) {
const pointeeOffset = buffer.readUInt16BE(offset) &~ 0xC000;
return {
nread: 2,
- domain: readDomainFromPacket(buffer, pointeeOffset)
+ domain: readDomainFromPacket(buffer, pointeeOffset),
};
}
@@ -323,5 +323,5 @@ module.exports = {
parseDNSPacket,
errorLookupMock,
mockedErrorCode,
- mockedSysCall
+ mockedSysCall,
};
diff --git a/cli/tests/node_compat/test/common/hijackstdio.js b/cli/tests/node_compat/test/common/hijackstdio.js
index 8e7bd2dc0..38582ece2 100644
--- a/cli/tests/node_compat/test/common/hijackstdio.js
+++ b/cli/tests/node_compat/test/common/hijackstdio.js
@@ -35,5 +35,5 @@ module.exports = {
hijackStdout: hijackStdWritable.bind(null, 'stdout'),
hijackStderr: hijackStdWritable.bind(null, 'stderr'),
restoreStdout: restoreWritable.bind(null, 'stdout'),
- restoreStderr: restoreWritable.bind(null, 'stderr')
+ restoreStderr: restoreWritable.bind(null, 'stderr'),
};
diff --git a/cli/tests/node_compat/test/common/index.mjs b/cli/tests/node_compat/test/common/index.mjs
index f2ee456ee..25fe5cbb0 100644
--- a/cli/tests/node_compat/test/common/index.mjs
+++ b/cli/tests/node_compat/test/common/index.mjs
@@ -44,6 +44,7 @@ const {
getCallSite,
mustNotCall,
mustNotMutateObjectDeep,
+ parseTestFlags,
printSkipMessage,
skip,
nodeProcessAborted,
@@ -95,6 +96,7 @@ export {
getCallSite,
mustNotCall,
mustNotMutateObjectDeep,
+ parseTestFlags,
printSkipMessage,
skip,
nodeProcessAborted,
diff --git a/cli/tests/node_compat/test/common/tmpdir.js b/cli/tests/node_compat/test/common/tmpdir.js
index 2c97c51a6..886c4a107 100644
--- a/cli/tests/node_compat/test/common/tmpdir.js
+++ b/cli/tests/node_compat/test/common/tmpdir.js
@@ -62,7 +62,18 @@ function onexit() {
}
}
+function resolve(...paths) {
+ return path.resolve(tmpPath, ...paths);
+}
+
+function hasEnoughSpace(size) {
+ const { bavail, bsize } = fs.statfsSync(tmpPath);
+ return bavail >= Math.ceil(size / bsize);
+}
+
module.exports = {
path: tmpPath,
- refresh
+ refresh,
+ hasEnoughSpace,
+ resolve,
};