@joystick.js/cli-canary 0.0.0-canary.107 → 0.0.0-canary.109

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.
@@ -1,13 +1,36 @@
1
1
  import child_process from "child_process";
2
+ import CLILog from "../CLILog.js";
3
+ const handleAvaSTDERR = (stderr = "") => {
4
+ try {
5
+ if (stderr?.includes("Using configuration")) {
6
+ return null;
7
+ }
8
+ if (stderr?.includes("No tests found")) {
9
+ return CLILog("No tests found. Add tests in the /tests folder at the root of your Joystick app.", {
10
+ level: "danger",
11
+ docs: "https://cheatcode.co/docs/joystick/test/setup"
12
+ });
13
+ }
14
+ } catch (exception) {
15
+ throw new Error(`[actionName.handleAvaSTDERR] ${exception.message}`);
16
+ }
17
+ };
18
+ const handleAvaSTDOUT = (stdout = "") => {
19
+ try {
20
+ console.log(stdout);
21
+ } catch (exception) {
22
+ throw new Error(`[actionName.handleAvaSTDOUT] ${exception.message}`);
23
+ }
24
+ };
2
25
  const handleAvaSTDIO = (ava = {}) => {
3
26
  try {
4
27
  ava.stdout.on("data", function(data) {
5
28
  const string = data.toString();
6
- console.log(string);
29
+ handleAvaSTDOUT(string);
7
30
  });
8
31
  ava.stderr.on("data", function(data) {
9
32
  const string = data.toString();
10
- console.log(string);
33
+ handleAvaSTDERR(string);
11
34
  });
12
35
  } catch (exception) {
13
36
  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.107",
3
+ "version": "0.0.0-canary.109",
4
4
  "type": "module",
5
5
  "description": "CLI for the Joystick JavaScript framework.",
6
6
  "main": "development.js",
@@ -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
+ // NOTE: Squash output about using a configuration file (we always do in the framework).
7
+ if (stderr?.includes('Using configuration')) {
8
+ return null;
9
+ }
10
+
11
+ if (stderr?.includes('No tests found')) {
12
+ return CLILog('No tests found. Add tests in the /tests folder at the root of your Joystick app.', {
13
+ level: 'danger',
14
+ docs: 'https://cheatcode.co/docs/joystick/test/setup',
15
+ });
16
+ }
17
+ } catch (exception) {
18
+ throw new Error(`[actionName.handleAvaSTDERR] ${exception.message}`);
19
+ }
20
+ };
21
+
22
+ const handleAvaSTDOUT = (stdout = '') => {
23
+ try {
24
+ console.log(stdout);
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}`);