Skip to content

Commit

Permalink
feature: write: nested: optional
Browse files Browse the repository at this point in the history
  • Loading branch information
coderaiser committed Aug 16, 2023
1 parent 1ae75ff commit 52145ff
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/write/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ import tryToCatch from 'try-to-catch';
export const writePlugin = async (name, {rule, fixture, report}) => {
const [isNested] = await tryToCatch(access, './package.json');

if (isNested) {
if (isNested)
return await writeNested(name, {
rule,
fixture,
report,
});
}

await writeSimple(name, {
rule,
Expand All @@ -36,6 +35,13 @@ export const writeNested = async (name, {rule, fixture, report}) => {
await writeNestedRule(name, rule);
await writeNestedFixtures(name, fixture);
await writeNestedTests(name, report);

await tryToCatch(writeNestedOptional, name, {
fixture,
});
};

export const writeNestedOptional = async (name, {fixture}) => {
await updateNestedIndex(name);
await updateOverallNestedFixtures(name, fixture);
await updateOverallNestedTest(name);
Expand Down

0 comments on commit 52145ff

Please sign in to comment.