@joystick.js/cli-canary 0.0.0-canary.106 → 0.0.0-canary.108

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.
@@ -512,7 +512,7 @@ const dev = async (options, { resolve, reject }) => {
512
512
  __dirname
513
513
  );
514
514
  if (options?.environment === "test") {
515
- process.loader.text("Running tests...");
515
+ process.loader.stop();
516
516
  await runTests({
517
517
  __dirname
518
518
  });
@@ -1,13 +1,35 @@
1
1
  import child_process from "child_process";
2
+ import CLILog from "../CLILog.js";
3
+ const handleAvaSTDERR = (stderr = "") => {
4
+ try {
5
+ } catch (exception) {
6
+ throw new Error(`[actionName.handleAvaSTDERR] ${exception.message}`);
7
+ }
8
+ };
9
+ const handleAvaSTDOUT = (stdout = "") => {
10
+ try {
11
+ if (stdout?.includes("Using configuration")) {
12
+ return null;
13
+ }
14
+ if (stdout?.includes("No tests found")) {
15
+ return CLILog("No tests found. Add tests in the /tests folder at the root of your Joystick app.", {
16
+ level: "danger",
17
+ docs: "https://cheatcode.co/docs/joystick/test/setup"
18
+ });
19
+ }
20
+ } catch (exception) {
21
+ throw new Error(`[actionName.handleAvaSTDOUT] ${exception.message}`);
22
+ }
23
+ };
2
24
  const handleAvaSTDIO = (ava = {}) => {
3
25
  try {
4
26
  ava.stdout.on("data", function(data) {
5
27
  const string = data.toString();
6
- console.log(string);
28
+ handleAvaSTDOUT(string);
7
29
  });
8
30
  ava.stderr.on("data", function(data) {
9
31
  const string = data.toString();
10
- console.log(string);
32
+ handleAvaSTDERR(string);
11
33
  });
12
34
  } catch (exception) {
13
35
  throw new Error(`[runTests.handleAvaSTDIO] ${exception.message}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joystick.js/cli-canary",
3
- "version": "0.0.0-canary.106",
3
+ "version": "0.0.0-canary.108",
4
4
  "type": "module",
5
5
  "description": "CLI for the Joystick JavaScript framework.",
6
6
  "main": "development.js",
@@ -615,7 +615,7 @@ const dev = async (options, { resolve, reject }) => {
615
615
  );
616
616
 
617
617
  if (options?.environment === 'test') {
618
- process.loader.text('Running tests...');
618
+ process.loader.stop();
619
619
  await runTests({
620
620
  __dirname,
621
621
  });
@@ -1,21 +1,42 @@
1
1
  import child_process from "child_process";
2
+ import CLILog from "../CLILog.js";
3
+
4
+ const handleAvaSTDERR = (stderr = '') => {
5
+ try {
6
+ // Perform a single step in your action here.
7
+ } catch (exception) {
8
+ throw new Error(`[actionName.handleAvaSTDERR] ${exception.message}`);
9
+ }
10
+ };
11
+
12
+ const handleAvaSTDOUT = (stdout = '') => {
13
+ try {
14
+ // NOTE: Squash output about using a configuration file (we always do in the framework).
15
+ if (stdout?.includes('Using configuration')) {
16
+ return null;
17
+ }
18
+
19
+ if (stdout?.includes('No tests found')) {
20
+ return CLILog('No tests found. Add tests in the /tests folder at the root of your Joystick app.', {
21
+ level: 'danger',
22
+ docs: 'https://cheatcode.co/docs/joystick/test/setup',
23
+ });
24
+ }
25
+ } catch (exception) {
26
+ throw new Error(`[actionName.handleAvaSTDOUT] ${exception.message}`);
27
+ }
28
+ };
2
29
 
3
30
  const handleAvaSTDIO = (ava = {}) => {
4
31
  try {
5
32
  ava.stdout.on('data', function (data) {
6
33
  const string = data.toString();
7
- console.log(string);
8
-
9
- // if (!string?.includes('ava')) {
10
- // }
34
+ handleAvaSTDOUT(string);
11
35
  });
12
36
 
13
37
  ava.stderr.on('data', function (data) {
14
38
  const string = data.toString();
15
- console.log(string);
16
-
17
- // if (!string?.includes('ava')) {
18
- // }
39
+ handleAvaSTDERR(string);
19
40
  });
20
41
  } catch (exception) {
21
42
  throw new Error(`[runTests.handleAvaSTDIO] ${exception.message}`);