Skip to content

Commit be91f0a

Browse files
mcollinaaduh95
authored andcommitted
test: shorten path in net pipe connect errors
Signed-off-by: Matteo Collina <hello@matteocollina.com> PR-URL: #63405 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it>
1 parent 3439582 commit be91f0a

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

‎test/parallel/test-net-pipe-connect-errors.js‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const common = require('../common');
2424
constfixtures=require('../common/fixtures');
2525
constfs=require('fs');
2626
constnet=require('net');
27+
constpath=require('path');
2728
constassert=require('assert');
2829

2930
// Test if ENOTSOCK is fired when trying to connect to a file which is not
@@ -38,11 +39,11 @@ if (common.isWindows) {
3839
}else{
3940
consttmpdir=require('../common/tmpdir');
4041
tmpdir.refresh();
41-
// Keep the file name very short so that we don't exceed the 108 char limit
42-
// on CI for a POSIX socket. Even though this isn't actually a socket file,
43-
// the error will be different from the one we are expecting if we exceed the
44-
// limit.
45-
emptyTxt=`${tmpdir.path}0.txt`;
42+
// Use a short relative path so that we don't exceed the 108 byte limit for
43+
// Unix socket paths in long or multibyte CI workspaces. Even though this
44+
// isn't actually a socket file, the error will be different from the one we
45+
// are expecting if the path is too long.
46+
emptyTxt=path.join(path.relative(process.cwd(),tmpdir.path),'0.txt');
4647

4748
functioncleanup(){
4849
try{

0 commit comments

Comments
 (0)