@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.
- package/dist/lib/dev/index.js +1 -1
- package/dist/lib/dev/runTests.js +24 -2
- package/package.json +1 -1
- package/src/lib/dev/index.js +1 -1
- package/src/lib/dev/runTests.js +29 -8
package/dist/lib/dev/index.js
CHANGED
package/dist/lib/dev/runTests.js
CHANGED
|
@@ -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
|
-
|
|
28
|
+
handleAvaSTDOUT(string);
|
|
7
29
|
});
|
|
8
30
|
ava.stderr.on("data", function(data) {
|
|
9
31
|
const string = data.toString();
|
|
10
|
-
|
|
32
|
+
handleAvaSTDERR(string);
|
|
11
33
|
});
|
|
12
34
|
} catch (exception) {
|
|
13
35
|
throw new Error(`[runTests.handleAvaSTDIO] ${exception.message}`);
|
package/package.json
CHANGED
package/src/lib/dev/index.js
CHANGED
package/src/lib/dev/runTests.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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}`);
|