diff --git a/dev/index.js b/dev/index.js index 3e24f5c..ea8a80f 100644 --- a/dev/index.js +++ b/dev/index.js @@ -5,6 +5,11 @@ 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/doc-content copy.md", diff --git a/src/utils.js b/src/utils.js index 6385716..d73f67a 100644 --- a/src/utils.js +++ b/src/utils.js @@ -251,6 +251,18 @@ async function isValidSourceFile({ config, files, source }) { return true; } +/** + * Parses raw test content into an array of structured test objects. + * + * Processes input content using inline statement and markup regex patterns defined by {@link fileType}, extracting test and step definitions. Supports detection of test boundaries, ignored sections, and step definitions, including batch markup matches. Converts and validates extracted objects against the test and step schemas, handling both v2 and v3 formats. Returns an array of validated test objects with their associated steps. + * + * @param {Object} options - Options for parsing. + * @param {Object} options.config - Test configuration object. + * @param {string|Object} options.content - Raw file content as a string or object. + * @param {string} options.filePath - Path to the file being parsed. + * @param {Object} options.fileType - File type definition containing parsing rules. + * @returns {Array} Array of parsed and validated test objects. + */ async function parseContent({ config, content, filePath, fileType }) { const statements = []; const statementTypes = [