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
5 changes: 5 additions & 0 deletions dev/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 12 additions & 0 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<Object>} Array of parsed and validated test objects.
*/
async function parseContent({ config, content, filePath, fileType }) {
const statements = [];
const statementTypes = [
Expand Down