Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .coderabbit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ reviews:
ignore_title_keywords: []
labels: []
drafts: false
base_branches: ["rc"]
base_branches: ["main","rc"]
tools:
shellcheck:
enabled: true
Expand Down
64 changes: 54 additions & 10 deletions dev/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,61 @@ const path = require("path");

main();

/**
* Detects and resolves test cases in a specified markdown file using configured patterns and actions, then outputs the results to a JSON file.
*
* The function analyzes the input markdown file for test-related statements and code blocks according to the provided configuration, processes detected tests, and writes the structured results to "output.json" in the current directory.
*/
async function main() {
const json = {
input: "/home/hawkeyexl/Workspaces/resolver/dev/dev.spec.json",
integrations:{
openApi: [
{
name: "reqres",
descriptionPath: "/home/hawkeyexl/Workspaces/resolver/dev/reqres.openapi.json",
}
]
},
input: "/home/hawkeyexl/Workspaces/resolver/dev/doc-content copy.md",
fileTypes: [
{
name: "markdown",
extensions: ["md", "markdown", "mdx"],
inlineStatements: {
testStart: [
"{\\/\\*\\s*test\\s+?([\\s\\S]*?)\\s*\\*\\/}",
"<!--\\s*test\\s*([\\s\\S]*?)\\s*-->",
"\\[comment\\]:\\s+#\\s+\\(test\\s*(.*?)\\s*\\)",
"\\[comment\\]:\\s+#\\s+\\(test start\\s*(.*?)\\s*\\)",
],
testEnd: [
"{\\/\\*\\s*test end\\s*\\*\\/}",
"<!--\\s*test end\\s*([\\s\\S]*?)\\s*-->",
"\\[comment\\]:\\s+#\\s+\\(test end\\)",
],
ignoreStart: [
"{\\/\\*\\s*test ignore start\\s*\\*\\/}",
"<!--\\s*test ignore start\\s*-->",
],
ignoreEnd: [
"{\\/\\*\\s*test ignore end\\s*\\*\\/}",
"<!--\\s*test ignore end\\s*-->",
],
step: [
"{\\/\\*\\s*step\\s+?([\\s\\S]*?)\\s*\\*\\/}",
"<!--\\s*step\\s*([\\s\\S]*?)\\s*-->",
"\\[comment\\]:\\s+#\\s+\\(step\\s*(.*?)\\s*\\)",
],
},
markup: [
{
name: "runPython",
regex: ["```(?:python)\\b\\s*\\n(?<code>.*?)(?=\\n```)"],
batchMatches: true,
actions: [
{
runCode: {
language: "python",
code: "$1",
},
},
],
},
],
},
],
logLevel: "debug",
};
result = await detectAndResolveTests({ config: json });
Expand All @@ -25,4 +69,4 @@ async function main() {
const fs = require("fs");
fs.writeFileSync(outputPath, JSON.stringify(result, null, 2));
console.log(`Output written to ${outputPath}`);
}
}
Loading