@joystick.js/cli-canary 0.0.0-canary.122 → 0.0.0-canary.124

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.
@@ -50,8 +50,7 @@ const handleAvaSTDIO = (ava = {}, options = {}) => {
50
50
  };
51
51
  const runAva = (options = {}) => {
52
52
  try {
53
- const packageRoot = options?.__dirname?.split("/dist")[0];
54
- const avaPath = `${packageRoot}/node_modules/.bin/ava`;
53
+ const avaPath = `${process.cwd()}/node_modules/.bin/ava`;
55
54
  return new Promise((resolve, reject) => {
56
55
  const ava = child_process.exec(`${avaPath} --config ${options?.__dirname}/tests.config.js`, {
57
56
  stdio: "inherit",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joystick.js/cli-canary",
3
- "version": "0.0.0-canary.122",
3
+ "version": "0.0.0-canary.124",
4
4
  "type": "module",
5
5
  "description": "CLI for the Joystick JavaScript framework.",
6
6
  "main": "development.js",
@@ -64,13 +64,17 @@ const handleAvaSTDIO = (ava = {}, options = {}) => {
64
64
 
65
65
  const runAva = (options = {}) => {
66
66
  try {
67
- // NOTE: __dirname includes the entire path to lib/dev/index.js but we only
68
- // care about the root folder/package here (we need to reference the node_modules
69
- // folder in the package).
70
- const packageRoot = options?.__dirname?.split('/dist')[0];
71
- const avaPath = `${packageRoot}/node_modules/.bin/ava`;
67
+ // NOTE: A little bananas to reason through this. In order for Ava to run w/o errors,
68
+ // the Ava binary being run here has to be identical to the one used in @joystick.js/test.
69
+ // That would equal the copy of Ava that's installed in a Joystick app's node_modules
70
+ // directory, not the node_modules directory of the CLI here. We can guarantee that will
71
+ // exist for the CLI here because a developer has to install @joystick.js/test which will
72
+ // add Ava as a dependency to their app in order to write tests.
73
+ const avaPath = `${process.cwd()}/node_modules/.bin/ava`;
72
74
 
73
75
  return new Promise((resolve, reject) => {
76
+ // NOTE: Despite using the app's node_modules path to reference Ava, we still want to reference
77
+ // the internal path here for the default test config in /lib/dev/tests.config.js.
74
78
  const ava = child_process.exec(`${avaPath} --config ${options?.__dirname}/tests.config.js`, {
75
79
  stdio: 'inherit',
76
80
  env: {