Skip to content

Commit e301ef8

Browse files
committed
chore(test): add support for options to create-fixtures
1 parent 93a3b09 commit e301ef8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tool/create-fixtures.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ function processFile(filePath) {
1313
const lines = contents.split(/\n/);
1414
const inputRegExp = /^\s+text:\s*?"(.*?)"/;
1515
const outputRegExp = /^\s+output:\s*?"(.*?)"/;
16+
const optionsRegExp = /^\s+options:\s*?\{/;
1617
lines.forEach(function (line, index) {
1718
const nextLine = lines[index + 1];
18-
if (inputRegExp.test(line) && outputRegExp.test(nextLine)) {
19+
const nextNextLine = lines[index + 2];
20+
if (inputRegExp.test(line) && outputRegExp.test(nextLine) && !optionsRegExp.test(nextNextLine)) {
1921
const inputMatch = line.match(inputRegExp)[1];
2022
// \\n => \n
2123
RESULT.input.push(inputMatch.replace(/\\n/g, "\n"));
22-
} else if (outputRegExp.test(line)) {
24+
} else if (outputRegExp.test(line) && !optionsRegExp.test(nextLine)) {
2325
const outputMatch = line.match(outputRegExp)[1];
2426
RESULT.output.push(outputMatch.replace(/\\n/g, "\n"));
2527
}

0 commit comments

Comments
 (0)