Skip to content

Commit 86d5c0e

Browse files
committed
feat(metadata): defined the conventional tag for octoherd-script projects
1 parent b1f0e85 commit 86d5c0e

File tree

5 files changed

+16
-4
lines changed

5 files changed

+16
-4
lines changed

src/scaffolder-test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ suite('scaffold script', () => {
2020
test('that the script is scaffolded', async () => {
2121
const projectRoot = any.string();
2222

23-
await scaffold({projectRoot});
23+
const {tags} = await scaffold({projectRoot});
2424

2525
assert.calledWith(fs.writeFile, `${projectRoot}/index.js`, 'export async function script(octokit, repository) {}');
26+
assert.deepEqual(tags, ['octoherd-script']);
2627
});
2728
});

src/scaffolder.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import {promises as fs} from 'fs';
22

3-
export default function ({projectRoot}) {
4-
return fs.writeFile(`${projectRoot}/index.js`, 'export async function script(octokit, repository) {}');
3+
export default async function ({projectRoot}) {
4+
await fs.writeFile(`${projectRoot}/index.js`, 'export async function script(octokit, repository) {}');
5+
6+
return {tags: ['octoherd-script']};
57
}

test/integration/features/scaffolder.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ Feature: Scaffolder
33
Scenario: Scaffold
44
When the project is scaffolded
55
Then the script file is bootstrapped
6+
And project metadata is generated

test/integration/features/step_definitions/common-steps.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ When('the project is scaffolded', async function () {
2323
node_modules: stubbedNodeModules
2424
});
2525

26-
await scaffold({projectRoot: this.projectRoot});
26+
this.result = await scaffold({projectRoot: this.projectRoot});
2727
});
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import {Then} from '@cucumber/cucumber';
2+
import {assert} from 'chai';
3+
4+
Then('project metadata is generated', async function () {
5+
const {tags} = this.result;
6+
7+
assert.deepEqual(tags, ['octoherd-script']);
8+
});

0 commit comments

Comments
 (0)