Skip to content

Commit 4459339

Browse files
committed
test: fix the ipc endpoint tests
1 parent b675b0a commit 4459339

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
"scripts": {
8383
"install": "(shx test -f ./script/build.js || run-s build.js) && cross-env npm_config_build_from_source=true aminya-node-gyp-build",
8484
"clean": "shx rm -rf ./build ./lib/ ./prebuilds ./script/*.js ./script/*.js.map ./script/*.d.ts ./script/*.tsbuildinfo",
85-
"clean.temp": "shx rm -rf ./tmp && shx mkdir -p ./tmp && shx touch ./tmp/.gitkeep",
85+
"clean.temp": "shx rm -rf ./tmp && shx mkdir -p ./tmp",
8686
"build.library": "tsc -p ./src/tsconfig.json",
8787
"build.script": "tsc -p ./script/tsconfig.json && tsc -p ./script/tsconfig.esm.json",
8888
"build.js": "run-p build.script build.library",
@@ -94,9 +94,9 @@
9494
"build": "run-s build.js build.native",
9595
"build.debug": "run-s build.js build.native.debug",
9696
"test.deps": "cd test && pnpm install && cd ..",
97-
"test": "run-s test.deps build && mocha --exit",
98-
"test.skip_gc_tests": "run-s test.deps build.debug && cross-env SKIP_GC_TESTS=true mocha --exit",
99-
"test.electron.main": "run-s test.deps build && electron-mocha",
97+
"test": "run-s clean.temp test.deps build && mocha --exit",
98+
"test.skip_gc_tests": "run-s clean.temp test.deps build.debug && cross-env SKIP_GC_TESTS=true mocha --exit",
99+
"test.electron.main": "run-s clean.temp test.deps build && electron-mocha",
100100
"format": "prettier --write .",
101101
"test.electron.renderer": "run-s build && electron-mocha --renderer",
102102
"lint.clang-format": "clang-format -i -style=file ./src/*.cc ./src/*.h ./src/util/*.h",

src/util/error.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ static inline Napi::Error ErrnoException(
4848

4949
static inline Napi::Error ErrnoException(
5050
const Napi::Env& env, int32_t error, const std::string& address) {
51-
auto exception = ErrnoException(env, error);
51+
auto exception = ErrnoException(env, error, nullptr);
5252
exception.Set("address", Napi::String::New(env, address));
5353
return exception;
5454
}

test/unit/helpers.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as path from "path"
22
import * as semver from "semver"
3+
import * as fs from "fs"
34

45
import {spawn} from "child_process"
56

@@ -21,13 +22,17 @@ export function uniqAddress(proto: Proto) {
2122
switch (proto) {
2223
case "ipc": {
2324
const sock = path.resolve(__dirname, `../../tmp/${proto}-${id}`)
25+
// create the directory
26+
fs.mkdirSync(path.dirname(sock), {recursive: true})
27+
2428
return `${proto}://${sock}`
2529
}
2630

2731
case "tcp":
2832
case "udp":
2933
return `${proto}://127.0.0.1:${id}`
3034

35+
case "inproc":
3136
default:
3237
return `${proto}://${proto}-${id}`
3338
}

0 commit comments

Comments
 (0)