effect-bdd 0.1.0
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 +21 -0
- package/README.md +465 -0
- package/dist/Bdd.d.ts +285 -0
- package/dist/Bdd.d.ts.map +1 -0
- package/dist/Bdd.js +304 -0
- package/dist/Bdd.js.map +1 -0
- package/dist/Errors.d.ts +65 -0
- package/dist/Errors.d.ts.map +1 -0
- package/dist/Errors.js +58 -0
- package/dist/Errors.js.map +1 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +7 -0
- package/dist/bin.js.map +1 -0
- package/dist/index.d.ts +147 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/cli/errors.d.ts +30 -0
- package/dist/internal/cli/errors.d.ts.map +1 -0
- package/dist/internal/cli/errors.js +8 -0
- package/dist/internal/cli/errors.js.map +1 -0
- package/dist/internal/cli/glob.d.ts +13 -0
- package/dist/internal/cli/glob.d.ts.map +1 -0
- package/dist/internal/cli/glob.js +29 -0
- package/dist/internal/cli/glob.js.map +1 -0
- package/dist/internal/cli/loaders.d.ts +13 -0
- package/dist/internal/cli/loaders.d.ts.map +1 -0
- package/dist/internal/cli/loaders.js +44 -0
- package/dist/internal/cli/loaders.js.map +1 -0
- package/dist/internal/cli/models.d.ts +102 -0
- package/dist/internal/cli/models.d.ts.map +1 -0
- package/dist/internal/cli/models.js +2 -0
- package/dist/internal/cli/models.js.map +1 -0
- package/dist/internal/cli/moduleLoader.d.ts +14 -0
- package/dist/internal/cli/moduleLoader.d.ts.map +1 -0
- package/dist/internal/cli/moduleLoader.js +39 -0
- package/dist/internal/cli/moduleLoader.js.map +1 -0
- package/dist/internal/cli/reporter.d.ts +22 -0
- package/dist/internal/cli/reporter.d.ts.map +1 -0
- package/dist/internal/cli/reporter.js +227 -0
- package/dist/internal/cli/reporter.js.map +1 -0
- package/dist/internal/cli/runner.d.ts +14 -0
- package/dist/internal/cli/runner.d.ts.map +1 -0
- package/dist/internal/cli/runner.js +178 -0
- package/dist/internal/cli/runner.js.map +1 -0
- package/dist/internal/cli/tagExpression.d.ts +7 -0
- package/dist/internal/cli/tagExpression.d.ts.map +1 -0
- package/dist/internal/cli/tagExpression.js +127 -0
- package/dist/internal/cli/tagExpression.js.map +1 -0
- package/dist/internal/cucumberCompiler.d.ts +5 -0
- package/dist/internal/cucumberCompiler.d.ts.map +1 -0
- package/dist/internal/cucumberCompiler.js +49 -0
- package/dist/internal/cucumberCompiler.js.map +1 -0
- package/dist/internal/expression.d.ts +18 -0
- package/dist/internal/expression.d.ts.map +1 -0
- package/dist/internal/expression.js +59 -0
- package/dist/internal/expression.js.map +1 -0
- package/dist/internal/matching.d.ts +30 -0
- package/dist/internal/matching.d.ts.map +1 -0
- package/dist/internal/matching.js +37 -0
- package/dist/internal/matching.js.map +1 -0
- package/dist/internal/parser.d.ts +54 -0
- package/dist/internal/parser.d.ts.map +1 -0
- package/dist/internal/parser.js +93 -0
- package/dist/internal/parser.js.map +1 -0
- package/dist/internal/runner.d.ts +77 -0
- package/dist/internal/runner.d.ts.map +1 -0
- package/dist/internal/runner.js +117 -0
- package/dist/internal/runner.js.map +1 -0
- package/dist/main.d.ts +23 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +104 -0
- package/dist/main.js.map +1 -0
- package/package.json +102 -0
- package/src/Bdd.ts +575 -0
- package/src/Errors.ts +60 -0
- package/src/bin.ts +10 -0
- package/src/index.ts +155 -0
- package/src/internal/cli/errors.ts +20 -0
- package/src/internal/cli/glob.ts +37 -0
- package/src/internal/cli/loaders.ts +100 -0
- package/src/internal/cli/models.ts +118 -0
- package/src/internal/cli/moduleLoader.ts +41 -0
- package/src/internal/cli/reporter.ts +367 -0
- package/src/internal/cli/runner.ts +336 -0
- package/src/internal/cli/tagExpression.ts +173 -0
- package/src/internal/cucumberCompiler.ts +58 -0
- package/src/internal/expression.ts +103 -0
- package/src/internal/matching.ts +81 -0
- package/src/internal/parser.ts +155 -0
- package/src/internal/runner.ts +373 -0
- package/src/main.ts +169 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as FileSystem from "effect/FileSystem";
|
|
3
|
+
import * as Path from "effect/Path";
|
|
4
|
+
import { ReporterError } from "./errors.ts";
|
|
5
|
+
import type { CliRunResult, ReporterName } from "./models.ts";
|
|
6
|
+
/** @internal */
|
|
7
|
+
export interface Reporter {
|
|
8
|
+
readonly name: ReporterName;
|
|
9
|
+
readonly emit: (result: CliRunResult) => Effect.Effect<void, ReporterError, FileSystem.FileSystem | Path.Path>;
|
|
10
|
+
}
|
|
11
|
+
/** @internal */
|
|
12
|
+
export declare const makeReporters: (names: ReadonlyArray<ReporterName>, outputFiles: {
|
|
13
|
+
readonly text?: string;
|
|
14
|
+
readonly html?: string;
|
|
15
|
+
readonly json?: string;
|
|
16
|
+
readonly junit?: string;
|
|
17
|
+
}, options: {
|
|
18
|
+
readonly verbose: boolean;
|
|
19
|
+
}) => Effect.Effect<ReadonlyArray<Reporter>, ReporterError>;
|
|
20
|
+
/** @internal */
|
|
21
|
+
export declare const emitAll: (reporters: ReadonlyArray<Reporter>, result: CliRunResult) => Effect.Effect<void, ReporterError, FileSystem.FileSystem | Path.Path>;
|
|
22
|
+
//# sourceMappingURL=reporter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reporter.d.ts","sourceRoot":"","sources":["../../../src/internal/cli/reporter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAA;AAE/C,OAAO,KAAK,IAAI,MAAM,aAAa,CAAA;AAGnC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,KAAK,EAAiB,YAAY,EAAE,YAAY,EAAkB,MAAM,aAAa,CAAA;AAE5F,gBAAgB;AAChB,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAA;IAC3B,QAAQ,CAAC,IAAI,EAAE,CACb,MAAM,EAAE,YAAY,KACjB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,aAAa,EAAE,UAAU,CAAC,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,CAAA;CAC3E;AAED,gBAAgB;AAChB,eAAO,MAAM,aAAa,GACxB,OAAO,aAAa,CAAC,YAAY,CAAC,EAClC,aAAa;IACX,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CACxB,EACD,SAAS;IACP,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAC1B,KACA,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE,aAAa,CAoBnD,CAAA;AAEJ,gBAAgB;AAChB,eAAO,MAAM,OAAO,EAAE,CACpB,SAAS,EAAE,aAAa,CAAC,QAAQ,CAAC,EAClC,MAAM,EAAE,YAAY,KACjB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,aAAa,EAAE,UAAU,CAAC,UAAU,GAAG,IAAI,CAAC,IAAI,CAsBvE,CAAA"}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import * as Arr from "effect/Array";
|
|
2
|
+
import * as Console from "effect/Console";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as FileSystem from "effect/FileSystem";
|
|
5
|
+
import { pipe } from "effect/Function";
|
|
6
|
+
import * as Path from "effect/Path";
|
|
7
|
+
import * as Str from "effect/String";
|
|
8
|
+
import * as Parser from "../parser.js";
|
|
9
|
+
import { ReporterError } from "./errors.js";
|
|
10
|
+
/** @internal */
|
|
11
|
+
export const makeReporters = (names, outputFiles, options) => Effect.forEach(names, name => {
|
|
12
|
+
switch (name) {
|
|
13
|
+
case "text":
|
|
14
|
+
{
|
|
15
|
+
return Effect.succeed(textReporter(outputFiles.text, options.verbose));
|
|
16
|
+
}
|
|
17
|
+
case "html":
|
|
18
|
+
{
|
|
19
|
+
return outputFiles.html === undefined ? Effect.fail(new ReporterError({
|
|
20
|
+
message: "Reporter html requires --output-file.html"
|
|
21
|
+
})) : Effect.succeed(htmlReporter(outputFiles.html));
|
|
22
|
+
}
|
|
23
|
+
case "json":
|
|
24
|
+
{
|
|
25
|
+
return Effect.succeed(jsonReporter(outputFiles.json));
|
|
26
|
+
}
|
|
27
|
+
case "junit":
|
|
28
|
+
{
|
|
29
|
+
return outputFiles.junit === undefined ? Effect.fail(new ReporterError({
|
|
30
|
+
message: "Reporter junit requires --output-file.junit"
|
|
31
|
+
})) : Effect.succeed(junitReporter(outputFiles.junit));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
/** @internal */
|
|
36
|
+
export const emitAll = /*#__PURE__*/Effect.fnUntraced(function* (reporters, result) {
|
|
37
|
+
const exits = yield* Effect.forEach(reporters, reporter => Effect.exit(reporter.emit(result)), {
|
|
38
|
+
concurrency: "unbounded"
|
|
39
|
+
});
|
|
40
|
+
const failures = pipe(exits, Arr.filter(exit => exit._tag === "Failure"), Arr.map(exit => exit.cause));
|
|
41
|
+
if (failures.length > 0) {
|
|
42
|
+
return yield* Effect.fail(new ReporterError({
|
|
43
|
+
message: "One or more reporters failed",
|
|
44
|
+
cause: failures
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
const textReporter = (outputFile, verbose) => ({
|
|
49
|
+
name: "text",
|
|
50
|
+
emit: result => outputFile === undefined ? Console.log(renderText(result, verbose)) : writeFile(outputFile, renderText(result, verbose))
|
|
51
|
+
});
|
|
52
|
+
const htmlReporter = outputFile => ({
|
|
53
|
+
name: "html",
|
|
54
|
+
emit: result => writeFile(outputFile, renderHtml(result))
|
|
55
|
+
});
|
|
56
|
+
const jsonReporter = outputFile => ({
|
|
57
|
+
name: "json",
|
|
58
|
+
emit: result => outputFile === undefined ? Console.log(renderJson(result)) : writeFile(outputFile, renderJson(result))
|
|
59
|
+
});
|
|
60
|
+
const junitReporter = outputFile => ({
|
|
61
|
+
name: "junit",
|
|
62
|
+
emit: result => writeFile(outputFile, renderJunit(result))
|
|
63
|
+
});
|
|
64
|
+
const writeFile = /*#__PURE__*/Effect.fnUntraced(function* (outputFile, content) {
|
|
65
|
+
const fs = yield* FileSystem.FileSystem;
|
|
66
|
+
const path = yield* Path.Path;
|
|
67
|
+
const directory = path.dirname(outputFile);
|
|
68
|
+
if (directory !== ".") {
|
|
69
|
+
yield* fs.makeDirectory(directory, {
|
|
70
|
+
recursive: true
|
|
71
|
+
}).pipe(Effect.mapError(cause => new ReporterError({
|
|
72
|
+
message: `Could not create report directory "${directory}"`,
|
|
73
|
+
cause
|
|
74
|
+
})));
|
|
75
|
+
}
|
|
76
|
+
yield* fs.writeFileString(outputFile, content).pipe(Effect.mapError(cause => new ReporterError({
|
|
77
|
+
message: `Could not write report file "${outputFile}"`,
|
|
78
|
+
cause
|
|
79
|
+
})));
|
|
80
|
+
});
|
|
81
|
+
const renderText = (result, verbose) => {
|
|
82
|
+
const summary = [`Features: ${result.summary.features}, Scenarios: ${result.summary.total}, passed: ${result.summary.passed}, failed: ${result.summary.failed}`, `Duration: ${result.summary.durationMillis}ms`, ""];
|
|
83
|
+
const scenarioLines = verbose ? Arr.map(result.results, renderScenarioText) : pipe(result.results, Arr.filter(scenario => scenario.outcome._tag === "Failed"), Arr.map(renderScenarioText));
|
|
84
|
+
const diagnosticLines = renderDiagnosticsText(result.diagnostics);
|
|
85
|
+
return pipe(summary, Arr.appendAll(scenarioLines), Arr.appendAll(diagnosticLines), Arr.join("\n"));
|
|
86
|
+
};
|
|
87
|
+
const renderScenarioText = result => {
|
|
88
|
+
const prefix = result.outcome._tag === "Passed" ? "PASS" : "FAIL";
|
|
89
|
+
const base = `${prefix} ${result.task.featurePath}:${result.task.core.scenarioLine} ${renderScenarioName(result)} (${result.durationMillis}ms)`;
|
|
90
|
+
return result.outcome._tag === "Passed" ? base : `${base}\n ${renderError(result.outcome.error)}`;
|
|
91
|
+
};
|
|
92
|
+
const renderHtml = result => `<!doctype html>
|
|
93
|
+
<html lang="en">
|
|
94
|
+
<head>
|
|
95
|
+
<meta charset="utf-8">
|
|
96
|
+
<title>effect-bdd report</title>
|
|
97
|
+
<style>
|
|
98
|
+
body { font-family: system-ui, sans-serif; margin: 2rem; }
|
|
99
|
+
table { border-collapse: collapse; width: 100%; }
|
|
100
|
+
th, td { border: 1px solid #ddd; padding: 0.5rem; text-align: left; }
|
|
101
|
+
.passed { color: #166534; }
|
|
102
|
+
.failed { color: #991b1b; }
|
|
103
|
+
</style>
|
|
104
|
+
</head>
|
|
105
|
+
<body>
|
|
106
|
+
<h1>effect-bdd report</h1>
|
|
107
|
+
<p>Features: ${result.summary.features}, scenarios: ${result.summary.total}, passed: ${result.summary.passed}, failed: ${result.summary.failed}</p>
|
|
108
|
+
<p>Duration: ${result.summary.durationMillis}ms</p>
|
|
109
|
+
<table>
|
|
110
|
+
<thead>
|
|
111
|
+
<tr><th>Status</th><th>Source</th><th>Feature</th><th>Scenario</th><th>Tags</th><th>Duration</th><th>Error</th></tr>
|
|
112
|
+
</thead>
|
|
113
|
+
<tbody>
|
|
114
|
+
${pipe(result.results, Arr.map(renderScenarioHtml), Arr.join("\n"))}
|
|
115
|
+
</tbody>
|
|
116
|
+
</table>
|
|
117
|
+
<h2>Diagnostics</h2>
|
|
118
|
+
<pre>${escapeHtml(pipe(renderDiagnosticsText(result.diagnostics), Arr.join("\n")))}</pre>
|
|
119
|
+
</body>
|
|
120
|
+
</html>
|
|
121
|
+
`;
|
|
122
|
+
const renderScenarioHtml = result => {
|
|
123
|
+
const status = result.outcome._tag === "Passed" ? "passed" : "failed";
|
|
124
|
+
const error = result.outcome._tag === "Passed" ? "" : renderError(result.outcome.error);
|
|
125
|
+
return ` <tr>
|
|
126
|
+
<td class="${status}">${status}</td>
|
|
127
|
+
<td>${escapeHtml(`${result.task.featurePath}:${result.task.core.scenarioLine}`)}</td>
|
|
128
|
+
<td>${escapeHtml(result.task.core.featureName)}</td>
|
|
129
|
+
<td>${escapeHtml(renderScenarioName(result))}</td>
|
|
130
|
+
<td>${escapeHtml(pipe(result.task.core.tags, Arr.join(", ")))}</td>
|
|
131
|
+
<td>${result.durationMillis}ms</td>
|
|
132
|
+
<td>${escapeHtml(error)}</td>
|
|
133
|
+
</tr>`;
|
|
134
|
+
};
|
|
135
|
+
const renderDiagnosticsText = diagnostics => {
|
|
136
|
+
if (diagnostics.length === 0) {
|
|
137
|
+
return [];
|
|
138
|
+
}
|
|
139
|
+
const unmatched = pipe(diagnostics, Arr.filter(diagnostic => diagnostic._tag === "UnmatchedFeature" || diagnostic._tag === "UnmatchedScenario" || diagnostic._tag === "UnmatchedStep"));
|
|
140
|
+
const unused = pipe(diagnostics, Arr.filter(diagnostic => diagnostic._tag === "UnusedFeatureDefinition" || diagnostic._tag === "UnusedStepDefinition"));
|
|
141
|
+
return pipe(unmatched.length === 0 ? [] : ["", "Unmatched source:"], Arr.appendAll(Arr.map(unmatched, renderDiagnosticText)), Arr.appendAll(unused.length === 0 ? [] : ["", "Unused definitions:"]), Arr.appendAll(Arr.map(unused, renderDiagnosticText)));
|
|
142
|
+
};
|
|
143
|
+
const renderDiagnosticText = diagnostic => {
|
|
144
|
+
switch (diagnostic._tag) {
|
|
145
|
+
case "UnmatchedFeature":
|
|
146
|
+
{
|
|
147
|
+
return ` ${diagnostic.featurePath}:${diagnostic.line}\n Feature: ${diagnostic.featureName}\n Reason: ${diagnostic.message}`;
|
|
148
|
+
}
|
|
149
|
+
case "UnmatchedScenario":
|
|
150
|
+
{
|
|
151
|
+
return ` ${diagnostic.featurePath}:${diagnostic.scenarioLine}\n Scenario: ${diagnostic.scenarioName}\n Reason: ${diagnostic.message}`;
|
|
152
|
+
}
|
|
153
|
+
case "UnmatchedStep":
|
|
154
|
+
{
|
|
155
|
+
return ` ${diagnostic.featurePath}:${Parser.stepLine(diagnostic.step, diagnostic.source)}\n Scenario: ${diagnostic.featureName} / ${diagnostic.scenarioName}\n Step: ${Parser.stepKeyword(diagnostic.step, diagnostic.source)} ${diagnostic.step.text}\n Reason: ${diagnostic.message}`;
|
|
156
|
+
}
|
|
157
|
+
case "UnusedFeatureDefinition":
|
|
158
|
+
{
|
|
159
|
+
return ` ${diagnostic.message}`;
|
|
160
|
+
}
|
|
161
|
+
case "UnusedStepDefinition":
|
|
162
|
+
{
|
|
163
|
+
return ` ${diagnostic.message}`;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
const renderJson = result => JSON.stringify({
|
|
168
|
+
summary: result.summary,
|
|
169
|
+
scenarios: Arr.map(result.results, scenario => ({
|
|
170
|
+
source: {
|
|
171
|
+
path: scenario.task.featurePath,
|
|
172
|
+
line: scenario.task.core.scenarioLine
|
|
173
|
+
},
|
|
174
|
+
feature: scenario.task.core.featureName,
|
|
175
|
+
rule: scenario.task.core.ruleName === undefined ? undefined : {
|
|
176
|
+
name: scenario.task.core.ruleName,
|
|
177
|
+
line: scenario.task.core.ruleLine
|
|
178
|
+
},
|
|
179
|
+
scenario: scenario.task.core.scenarioName,
|
|
180
|
+
tags: scenario.task.core.tags,
|
|
181
|
+
durationMillis: scenario.durationMillis,
|
|
182
|
+
outcome: scenario.outcome._tag === "Passed" ? {
|
|
183
|
+
status: "passed",
|
|
184
|
+
steps: scenario.outcome.steps
|
|
185
|
+
} : {
|
|
186
|
+
status: "failed",
|
|
187
|
+
error: renderError(scenario.outcome.error)
|
|
188
|
+
}
|
|
189
|
+
})),
|
|
190
|
+
diagnostics: result.diagnostics
|
|
191
|
+
}, null, 2);
|
|
192
|
+
const renderJunit = result => {
|
|
193
|
+
const diagnostics = result.diagnostics.length;
|
|
194
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
195
|
+
<testsuite name="effect-bdd" tests="${result.summary.total + diagnostics}" failures="${result.summary.failed + diagnostics}" time="${result.summary.durationMillis / 1000}">
|
|
196
|
+
${pipe(result.results, Arr.map(renderJunitScenario), Arr.join("\n"))}
|
|
197
|
+
${pipe(result.diagnostics, Arr.map(renderJunitDiagnostic), Arr.join("\n"))}
|
|
198
|
+
</testsuite>
|
|
199
|
+
`;
|
|
200
|
+
};
|
|
201
|
+
const renderJunitScenario = result => {
|
|
202
|
+
const name = renderScenarioName(result);
|
|
203
|
+
const failure = result.outcome._tag === "Passed" ? "" : `
|
|
204
|
+
<failure message="${escapeXml(renderError(result.outcome.error))}">${escapeXml(renderError(result.outcome.error))}</failure>`;
|
|
205
|
+
return ` <testcase classname="${escapeXml(result.task.core.featureName)}" name="${escapeXml(name)}" file="${escapeXml(result.task.featurePath)}" line="${result.task.core.scenarioLine}" time="${result.durationMillis / 1000}">${failure}
|
|
206
|
+
</testcase>`;
|
|
207
|
+
};
|
|
208
|
+
const renderJunitDiagnostic = diagnostic => ` <testcase classname="effect-bdd diagnostics" name="${escapeXml(diagnostic.message)}">
|
|
209
|
+
<failure message="${escapeXml(diagnostic.message)}">${escapeXml(renderDiagnosticText(diagnostic))}</failure>
|
|
210
|
+
</testcase>`;
|
|
211
|
+
const renderScenarioName = result => result.task.core.ruleName === undefined ? `${result.task.core.featureName} / ${result.task.core.scenarioName}` : `${result.task.core.featureName} / ${result.task.core.ruleName} / ${result.task.core.scenarioName}`;
|
|
212
|
+
const renderError = error => {
|
|
213
|
+
const cause = renderCause(error.cause);
|
|
214
|
+
return cause === undefined ? `${error._tag}: ${error.message}` : `${error._tag}: ${error.message}\n Cause: ${cause}`;
|
|
215
|
+
};
|
|
216
|
+
const renderCause = cause => {
|
|
217
|
+
if (cause === undefined) {
|
|
218
|
+
return undefined;
|
|
219
|
+
}
|
|
220
|
+
if (typeof cause === "object" && cause !== null && "message" in cause && typeof cause.message === "string") {
|
|
221
|
+
return cause.message;
|
|
222
|
+
}
|
|
223
|
+
return String(cause);
|
|
224
|
+
};
|
|
225
|
+
const escapeHtml = text => pipe(text, Str.replaceAll("&", "&"), Str.replaceAll("<", "<"), Str.replaceAll(">", ">"), Str.replaceAll("\"", """), Str.replaceAll("'", "'"));
|
|
226
|
+
const escapeXml = escapeHtml;
|
|
227
|
+
//# sourceMappingURL=reporter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reporter.js","names":["Arr","Console","Effect","FileSystem","pipe","Path","Str","Parser","ReporterError","makeReporters","names","outputFiles","options","forEach","name","succeed","textReporter","text","verbose","html","undefined","fail","message","htmlReporter","jsonReporter","json","junit","junitReporter","emitAll","fnUntraced","reporters","result","exits","reporter","exit","emit","concurrency","failures","filter","_tag","map","cause","length","outputFile","log","renderText","writeFile","renderHtml","renderJson","renderJunit","content","fs","path","directory","dirname","makeDirectory","recursive","mapError","writeFileString","summary","features","total","passed","failed","durationMillis","scenarioLines","results","renderScenarioText","scenario","outcome","diagnosticLines","renderDiagnosticsText","diagnostics","appendAll","join","prefix","base","task","featurePath","core","scenarioLine","renderScenarioName","renderError","error","renderScenarioHtml","escapeHtml","status","featureName","tags","unmatched","diagnostic","unused","renderDiagnosticText","line","scenarioName","stepLine","step","source","stepKeyword","JSON","stringify","scenarios","feature","rule","ruleName","ruleLine","steps","renderJunitScenario","renderJunitDiagnostic","failure","escapeXml","renderCause","String","replaceAll"],"sources":["../../../src/internal/cli/reporter.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAKA,GAAG,MAAM,cAAc;AACnC,OAAO,KAAKC,OAAO,MAAM,gBAAgB;AACzC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,UAAU,MAAM,mBAAmB;AAC/C,SAASC,IAAI,QAAQ,iBAAiB;AACtC,OAAO,KAAKC,IAAI,MAAM,aAAa;AAC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,CAACe,YAAY,EAAE;AAEzG,MAAMZ,WAAW,GAAIC,KAAoF,IAAY;EACnH,MAAM1C,KAAK,GAAGsE,WAAW,CAAC5B,KAAK,CAAC1C,KAAK,CAAC;EACtC,OAAOA,KAAK,KAAKrB,SAAS,GACtB,GAAG+D,KAAK,CAAC5C,IAAI,KAAK4C,KAAK,CAAC7D,OAAO,EAAE,GACjC,GAAG6D,KAAK,CAAC5C,IAAI,KAAK4C,KAAK,CAAC7D,OAAO,cAAcmB,KAAK,EAAE;AAC1D,CAAC;AAED,MAAMsE,WAAW,GAAItE,KAAc,IAAwB;EACzD,IAAIA,KAAK,KAAKrB,SAAS,EAAE;IACvB,OAAOA,SAAS;EAClB;EACA,IAAI,OAAOqB,KAAK,KAAK,QAAQ,IAAIA,KAAK,KAAK,IAAI,IAAI,SAAS,IAAIA,KAAK,IAAI,OAAOA,KAAK,CAACnB,OAAO,KAAK,QAAQ,EAAE;IAC1G,OAAOmB,KAAK,CAACnB,OAAO;EACtB;EACA,OAAO0F,MAAM,CAACvE,KAAK,CAAC;AACtB,CAAC;AAED,MAAM4C,UAAU,GAAIpE,IAAY,IAC9Bb,IAAI,CACFa,IAAI,EACJX,GAAG,CAAC2G,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,EAC5B3G,GAAG,CAAC2G,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,EAC3B3G,GAAG,CAAC2G,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,EAC3B3G,GAAG,CAAC2G,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,EAC9B3G,GAAG,CAAC2G,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC,CAC9B;AAEH,MAAMH,SAAS,GAAGzB,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import type * as FileSystem from "effect/FileSystem";
|
|
3
|
+
import type * as Path from "effect/Path";
|
|
4
|
+
import type { ParseError } from "../../Errors.ts";
|
|
5
|
+
import * as Parser from "../parser.ts";
|
|
6
|
+
import { DiscoveryError, type ModuleLoadError } from "./errors.ts";
|
|
7
|
+
import type { GlobResolver } from "./glob.ts";
|
|
8
|
+
import type { CliOptions, CliRunResult } from "./models.ts";
|
|
9
|
+
import type { ModuleLoader } from "./moduleLoader.ts";
|
|
10
|
+
/** @internal */
|
|
11
|
+
export declare const run: (options: CliOptions) => Effect.Effect<CliRunResult, CliRunError, FileSystem.FileSystem | GlobResolver | ModuleLoader | Path.Path | Parser.GherkinCompiler>;
|
|
12
|
+
/** @internal */
|
|
13
|
+
export type CliRunError = DiscoveryError | ModuleLoadError | ParseError;
|
|
14
|
+
//# sourceMappingURL=runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../../src/internal/cli/runner.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,UAAU,MAAM,mBAAmB,CAAA;AAGpD,OAAO,KAAK,KAAK,IAAI,MAAM,aAAa,CAAA;AAExC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AAEtC,OAAO,EAAE,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAA;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAE7C,OAAO,KAAK,EAEV,UAAU,EACV,YAAY,EAKb,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAcrD,gBAAgB;AAChB,eAAO,MAAM,GAAG,EAAE,CAChB,OAAO,EAAE,UAAU,KAChB,MAAM,CAAC,MAAM,CAChB,YAAY,EACZ,WAAW,EACX,UAAU,CAAC,UAAU,GAAG,YAAY,GAAG,YAAY,GAAG,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,eAAe,CA6BxF,CAAA;AAqQF,gBAAgB;AAChB,MAAM,MAAM,WAAW,GAAG,cAAc,GAAG,eAAe,GAAG,UAAU,CAAA"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import * as Arr from "effect/Array";
|
|
2
|
+
import * as Clock from "effect/Clock";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import { pipe } from "effect/Function";
|
|
5
|
+
import * as Option from "effect/Option";
|
|
6
|
+
import * as Matching from "../matching.js";
|
|
7
|
+
import * as Parser from "../parser.js";
|
|
8
|
+
import * as CoreRunner from "../runner.js";
|
|
9
|
+
import { DiscoveryError } from "./errors.js";
|
|
10
|
+
import { loadFeatureDefinitions, loadFeatureSources } from "./loaders.js";
|
|
11
|
+
import * as TagExpression from "./tagExpression.js";
|
|
12
|
+
/** @internal */
|
|
13
|
+
export const run = /*#__PURE__*/Effect.fnUntraced(function* (options) {
|
|
14
|
+
const startedAt = yield* Clock.currentTimeMillis;
|
|
15
|
+
const sources = yield* loadFeatureSources(options.features);
|
|
16
|
+
const definitions = yield* loadFeatureDefinitions(options.steps);
|
|
17
|
+
const built = yield* pipe(sources, Effect.forEach(source => buildScenarioTasks(source, definitions)), Effect.map(combineBuiltScenarios));
|
|
18
|
+
const filteredTasks = yield* filterTasks(options, built.tasks);
|
|
19
|
+
const coverage = collectStepCoverage(filteredTasks);
|
|
20
|
+
const results = yield* runScenarios(options, filteredTasks);
|
|
21
|
+
const finishedAt = yield* Clock.currentTimeMillis;
|
|
22
|
+
const diagnostics = pipe(built.diagnostics, Arr.appendAll(coverage.diagnostics), Arr.appendAll(unusedFeatureDefinitions(definitions, built.matchedFeatureNames)), Arr.appendAll(hasScenarioFilter(options) ? [] : unusedStepDefinitions(definitions, built.matchedFeatureNames, coverage.usedTransitionKeys)));
|
|
23
|
+
return {
|
|
24
|
+
results,
|
|
25
|
+
diagnostics,
|
|
26
|
+
summary: summarize(sources.length, results, finishedAt - startedAt)
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
const buildScenarioTasks = /*#__PURE__*/Effect.fnUntraced(function* (source, definitions) {
|
|
30
|
+
const parsed = yield* Parser.parse(source.source, source.path);
|
|
31
|
+
const matches = Arr.filter(definitions, definition => definition.name === parsed.name);
|
|
32
|
+
if (matches.length > 1) {
|
|
33
|
+
return yield* Effect.fail(new DiscoveryError({
|
|
34
|
+
message: `Multiple feature definitions matched "${parsed.name}"`
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
const definition = matches[0];
|
|
38
|
+
if (definition === undefined) {
|
|
39
|
+
return {
|
|
40
|
+
tasks: [],
|
|
41
|
+
diagnostics: pipe([{
|
|
42
|
+
_tag: "UnmatchedFeature",
|
|
43
|
+
featurePath: source.path,
|
|
44
|
+
featureName: parsed.name,
|
|
45
|
+
line: parsed.line,
|
|
46
|
+
message: `Feature file has no matching Bdd.feature export: ${parsed.name}`
|
|
47
|
+
}], Arr.appendAll(Arr.map(parsed.pickles, pickle => ({
|
|
48
|
+
_tag: "UnmatchedScenario",
|
|
49
|
+
featurePath: source.path,
|
|
50
|
+
featureName: parsed.name,
|
|
51
|
+
scenarioName: pickle.name,
|
|
52
|
+
scenarioLine: pickle.location?.line ?? parsed.line,
|
|
53
|
+
message: `Scenario cannot run because no feature definition matched "${parsed.name}"`
|
|
54
|
+
})))),
|
|
55
|
+
matchedFeatureNames: []
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return pipe(CoreRunner.buildScenarioTasks(definition, parsed), Arr.map(task => ({
|
|
59
|
+
featurePath: source.path,
|
|
60
|
+
core: task
|
|
61
|
+
})), tasks => ({
|
|
62
|
+
tasks,
|
|
63
|
+
diagnostics: [],
|
|
64
|
+
matchedFeatureNames: [definition.name]
|
|
65
|
+
}));
|
|
66
|
+
});
|
|
67
|
+
const runScenario = /*#__PURE__*/Effect.fnUntraced(function* (task) {
|
|
68
|
+
const startedAt = yield* Clock.currentTimeMillis;
|
|
69
|
+
const result = yield* Effect.result(CoreRunner.runScenarioTask(task.core));
|
|
70
|
+
const finishedAt = yield* Clock.currentTimeMillis;
|
|
71
|
+
return {
|
|
72
|
+
task,
|
|
73
|
+
outcome: result._tag === "Success" ? {
|
|
74
|
+
_tag: "Passed",
|
|
75
|
+
steps: result.success.steps
|
|
76
|
+
} : {
|
|
77
|
+
_tag: "Failed",
|
|
78
|
+
error: result.failure
|
|
79
|
+
},
|
|
80
|
+
durationMillis: finishedAt - startedAt
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
const runScenarios = (options, tasks) => options.filters.failFast ? runScenariosFailFast(tasks, []) : Effect.forEach(tasks, runScenario, {
|
|
84
|
+
concurrency: options.parallel
|
|
85
|
+
});
|
|
86
|
+
const runScenariosFailFast = (tasks, results, index = 0) => {
|
|
87
|
+
if (index >= tasks.length) {
|
|
88
|
+
return Effect.succeed(results);
|
|
89
|
+
}
|
|
90
|
+
return pipe(runScenario(tasks[index]), Effect.flatMap(result => result.outcome._tag === "Failed" ? Effect.succeed(Arr.append(results, result)) : runScenariosFailFast(tasks, Arr.append(results, result), index + 1)));
|
|
91
|
+
};
|
|
92
|
+
const filterTasks = (options, tasks) => pipe(TagExpression.compileAll(options.filters.tags), Effect.map(tagPredicate => {
|
|
93
|
+
const filtered = Arr.filter(tasks, task => tagPredicate(task.core.tags) && matchesNameFilter(options.filters.names, task));
|
|
94
|
+
return filtered;
|
|
95
|
+
}), Effect.flatMap(filtered => tasks.length > 0 && filtered.length === 0 ? Effect.fail(new DiscoveryError({
|
|
96
|
+
message: "No scenarios matched the provided filters"
|
|
97
|
+
})) : Effect.succeed(filtered)));
|
|
98
|
+
const matchesNameFilter = (patterns, task) => patterns.length === 0 || Arr.some(patterns, pattern => `${task.core.featureName} / ${task.core.scenarioName}`.includes(pattern));
|
|
99
|
+
const hasScenarioFilter = options => options.filters.tags.length > 0 || options.filters.names.length > 0;
|
|
100
|
+
const summarize = (features, results, durationMillis) => {
|
|
101
|
+
const failed = Arr.filter(results, result => result.outcome._tag === "Failed").length;
|
|
102
|
+
return {
|
|
103
|
+
features,
|
|
104
|
+
total: results.length,
|
|
105
|
+
passed: results.length - failed,
|
|
106
|
+
failed,
|
|
107
|
+
durationMillis
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
const combineBuiltScenarios = built => ({
|
|
111
|
+
tasks: pipe(built, Arr.flatMap(item => item.tasks)),
|
|
112
|
+
diagnostics: pipe(built, Arr.flatMap(item => item.diagnostics)),
|
|
113
|
+
matchedFeatureNames: pipe(built, Arr.flatMap(item => item.matchedFeatureNames), Arr.dedupe)
|
|
114
|
+
});
|
|
115
|
+
const collectStepCoverage = tasks => pipe(tasks, Arr.reduce({
|
|
116
|
+
diagnostics: [],
|
|
117
|
+
usedTransitionKeys: []
|
|
118
|
+
}, (coverage, task) => pipe(task.core.pickle.steps, Arr.reduce(coverage, (coverage, step) => appendStepCoverage(coverage, task, step)))));
|
|
119
|
+
const appendStepCoverage = (coverage, task, step) => {
|
|
120
|
+
const kind = Matching.concreteStepKind(step);
|
|
121
|
+
const textMatches = Matching.matchingTextTransitions(task.core.featureDefinition.transitions, step.text);
|
|
122
|
+
const matches = pipe(kind, Option.match({
|
|
123
|
+
onNone: () => [],
|
|
124
|
+
onSome: kind => Matching.matchingKeywordTransitions(textMatches, kind)
|
|
125
|
+
}));
|
|
126
|
+
if (matches.length === 0) {
|
|
127
|
+
return {
|
|
128
|
+
diagnostics: Arr.append(coverage.diagnostics, {
|
|
129
|
+
_tag: "UnmatchedStep",
|
|
130
|
+
featurePath: task.featurePath,
|
|
131
|
+
featureName: task.core.featureName,
|
|
132
|
+
scenarioName: task.core.scenarioName,
|
|
133
|
+
scenarioLine: task.core.scenarioLine,
|
|
134
|
+
step,
|
|
135
|
+
source: task.core.source,
|
|
136
|
+
reason: textMatches.length === 0 ? "NoMatch" : "WrongKeyword",
|
|
137
|
+
candidates: textMatches.length === 0 ? Arr.map(task.core.featureDefinition.transitions, transition => transition.expression.source) : Arr.map(textMatches, match => match.transition.expression.source),
|
|
138
|
+
message: textMatches.length === 0 ? `No transition matched step "${step.text}"` : `No ${pipe(kind, Option.getOrElse(() => "Step"))} transition matched step "${step.text}"; matching text exists for ${Matching.renderTransitionKinds(Arr.map(textMatches, match => match.transition))}`
|
|
139
|
+
}),
|
|
140
|
+
usedTransitionKeys: coverage.usedTransitionKeys
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
if (matches.length > 1) {
|
|
144
|
+
return {
|
|
145
|
+
diagnostics: Arr.append(coverage.diagnostics, {
|
|
146
|
+
_tag: "UnmatchedStep",
|
|
147
|
+
featurePath: task.featurePath,
|
|
148
|
+
featureName: task.core.featureName,
|
|
149
|
+
scenarioName: task.core.scenarioName,
|
|
150
|
+
scenarioLine: task.core.scenarioLine,
|
|
151
|
+
step,
|
|
152
|
+
source: task.core.source,
|
|
153
|
+
reason: "MultipleMatches",
|
|
154
|
+
candidates: Arr.map(matches, match => match.transition.expression.source),
|
|
155
|
+
message: `Multiple transitions matched step "${step.text}"`
|
|
156
|
+
}),
|
|
157
|
+
usedTransitionKeys: coverage.usedTransitionKeys
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
return {
|
|
161
|
+
diagnostics: coverage.diagnostics,
|
|
162
|
+
usedTransitionKeys: pipe(coverage.usedTransitionKeys, Arr.append(transitionKey(task.core.featureName, matches[0].transition)), Arr.dedupe)
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
const unusedFeatureDefinitions = (definitions, matchedFeatureNames) => pipe(definitions, Arr.filter(definition => !Arr.contains(definition.name)(matchedFeatureNames)), Arr.map(definition => ({
|
|
166
|
+
_tag: "UnusedFeatureDefinition",
|
|
167
|
+
featureName: definition.name,
|
|
168
|
+
message: `Feature definition exported but no feature file matched: ${definition.name}`
|
|
169
|
+
})));
|
|
170
|
+
const unusedStepDefinitions = (definitions, matchedFeatureNames, usedTransitionKeys) => pipe(definitions, Arr.filter(definition => Arr.contains(definition.name)(matchedFeatureNames)), Arr.flatMap(definition => pipe(definition.transitions, Arr.filter(transition => !Arr.contains(transitionKey(definition.name, transition))(usedTransitionKeys)), Arr.map(transition => ({
|
|
171
|
+
_tag: "UnusedStepDefinition",
|
|
172
|
+
featureName: definition.name,
|
|
173
|
+
expression: transition.expression.source,
|
|
174
|
+
kind: transition.kind,
|
|
175
|
+
message: `Step definition never matched: ${transition.expression.source}`
|
|
176
|
+
})))));
|
|
177
|
+
const transitionKey = (featureName, transition) => `${featureName}:${transition.kind}:${transition.expression.source}`;
|
|
178
|
+
//# sourceMappingURL=runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.js","names":["Arr","Clock","Effect","pipe","Option","Matching","Parser","CoreRunner","DiscoveryError","loadFeatureDefinitions","loadFeatureSources","TagExpression","run","fnUntraced","options","startedAt","currentTimeMillis","sources","features","definitions","steps","built","forEach","source","buildScenarioTasks","map","combineBuiltScenarios","filteredTasks","filterTasks","tasks","coverage","collectStepCoverage","results","runScenarios","finishedAt","diagnostics","appendAll","unusedFeatureDefinitions","matchedFeatureNames","hasScenarioFilter","unusedStepDefinitions","usedTransitionKeys","summary","summarize","length","parsed","parse","path","matches","filter","definition","name","fail","message","undefined","_tag","featurePath","featureName","line","pickles","pickle","scenarioName","scenarioLine","location","task","core","runScenario","result","runScenarioTask","outcome","success","error","failure","durationMillis","filters","failFast","runScenariosFailFast","concurrency","parallel","index","succeed","flatMap","append","compileAll","tags","tagPredicate","filtered","matchesNameFilter","names","patterns","some","pattern","includes","failed","total","passed","item","dedupe","reduce","step","appendStepCoverage","kind","concreteStepKind","textMatches","matchingTextTransitions","featureDefinition","transitions","text","match","onNone","onSome","matchingKeywordTransitions","reason","candidates","transition","expression","getOrElse","renderTransitionKinds","transitionKey","contains"],"sources":["../../../src/internal/cli/runner.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAKA,GAAG,MAAM,cAAc;AACnC,OAAO,KAAKC,KAAK,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,UAAU,CAACC,UAAU,CAAC5F,MAAM;CACxE,CAAC,CAAC,CACJ,CACF,CACF;AAEH,MAAM+F,aAAa,GAAGA,CACpB7D,WAAmB,EACnByD,UAAmD,KACxC,GAAGzD,WAAW,IAAIyD,UAAU,CAACb,IAAI,IAAIa,UAAU,CAACC,UAAU,CAAC5F,MAAM,EAAE","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import { DiscoveryError } from "./errors.ts";
|
|
3
|
+
/** @internal */
|
|
4
|
+
export type TagPredicate = (tags: ReadonlyArray<string>) => boolean;
|
|
5
|
+
/** @internal */
|
|
6
|
+
export declare const compileAll: (expressions: ReadonlyArray<string>) => Effect.Effect<TagPredicate, DiscoveryError>;
|
|
7
|
+
//# sourceMappingURL=tagExpression.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tagExpression.d.ts","sourceRoot":"","sources":["../../../src/internal/cli/tagExpression.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAGvC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C,gBAAgB;AAChB,MAAM,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,KAAK,OAAO,CAAA;AA2BnE,gBAAgB;AAChB,eAAO,MAAM,UAAU,GACrB,aAAa,aAAa,CAAC,MAAM,CAAC,KACjC,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,cAAc,CAG1C,CAAA"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import * as Arr from "effect/Array";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import { pipe } from "effect/Function";
|
|
4
|
+
import * as Str from "effect/String";
|
|
5
|
+
import { DiscoveryError } from "./errors.js";
|
|
6
|
+
/** @internal */
|
|
7
|
+
export const compileAll = expressions => Effect.forEach(expressions, compile).pipe(Effect.map(predicates => tags => Arr.every(predicates, predicate => predicate(tags))));
|
|
8
|
+
const compile = expression => {
|
|
9
|
+
const tokens = tokenize(expression);
|
|
10
|
+
if (tokens === undefined || tokens.length === 0) {
|
|
11
|
+
return fail(expression, "Expected a tag expression");
|
|
12
|
+
}
|
|
13
|
+
const result = parseOr(tokens, 0);
|
|
14
|
+
if (result === undefined || result.index !== tokens.length) {
|
|
15
|
+
return fail(expression, "Could not parse tag expression");
|
|
16
|
+
}
|
|
17
|
+
return Effect.succeed(tags => evaluate(result.expression, tags));
|
|
18
|
+
};
|
|
19
|
+
const parseOr = (tokens, index) => {
|
|
20
|
+
const left = parseAnd(tokens, index);
|
|
21
|
+
if (left === undefined) {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
return parseOrRest(tokens, left);
|
|
25
|
+
};
|
|
26
|
+
const parseOrRest = (tokens, left) => {
|
|
27
|
+
if (tokens[left.index] !== "or") {
|
|
28
|
+
return left;
|
|
29
|
+
}
|
|
30
|
+
const right = parseAnd(tokens, left.index + 1);
|
|
31
|
+
if (right === undefined) {
|
|
32
|
+
return left;
|
|
33
|
+
}
|
|
34
|
+
return parseOrRest(tokens, {
|
|
35
|
+
expression: {
|
|
36
|
+
_tag: "Or",
|
|
37
|
+
left: left.expression,
|
|
38
|
+
right: right.expression
|
|
39
|
+
},
|
|
40
|
+
index: right.index
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
const parseAnd = (tokens, index) => {
|
|
44
|
+
const left = parseUnary(tokens, index);
|
|
45
|
+
if (left === undefined) {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
return parseAndRest(tokens, left);
|
|
49
|
+
};
|
|
50
|
+
const parseAndRest = (tokens, left) => {
|
|
51
|
+
if (tokens[left.index] !== "and") {
|
|
52
|
+
return left;
|
|
53
|
+
}
|
|
54
|
+
const right = parseUnary(tokens, left.index + 1);
|
|
55
|
+
if (right === undefined) {
|
|
56
|
+
return left;
|
|
57
|
+
}
|
|
58
|
+
return parseAndRest(tokens, {
|
|
59
|
+
expression: {
|
|
60
|
+
_tag: "And",
|
|
61
|
+
left: left.expression,
|
|
62
|
+
right: right.expression
|
|
63
|
+
},
|
|
64
|
+
index: right.index
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
const parseUnary = (tokens, index) => tokens[index] === "not" ? parseNot(tokens, index) : parsePrimary(tokens, index);
|
|
68
|
+
const parseNot = (tokens, index) => {
|
|
69
|
+
const result = parseUnary(tokens, index + 1);
|
|
70
|
+
return result === undefined ? undefined : {
|
|
71
|
+
expression: {
|
|
72
|
+
_tag: "Not",
|
|
73
|
+
expression: result.expression
|
|
74
|
+
},
|
|
75
|
+
index: result.index
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
const parsePrimary = (tokens, index) => {
|
|
79
|
+
const token = tokens[index];
|
|
80
|
+
if (token === undefined) {
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
if (token === "(") {
|
|
84
|
+
const result = parseOr(tokens, index + 1);
|
|
85
|
+
return result !== undefined && tokens[result.index] === ")" ? {
|
|
86
|
+
expression: result.expression,
|
|
87
|
+
index: result.index + 1
|
|
88
|
+
} : undefined;
|
|
89
|
+
}
|
|
90
|
+
return pipe(token, Str.startsWith("@")) ? {
|
|
91
|
+
expression: {
|
|
92
|
+
_tag: "Tag",
|
|
93
|
+
tag: token
|
|
94
|
+
},
|
|
95
|
+
index: index + 1
|
|
96
|
+
} : undefined;
|
|
97
|
+
};
|
|
98
|
+
const evaluate = (expression, tags) => {
|
|
99
|
+
switch (expression._tag) {
|
|
100
|
+
case "Tag":
|
|
101
|
+
{
|
|
102
|
+
return Arr.contains(expression.tag)(tags);
|
|
103
|
+
}
|
|
104
|
+
case "Not":
|
|
105
|
+
{
|
|
106
|
+
return !evaluate(expression.expression, tags);
|
|
107
|
+
}
|
|
108
|
+
case "And":
|
|
109
|
+
{
|
|
110
|
+
return evaluate(expression.left, tags) && evaluate(expression.right, tags);
|
|
111
|
+
}
|
|
112
|
+
case "Or":
|
|
113
|
+
{
|
|
114
|
+
return evaluate(expression.left, tags) || evaluate(expression.right, tags);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
const tokenize = expression => {
|
|
119
|
+
const matches = expression.match(/\(|\)|\b(?:and|or|not)\b|@[A-Za-z0-9][A-Za-z0-9_-]*/g) ?? [];
|
|
120
|
+
const normalized = pipe(expression, Str.replace(/\s+/g, ""));
|
|
121
|
+
const matched = pipe(matches, Arr.join(""));
|
|
122
|
+
return normalized === matched ? matches : undefined;
|
|
123
|
+
};
|
|
124
|
+
const fail = (expression, message) => Effect.fail(new DiscoveryError({
|
|
125
|
+
message: `${message}: ${expression}`
|
|
126
|
+
}));
|
|
127
|
+
//# sourceMappingURL=tagExpression.js.map
|