textrun-shell 0.6.0 → 0.7.1
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/LICENSE +23 -0
- package/dist/actions/command-output.js +2 -2
- package/dist/actions/command-with-input.js +4 -4
- package/dist/actions/command.js +3 -3
- package/dist/actions/server.js +1 -1
- package/dist/helpers/configuration.js +1 -1
- package/dist/helpers/current-command.js +8 -10
- package/dist/index.js +2 -2
- package/package.json +12 -12
package/LICENSE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
SPDX-License-Identifier: ISC
|
|
2
|
+
|
|
3
|
+
Copyright 2026 Kevin Goslar
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software
|
|
6
|
+
for any purpose with or without fee is hereby granted,
|
|
7
|
+
provided that the above copyright notice
|
|
8
|
+
and this permission notice appear in all copies.
|
|
9
|
+
|
|
10
|
+
THE SOFTWARE IS PROVIDED “AS IS”
|
|
11
|
+
AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
12
|
+
WITH REGARD TO THIS SOFTWARE
|
|
13
|
+
INCLUDING ALL IMPLIED WARRANTIES
|
|
14
|
+
OF MERCHANTABILITY AND FITNESS.
|
|
15
|
+
|
|
16
|
+
IN NO EVENT SHALL THE AUTHOR BE LIABLE
|
|
17
|
+
FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
|
|
18
|
+
OR ANY DAMAGES WHATSOEVER
|
|
19
|
+
RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
|
20
|
+
WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
|
22
|
+
ARISING OUT OF OR IN CONNECTION WITH
|
|
23
|
+
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as assertNoDiff from "assert-no-diff";
|
|
2
2
|
import stripAnsi from "strip-ansi";
|
|
3
|
-
import
|
|
3
|
+
import * as currentCommand from "../helpers/current-command.js";
|
|
4
4
|
export function commandOutput(action) {
|
|
5
5
|
action.name("verifying the output of the last run console command");
|
|
6
6
|
const expectedText = action.region.text();
|
|
@@ -8,7 +8,7 @@ export function commandOutput(action) {
|
|
|
8
8
|
.split("\n")
|
|
9
9
|
.map((line) => line.trim())
|
|
10
10
|
.filter((line) => line);
|
|
11
|
-
const actualOutput = stripAnsi(
|
|
11
|
+
const actualOutput = stripAnsi(currentCommand.instance().combinedText);
|
|
12
12
|
const actualLines = actualOutput
|
|
13
13
|
.split("\n")
|
|
14
14
|
.map(line => line.trim())
|
|
@@ -2,14 +2,14 @@ import { styleText } from "node:util";
|
|
|
2
2
|
import * as observableProcess from "observable-process";
|
|
3
3
|
import { callArgs } from "textrun-extension";
|
|
4
4
|
import { Configuration } from "../helpers/configuration.js";
|
|
5
|
-
import
|
|
5
|
+
import * as currentCommand from "../helpers/current-command.js";
|
|
6
6
|
import { parseCommand } from "../helpers/parse-command.js";
|
|
7
7
|
/**
|
|
8
8
|
* The "runConsoleCommand" action runs the given commands on the console
|
|
9
9
|
* and waits until the command is finished.
|
|
10
10
|
*/
|
|
11
11
|
export async function commandWithInput(action) {
|
|
12
|
-
var commandText = action.region[0].attributes
|
|
12
|
+
var commandText = action.region[0].attributes.command;
|
|
13
13
|
if (commandText === "") {
|
|
14
14
|
throw new Error('empty "command" attribute');
|
|
15
15
|
}
|
|
@@ -35,11 +35,11 @@ export async function commandWithInput(action) {
|
|
|
35
35
|
await enter(processor, inputLine);
|
|
36
36
|
}
|
|
37
37
|
const finished = (await processor.waitForEnd());
|
|
38
|
-
|
|
38
|
+
currentCommand.set(finished);
|
|
39
39
|
action.log(processor.output.fullText());
|
|
40
40
|
}
|
|
41
41
|
async function enter(processor, input) {
|
|
42
|
-
processor.stdin.write(input.input
|
|
42
|
+
processor.stdin.write(`${input.input}\n`);
|
|
43
43
|
if (input.textToWait) {
|
|
44
44
|
await processor.stdout.waitForText(input.textToWait);
|
|
45
45
|
}
|
package/dist/actions/command.js
CHANGED
|
@@ -2,14 +2,14 @@ import { styleText } from "node:util";
|
|
|
2
2
|
import * as observableProcess from "observable-process";
|
|
3
3
|
import * as trExt from "textrun-extension";
|
|
4
4
|
import { Configuration } from "../helpers/configuration.js";
|
|
5
|
-
import
|
|
5
|
+
import * as currentCommand from "../helpers/current-command.js";
|
|
6
6
|
import { parseCommand } from "../helpers/parse-command.js";
|
|
7
7
|
/** Runs the given commands synchronously on the console. */
|
|
8
8
|
export async function command(action) {
|
|
9
9
|
action.name("run shell command");
|
|
10
10
|
const configPath = action.configuration.sourceDir.joinStr("textrun-shell.js");
|
|
11
11
|
const config = await Configuration.load(configPath);
|
|
12
|
-
var commandText = action.region[0].attributes
|
|
12
|
+
var commandText = action.region[0].attributes.command;
|
|
13
13
|
if (commandText === "") {
|
|
14
14
|
throw new Error('empty "command" attribute');
|
|
15
15
|
}
|
|
@@ -28,7 +28,7 @@ export async function command(action) {
|
|
|
28
28
|
// this is also used in the "verify-run-console-output" step
|
|
29
29
|
const finished = (await processor.waitForEnd());
|
|
30
30
|
action.log(finished.combinedText);
|
|
31
|
-
|
|
31
|
+
currentCommand.set(finished);
|
|
32
32
|
if (finished.exitCode !== 0 && !allowError) {
|
|
33
33
|
throw new Error(`command "${commandsToRun}" failed with exit code ${finished.exitCode}`);
|
|
34
34
|
}
|
package/dist/actions/server.js
CHANGED
|
@@ -11,7 +11,7 @@ import { parseCommand } from "../helpers/parse-command.js";
|
|
|
11
11
|
export async function server(action) {
|
|
12
12
|
const configPath = action.configuration.sourceDir.joinStr("textrun-shell.js");
|
|
13
13
|
const config = await Configuration.load(configPath);
|
|
14
|
-
var commandText = action.region[0].attributes
|
|
14
|
+
var commandText = action.region[0].attributes.command;
|
|
15
15
|
if (commandText === "") {
|
|
16
16
|
throw new Error('empty "command" attribute');
|
|
17
17
|
}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
/** CurrentCommand provides global access to the currently running console command. */
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
throw new Error("no instance");
|
|
6
|
-
}
|
|
7
|
-
return instance;
|
|
8
|
-
}
|
|
9
|
-
static set(process) {
|
|
10
|
-
instance = process;
|
|
2
|
+
export function instance() {
|
|
3
|
+
if (!_instance) {
|
|
4
|
+
throw new Error("no instance");
|
|
11
5
|
}
|
|
6
|
+
return _instance;
|
|
7
|
+
}
|
|
8
|
+
export function set(process) {
|
|
9
|
+
_instance = process;
|
|
12
10
|
}
|
|
13
|
-
let
|
|
11
|
+
let _instance = null;
|
|
14
12
|
//# sourceMappingURL=current-command.js.map
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { command } from "./actions/command.js";
|
|
1
2
|
import { commandOutput } from "./actions/command-output.js";
|
|
2
3
|
import { commandWithInput } from "./actions/command-with-input.js";
|
|
3
|
-
import { command } from "./actions/command.js";
|
|
4
|
-
import { serverOutput } from "./actions/server-output.js";
|
|
5
4
|
import { server } from "./actions/server.js";
|
|
5
|
+
import { serverOutput } from "./actions/server-output.js";
|
|
6
6
|
import { stopServer } from "./actions/stop-server.js";
|
|
7
7
|
export const textrunActions = {
|
|
8
8
|
command,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "textrun-shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./dist/index.js",
|
|
@@ -11,27 +11,27 @@
|
|
|
11
11
|
"build": "tsc -p tsconfig-build.json",
|
|
12
12
|
"cuke": "cucumber-js --format=progress",
|
|
13
13
|
"doc": "text-runner",
|
|
14
|
-
"fix": "
|
|
15
|
-
"lint": "dprint check && sort-package-json --check --quiet &&
|
|
14
|
+
"fix": "biome check --write --unsafe && dprint fmt && sort-package-json --quiet && ../tools/rta ghokin fmt replace features",
|
|
15
|
+
"lint": "biome check --error-on-warnings && dprint check && sort-package-json --check --quiet && depcheck --config=../.depcheckrc",
|
|
16
16
|
"reset": "rm -rf dist && yarn run build",
|
|
17
17
|
"unit": "node --test --import tsx 'src/**/*.test.ts'"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"assert-no-diff": "4.1.0",
|
|
21
21
|
"debug": "4.4.3",
|
|
22
|
-
"end-child-processes": "2.0.
|
|
22
|
+
"end-child-processes": "2.0.4",
|
|
23
23
|
"observable-process": "8.0.0",
|
|
24
24
|
"strip-ansi": "7.1.2",
|
|
25
|
-
"text-runner-engine": "7.
|
|
26
|
-
"textrun-extension": "0.
|
|
25
|
+
"text-runner-engine": "7.5.1",
|
|
26
|
+
"textrun-extension": "0.7.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"shared-cucumber-steps": "*",
|
|
30
|
-
"text-runner": "7.
|
|
31
|
-
"textrun-action": "0.
|
|
32
|
-
"textrun-extension": "0.
|
|
33
|
-
"textrun-workspace": "0.
|
|
34
|
-
"tsx": "4.
|
|
30
|
+
"text-runner": "7.5.1",
|
|
31
|
+
"textrun-action": "0.7.1",
|
|
32
|
+
"textrun-extension": "0.7.1",
|
|
33
|
+
"textrun-workspace": "0.7.1",
|
|
34
|
+
"tsx": "4.21.0"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "ffa7b993386ef88d6f199373e97d9c39e3ea3ac4"
|
|
37
37
|
}
|