Skip to content

Commit

Permalink
feat(metadata): defined the conventional tag for octoherd-script proj…
Browse files Browse the repository at this point in the history
…ects
  • Loading branch information
travi committed Dec 28, 2022
1 parent b1f0e85 commit 86d5c0e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/scaffolder-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ suite('scaffold script', () => {
test('that the script is scaffolded', async () => {
const projectRoot = any.string();

await scaffold({projectRoot});
const {tags} = await scaffold({projectRoot});

assert.calledWith(fs.writeFile, `${projectRoot}/index.js`, 'export async function script(octokit, repository) {}');
assert.deepEqual(tags, ['octoherd-script']);
});
});
6 changes: 4 additions & 2 deletions src/scaffolder.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import {promises as fs} from 'fs';

export default function ({projectRoot}) {
return fs.writeFile(`${projectRoot}/index.js`, 'export async function script(octokit, repository) {}');
export default async function ({projectRoot}) {
await fs.writeFile(`${projectRoot}/index.js`, 'export async function script(octokit, repository) {}');

return {tags: ['octoherd-script']};
}
1 change: 1 addition & 0 deletions test/integration/features/scaffolder.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ Feature: Scaffolder
Scenario: Scaffold
When the project is scaffolded
Then the script file is bootstrapped
And project metadata is generated
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ When('the project is scaffolded', async function () {
node_modules: stubbedNodeModules
});

await scaffold({projectRoot: this.projectRoot});
this.result = await scaffold({projectRoot: this.projectRoot});
});
8 changes: 8 additions & 0 deletions test/integration/features/step_definitions/metadata-steps.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {Then} from '@cucumber/cucumber';
import {assert} from 'chai';

Then('project metadata is generated', async function () {
const {tags} = this.result;

assert.deepEqual(tags, ['octoherd-script']);
});

0 comments on commit 86d5c0e

Please sign in to comment.