@joystick.js/cli-canary 0.0.0-canary.126 → 0.0.0-canary.128

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.
@@ -221,16 +221,10 @@ var functions_default = {
221
221
  set: !!rawArgs.includes("test"),
222
222
  description: "Start an existing Joystick app and run its tests.",
223
223
  args: {
224
- w: {
225
- set: !!rawArgs.includes("w") && !!rawArgs[rawArgs.indexOf("w") + 1],
226
- parent: "w",
227
- value: !!rawArgs.includes("w") && rawArgs[rawArgs.indexOf("w") + 1],
228
- description: "Run joystick test in watch mode."
229
- },
230
224
  watch: {
231
- set: !!rawArgs.includes("watch") && !!rawArgs[rawArgs.indexOf("watch") + 1],
225
+ set: !!rawArgs.includes("watch"),
232
226
  parent: "watch",
233
- value: !!rawArgs.includes("watch") && rawArgs[rawArgs.indexOf("watch") + 1],
227
+ value: !!rawArgs.includes("watch"),
234
228
  description: "Run joystick test in watch mode."
235
229
  }
236
230
  },
@@ -3,7 +3,8 @@ var test_default = async (args = {}, options = {}) => {
3
3
  await dev({
4
4
  environment: "test",
5
5
  process,
6
- port: 1977
6
+ port: 1977,
7
+ watch: args?.watch
7
8
  });
8
9
  };
9
10
  export {
@@ -516,6 +516,7 @@ const dev = async (options, { resolve, reject }) => {
516
516
  process.loader.stop();
517
517
  const databaseProcessIds = getDatabaseProcessIds();
518
518
  await runTests({
519
+ watch: options?.watch,
519
520
  __dirname,
520
521
  processIds: [
521
522
  ...processIds,
@@ -523,7 +524,9 @@ const dev = async (options, { resolve, reject }) => {
523
524
  ],
524
525
  cleanupProcess: process.cleanupProcess
525
526
  });
526
- process.exit(0);
527
+ if (!options?.watch) {
528
+ process.exit(0);
529
+ }
527
530
  }
528
531
  resolve();
529
532
  } catch (exception) {
@@ -2,7 +2,6 @@ import child_process from "child_process";
2
2
  import CLILog from "../CLILog.js";
3
3
  const handleAvaSTDERR = (stderr = "", options = {}) => {
4
4
  try {
5
- console.log("STDERR", stderr);
6
5
  if (stderr?.includes("Using configuration")) {
7
6
  return null;
8
7
  }
@@ -12,13 +11,13 @@ const handleAvaSTDERR = (stderr = "", options = {}) => {
12
11
  docs: "https://cheatcode.co/docs/joystick/test/setup"
13
12
  });
14
13
  }
14
+ console.log(stderr);
15
15
  } catch (exception) {
16
16
  throw new Error(`[runTests.handleAvaSTDERR] ${exception.message}`);
17
17
  }
18
18
  };
19
19
  const handleAvaSTDOUT = (stdout = "", options = {}) => {
20
20
  try {
21
- console.log(stdout);
22
21
  if (stdout?.includes("Using configuration")) {
23
22
  return null;
24
23
  }
@@ -30,6 +29,7 @@ const handleAvaSTDOUT = (stdout = "", options = {}) => {
30
29
  options.cleanupProcess.send(JSON.stringify({ processIds: options?.processIds }));
31
30
  return process.exit(0);
32
31
  }
32
+ console.log(stdout);
33
33
  } catch (exception) {
34
34
  throw new Error(`[runTests.handleAvaSTDOUT] ${exception.message}`);
35
35
  }
@@ -52,7 +52,7 @@ const runAva = (options = {}) => {
52
52
  try {
53
53
  const avaPath = `${process.cwd()}/node_modules/.bin/ava`;
54
54
  return new Promise((resolve, reject) => {
55
- const ava = child_process.exec(`${avaPath} --config ${options?.__dirname}/tests.config.js`, {
55
+ const ava = child_process.exec(`${avaPath} --config ${options?.__dirname}/tests.config.js ${options?.watch ? "--watch" : ""}`, {
56
56
  stdio: "inherit",
57
57
  env: {
58
58
  ...process.env,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joystick.js/cli-canary",
3
- "version": "0.0.0-canary.126",
3
+ "version": "0.0.0-canary.128",
4
4
  "type": "module",
5
5
  "description": "CLI for the Joystick JavaScript framework.",
6
6
  "main": "development.js",
@@ -224,16 +224,10 @@ export default {
224
224
  set: !!rawArgs.includes('test'),
225
225
  description: 'Start an existing Joystick app and run its tests.',
226
226
  args: {
227
- w: {
228
- set: !!rawArgs.includes('w') && !!rawArgs[rawArgs.indexOf('w') + 1],
229
- parent: 'w',
230
- value: !!rawArgs.includes('w') && rawArgs[rawArgs.indexOf('w') + 1],
231
- description: 'Run joystick test in watch mode.',
232
- },
233
227
  watch: {
234
- set: !!rawArgs.includes('watch') && !!rawArgs[rawArgs.indexOf('watch') + 1],
228
+ set: !!rawArgs.includes('watch'),
235
229
  parent: 'watch',
236
- value: !!rawArgs.includes('watch') && rawArgs[rawArgs.indexOf('watch') + 1],
230
+ value: !!rawArgs.includes('watch'),
237
231
  description: 'Run joystick test in watch mode.',
238
232
  },
239
233
  },
@@ -5,5 +5,6 @@ export default async (args = {}, options = {}) => {
5
5
  environment: 'test',
6
6
  process,
7
7
  port: 1977,
8
+ watch: args?.watch,
8
9
  });
9
10
  };
@@ -621,6 +621,7 @@ const dev = async (options, { resolve, reject }) => {
621
621
  const databaseProcessIds = getDatabaseProcessIds();
622
622
 
623
623
  await runTests({
624
+ watch: options?.watch,
624
625
  __dirname,
625
626
  processIds: [
626
627
  ...processIds,
@@ -629,8 +630,10 @@ const dev = async (options, { resolve, reject }) => {
629
630
  cleanupProcess: process.cleanupProcess,
630
631
  });
631
632
 
632
- // TODO: Handle a watch mode here in case they pass it.
633
- process.exit(0);
633
+ if (!options?.watch) {
634
+ // NOTE: Kick out of the process after tests run if we're not in watch mode.
635
+ process.exit(0);
636
+ }
634
637
  }
635
638
 
636
639
  /*
@@ -3,8 +3,6 @@ import CLILog from "../CLILog.js";
3
3
 
4
4
  const handleAvaSTDERR = (stderr = '', options = {}) => {
5
5
  try {
6
- console.log('STDERR', stderr);
7
-
8
6
  // NOTE: Squash output about using a configuration file (we always do in the framework).
9
7
  if (stderr?.includes('Using configuration')) {
10
8
  return null;
@@ -16,6 +14,8 @@ const handleAvaSTDERR = (stderr = '', options = {}) => {
16
14
  docs: 'https://cheatcode.co/docs/joystick/test/setup',
17
15
  });
18
16
  }
17
+
18
+ console.log(stderr);
19
19
  } catch (exception) {
20
20
  throw new Error(`[runTests.handleAvaSTDERR] ${exception.message}`);
21
21
  }
@@ -23,7 +23,6 @@ const handleAvaSTDERR = (stderr = '', options = {}) => {
23
23
 
24
24
  const handleAvaSTDOUT = (stdout = '', options = {}) => {
25
25
  try {
26
- console.log(stdout);
27
26
  // NOTE: Squash output about using a configuration file (we always do in the framework).
28
27
  if (stdout?.includes('Using configuration')) {
29
28
  return null;
@@ -41,6 +40,8 @@ const handleAvaSTDOUT = (stdout = '', options = {}) => {
41
40
 
42
41
  return process.exit(0);
43
42
  }
43
+
44
+ console.log(stdout);
44
45
  } catch (exception) {
45
46
  throw new Error(`[runTests.handleAvaSTDOUT] ${exception.message}`);
46
47
  }
@@ -75,7 +76,7 @@ const runAva = (options = {}) => {
75
76
  return new Promise((resolve, reject) => {
76
77
  // NOTE: Despite using the app's node_modules path to reference Ava, we still want to reference
77
78
  // the internal path here for the default test config in /lib/dev/tests.config.js.
78
- const ava = child_process.exec(`${avaPath} --config ${options?.__dirname}/tests.config.js`, {
79
+ const ava = child_process.exec(`${avaPath} --config ${options?.__dirname}/tests.config.js ${options?.watch ? '--watch' : ''}`, {
79
80
  stdio: 'inherit',
80
81
  env: {
81
82
  ...(process.env),