@scalvert/bin-tester 2.0.0 → 2.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/dist/index.cjs CHANGED
@@ -97,7 +97,8 @@ function createBinTester(options) {
97
97
  const mergedOptions = __spreadValues(__spreadValues({}, DEFAULT_BIN_TESTER_OPTIONS), options);
98
98
  function runBin(...args) {
99
99
  const mergedRunOptions = parseArgs(args);
100
- return (0, import_execa2.default)(process.execPath, [mergedOptions.binPath, ...mergedOptions.staticArgs, ...mergedRunOptions.args], __spreadValues({
100
+ const binPath = typeof mergedOptions.binPath === "function" ? mergedOptions.binPath(project) : mergedOptions.binPath;
101
+ return (0, import_execa2.default)(process.execPath, [binPath, ...mergedOptions.staticArgs, ...mergedRunOptions.args], __spreadValues({
101
102
  reject: false,
102
103
  cwd: project.baseDir
103
104
  }, mergedRunOptions.execaOptions));
package/dist/index.d.ts CHANGED
@@ -33,7 +33,7 @@ interface BinTesterOptions<TProject> {
33
33
  /**
34
34
  * The absolute path to the bin to invoke
35
35
  */
36
- binPath: string;
36
+ binPath: string | (<TProject extends BinTesterProject>(project: TProject) => string);
37
37
  /**
38
38
  * An array of static arguments that will be used every time when running the bin
39
39
  */
package/dist/index.js CHANGED
@@ -71,7 +71,8 @@ function createBinTester(options) {
71
71
  const mergedOptions = __spreadValues(__spreadValues({}, DEFAULT_BIN_TESTER_OPTIONS), options);
72
72
  function runBin(...args) {
73
73
  const mergedRunOptions = parseArgs(args);
74
- return execa2(process.execPath, [mergedOptions.binPath, ...mergedOptions.staticArgs, ...mergedRunOptions.args], __spreadValues({
74
+ const binPath = typeof mergedOptions.binPath === "function" ? mergedOptions.binPath(project) : mergedOptions.binPath;
75
+ return execa2(process.execPath, [binPath, ...mergedOptions.staticArgs, ...mergedRunOptions.args], __spreadValues({
75
76
  reject: false,
76
77
  cwd: project.baseDir
77
78
  }, mergedRunOptions.execaOptions));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalvert/bin-tester",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "A test harness to invoke a CLI in a tmp directory",
5
5
  "keywords": [
6
6
  "cli",
@@ -69,7 +69,7 @@
69
69
  "vitest": "^0.9.3"
70
70
  },
71
71
  "engines": {
72
- "node": ">=14"
72
+ "node": "^12.22.0 || >=14"
73
73
  },
74
74
  "publishConfig": {
75
75
  "registry": "https://registry.npmjs.org",