@antprofuse/veri-bubble 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/vb-runner.js +24 -0
- package/bin/vb-scanner.js +24 -0
- package/bin/vb.js +24 -0
- package/lib/resolve.js +43 -0
- package/package.json +24 -0
package/bin/vb-runner.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const { execFileSync } = require("child_process");
|
|
5
|
+
const { resolveBinary } = require("../lib/resolve.js");
|
|
6
|
+
|
|
7
|
+
const { binPath, pkgDir } = resolveBinary("vb-runner");
|
|
8
|
+
|
|
9
|
+
// Set VB_HOME so vb can find mock binaries in lib/
|
|
10
|
+
const env = Object.assign({}, process.env, {
|
|
11
|
+
VB_HOME: pkgDir
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
try {
|
|
15
|
+
execFileSync(binPath, process.argv.slice(2), {
|
|
16
|
+
stdio: "inherit",
|
|
17
|
+
env: env
|
|
18
|
+
});
|
|
19
|
+
} catch (e) {
|
|
20
|
+
if (e.status !== null) {
|
|
21
|
+
process.exit(e.status);
|
|
22
|
+
}
|
|
23
|
+
throw e;
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const { execFileSync } = require("child_process");
|
|
5
|
+
const { resolveBinary } = require("../lib/resolve.js");
|
|
6
|
+
|
|
7
|
+
const { binPath, pkgDir } = resolveBinary("vb-scanner");
|
|
8
|
+
|
|
9
|
+
// Set VB_HOME so vb can find mock binaries in lib/
|
|
10
|
+
const env = Object.assign({}, process.env, {
|
|
11
|
+
VB_HOME: pkgDir
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
try {
|
|
15
|
+
execFileSync(binPath, process.argv.slice(2), {
|
|
16
|
+
stdio: "inherit",
|
|
17
|
+
env: env
|
|
18
|
+
});
|
|
19
|
+
} catch (e) {
|
|
20
|
+
if (e.status !== null) {
|
|
21
|
+
process.exit(e.status);
|
|
22
|
+
}
|
|
23
|
+
throw e;
|
|
24
|
+
}
|
package/bin/vb.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const { execFileSync } = require("child_process");
|
|
5
|
+
const { resolveBinary } = require("../lib/resolve.js");
|
|
6
|
+
|
|
7
|
+
const { binPath, pkgDir } = resolveBinary("vb");
|
|
8
|
+
|
|
9
|
+
// Set VB_HOME so vb can find mock binaries in lib/
|
|
10
|
+
const env = Object.assign({}, process.env, {
|
|
11
|
+
VB_HOME: pkgDir
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
try {
|
|
15
|
+
execFileSync(binPath, process.argv.slice(2), {
|
|
16
|
+
stdio: "inherit",
|
|
17
|
+
env: env
|
|
18
|
+
});
|
|
19
|
+
} catch (e) {
|
|
20
|
+
if (e.status !== null) {
|
|
21
|
+
process.exit(e.status);
|
|
22
|
+
}
|
|
23
|
+
throw e;
|
|
24
|
+
}
|
package/lib/resolve.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const path = require("path");
|
|
4
|
+
|
|
5
|
+
const PLATFORM_MAP = {
|
|
6
|
+
"linux-x64": "@antprofuse/vb-linux-x64-gnu"
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
function getPlatformPackage() {
|
|
10
|
+
const key = `${process.platform}-${process.arch}`;
|
|
11
|
+
const pkg = PLATFORM_MAP[key];
|
|
12
|
+
if (!pkg) {
|
|
13
|
+
throw new Error(
|
|
14
|
+
`VeriBubble does not support ${process.platform}-${process.arch} yet.\n` +
|
|
15
|
+
`Supported platforms: ${Object.keys(PLATFORM_MAP).join(", ")}`
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
return pkg;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function resolveBinary(name) {
|
|
22
|
+
const pkg = getPlatformPackage();
|
|
23
|
+
let pkgDir;
|
|
24
|
+
try {
|
|
25
|
+
const pkgJson = require.resolve(`${pkg}/package.json`);
|
|
26
|
+
pkgDir = path.dirname(pkgJson);
|
|
27
|
+
} catch (e) {
|
|
28
|
+
throw new Error(
|
|
29
|
+
`Platform package ${pkg} is not installed.\n` +
|
|
30
|
+
`Try: npm install @antprofuse/veri-bubble\n` +
|
|
31
|
+
`(npm should auto-install the correct platform package)`
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Determine if binary is in bin/ or lib/
|
|
36
|
+
const isMock = name.startsWith("vb-mock-");
|
|
37
|
+
const subdir = isMock ? "lib" : "bin";
|
|
38
|
+
const binPath = path.join(pkgDir, subdir, name);
|
|
39
|
+
|
|
40
|
+
return { binPath, pkgDir };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
module.exports = { resolveBinary, getPlatformPackage };
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@antprofuse/veri-bubble",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "VeriBubble 🫧 - Black-box testing framework for Java applications with full network isolation and mock services",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"bin": {
|
|
7
|
+
"vb": "bin/vb.js",
|
|
8
|
+
"vb-runner": "bin/vb-runner.js",
|
|
9
|
+
"vb-scanner": "bin/vb-scanner.js"
|
|
10
|
+
},
|
|
11
|
+
"files": ["bin/", "lib/"],
|
|
12
|
+
"optionalDependencies": {
|
|
13
|
+
"@antprofuse/vb-linux-x64-gnu": "0.1.0"
|
|
14
|
+
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public",
|
|
17
|
+
"registry": "https://registry.npmjs.org/"
|
|
18
|
+
},
|
|
19
|
+
"keywords": ["testing", "java", "mock", "network-isolation", "black-box"],
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "https://github.com/antprofuse/veri-bubble"
|
|
23
|
+
}
|
|
24
|
+
}
|