Create a new instance of the TestsFileReader with the specified options for parsing test cases from a file.
Optionaloptions: Partial<TestsFileReaderOptions>Optional configuration for the reader.
ProtectedremoveProtectedreadProtectedreadProtectedisProtectedisProtectedisParse the content of a tests file and return the result, including the successfully parsed tests and any errors encountered. If a Workspace was passed in options, that Workspace will be changed to reflect successful declarations.
The content of the tests file to parse.
The result of parsing, including the successfully parsed tests and any errors encountered.
Protectedparse
Reader class for parsing test cases files that define test cases for input (and output) properties. You should use this class to read test cases from a text file, where each line (or block) defines a test case as a JSON object with a "key" property and either: "type" or "properties" that define the test case structure. The reader will parse the file content and return an object containing the successfully parsed test cases as well as any errors encountered during parsing. The reader supports both line-by-line and block-by-block reading, but blocks are the default and highly recommended. It also includes error handling for invalid syntax and duplicate keys, ensuring that the resulting test cases object is valid and usable within the rule engine.
N.B. Declarations need to be in order, otherwise errors will be returned.
N.B. This is a transactional safe reader. If you provide a workspace and select the option accept: 'all', then that workplace will not be affected if any errors are encountered.