Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
30 changes: 19 additions & 11 deletions dev/doc-content.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
```
PATCH https://orc.wiremockapi.cloud/satellites/8 HTTP/1.1
Host: orc.wiremockapi.cloud
Content-Type: application/json
Accept: application/json
Content-Length: 25

{
"status": "maintenance"
}
```
[comment]: # 'test {"testId": "uppercase-conversion", "detectSteps": false}'

1. Open the app at [http://localhost:3000](http://localhost:3000).

[comment]: # 'step {"goTo": "http://localhost:3000"}'

2. Type "hello world" in the input field.

[comment]: # 'step {"find": {"selector": "#input", "click": true}}'
[comment]: # 'step {"type": "hello world"}'

3. Click **Convert to Uppercase**.

[comment]: # 'step {"find": {"selector": "button", "click": true}}'

4. You'll see **HELLO WORLD** in the output.

[comment]: # 'step {"find": "HELLO WORLD"}'
[comment]: # "test end"
2 changes: 1 addition & 1 deletion dev/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ main();
*/
async function main() {
const json = {
input: "dev/doc-content.dita",
input: "dev/doc-content.md",
logLevel: "debug",
runOn: [
{
Expand Down
33 changes: 32 additions & 1 deletion src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,26 +320,57 @@ let defaultFileTypes = {
testStart: [
"{\\/\\*\\s*test\\s+?([\\s\\S]*?)\\s*\\*\\/}",
"<!--\\s*test\\s*([\\s\\S]*?)\\s*-->",
// CommonMark comment syntax with parentheses: [comment]: # (test ...)
"\\[comment\\]:\\s+#\\s+\\(test\\s*(.*?)\\s*\\)",
"\\[comment\\]:\\s+#\\s+\\(test start\\s*(.*?)\\s*\\)",
// CommonMark comment syntax with single quotes: [comment]: # 'test ...'
"\\[comment\\]:\\s+#\\s+'test\\s*(.*?)\\s*'",
"\\[comment\\]:\\s+#\\s+'test start\\s*(.*?)\\s*'",
// CommonMark comment syntax with double quotes: [comment]: # "test ..."
// Uses (?:[^"\\]|\\.)* to handle escaped quotes within the content
'\\[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*-->",
// CommonMark comment syntax with parentheses
"\\[comment\\]:\\s+#\\s+\\(test end\\)",
// CommonMark comment syntax with single quotes
"\\[comment\\]:\\s+#\\s+'test end'",
// CommonMark comment syntax with double quotes
'\\[comment\\]:\\s+#\\s+"test end"',
],
ignoreStart: [
"{\\/\\*\\s*test ignore start\\s*\\*\\/}",
"<!--\\s*test ignore start\\s*-->",
// CommonMark comment syntax with parentheses
"\\[comment\\]:\\s+#\\s+\\(test ignore start\\)",
// CommonMark comment syntax with single quotes
"\\[comment\\]:\\s+#\\s+'test ignore start'",
// CommonMark comment syntax with double quotes
'\\[comment\\]:\\s+#\\s+"test ignore start"',
],
ignoreEnd: [
"{\\/\\*\\s*test ignore end\\s*\\*\\/}",
"<!--\\s*test ignore end\\s*-->",
// CommonMark comment syntax with parentheses
"\\[comment\\]:\\s+#\\s+\\(test ignore end\\)",
// CommonMark comment syntax with single quotes
"\\[comment\\]:\\s+#\\s+'test ignore end'",
// CommonMark comment syntax with double quotes
'\\[comment\\]:\\s+#\\s+"test ignore end"',
],
step: [
"{\\/\\*\\s*step\\s+?([\\s\\S]*?)\\s*\\*\\/}",
"<!--\\s*step\\s*([\\s\\S]*?)\\s*-->",
// CommonMark comment syntax with parentheses: [comment]: # (step ...)
"\\[comment\\]:\\s+#\\s+\\(step\\s*(.*?)\\s*\\)",
// CommonMark comment syntax with single quotes: [comment]: # 'step ...'
"\\[comment\\]:\\s+#\\s+'step\\s*(.*?)\\s*'",
// CommonMark comment syntax with double quotes: [comment]: # "step ..."
// Uses (?:[^"\\]|\\.)* to handle escaped quotes within the content
'\\[comment\\]:\\s+#\\s+"step\\s*((?:[^"\\\\]|\\\\.)*)\\s*"',
],
},
markup: [
Expand Down Expand Up @@ -472,7 +503,7 @@ async function setConfig({ config }) {
} catch (error) {
log(
config,
"warn",
"warning",
`Invalid JSON in DOC_DETECTIVE environment variable: ${error.message}. Ignoring config overrides.`
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ describe("envMerge", function () {

// Should continue normally without applying overrides
expect(validStub.calledOnce).to.be.true;
expect(logStub.calledWith(sinon.match.any, "warn", sinon.match.string)).to.be.true;
expect(logStub.calledWith(sinon.match.any, "warning", sinon.match.string)).to.be.true;
});

it("should handle DOC_DETECTIVE environment variable without config property", async function () {
Expand Down
Loading
Loading