We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 18441eb commit b29bb09Copy full SHA for b29bb09
test/getDraftTests.ts
@@ -20,9 +20,16 @@ function readTestFile(filepath: string): TestCase[] {
20
21
function getFilenameAttributes(filename: string) {
22
let relative = filename.split(/draft[^/]+\//).pop();
23
+ if (relative == null) {
24
+ throw new Error(`Error in spec generation. Failed parsing filename '${filename}'`)
25
+ }
26
relative = relative.replace(".json", "").replace(/^\//, "");
27
const attributes = relative.replace(".json", "").split("/");
- const optional = attributes[0] === "optional" ? attributes.shift() && true : false;
28
+ let optional = false;
29
+ if (attributes[0] === "optional") {
30
+ attributes.shift();
31
+ optional = true;
32
33
return { optional, name: attributes.join("-") };
34
}
35
0 commit comments