Skip to content

Commit 028affc

Browse files
committed
feat(lift-results): enable language results to be passed to vcs-host lifters
1 parent 7c13cf1 commit 028affc

File tree

4 files changed

+33
-7
lines changed

4 files changed

+33
-7
lines changed

src/scaffolder.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export async function scaffold(options) {
6363
projectRoot,
6464
vcs: vcsResults.vcs,
6565
results: mergedResults,
66-
enhancers: {...dependencyUpdaters, ...vcsHosts, ...languages}
66+
enhancers: {...dependencyUpdaters, ...languages, ...vcsHosts}
6767
});
6868

6969
if (language && language.verificationCommand) {

test/integration/features/scaffold/git.feature

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ Feature: Git Repository
1616
Scenario: to be versioned and hosted
1717
Given the project should be versioned in git
1818
And the git repository will be hosted
19+
And a language scaffolder is chosen
1920
When the project is scaffolded
2021
Then the remote origin is defined
22+
And the project repository is hosted on the chosen host
2123

2224
Scenario: already versioned
2325
Given the project root is already initialized as a git repository

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

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ When(/^the project is scaffolded$/, async function () {
5151

5252
this.projectName = 'project-name';
5353
this.projectDescription = any.sentence();
54+
this.projectHomepage = any.url();
5455

55-
this.languageLiftResults = any.simpleObject();
56+
this.languageLiftResults = {...any.simpleObject(), homepage: this.projectHomepage};
5657

5758
await scaffold({
5859
plugins: {
@@ -85,9 +86,23 @@ When(/^the project is scaffolded$/, async function () {
8586
...vcsHost && 'Other' !== vcsHost && {
8687
vcsHosts: {
8788
[vcsHost]: {
88-
scaffold: ({projectName, owner}) => ({
89-
vcs: {sshUrl: this.remoteOriginUrl, name: projectName, owner, host: vcsHost}
90-
})
89+
scaffold: ({projectName, owner}) => {
90+
this.hostedVcsDetails = {name: projectName, host: vcsHost};
91+
92+
return ({
93+
vcs: {sshUrl: this.remoteOriginUrl, name: projectName, owner, host: vcsHost}
94+
});
95+
},
96+
test: ({projectRoot}) => {
97+
info(`Determining if project at ${projectRoot} uses the ${vcsHost} VCS host`);
98+
99+
return true;
100+
},
101+
lift: ({results}) => {
102+
this.vcsHostProjectHomepage = results.homepage;
103+
104+
return results;
105+
}
91106
}
92107
}
93108
}
Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
1-
import {Given} from '@cucumber/cucumber';
1+
import {Given, Then} from '@cucumber/cucumber';
22
import any from '@travi/any';
3+
import {assert} from 'chai';
34

45
import {questionNames} from '../../../../../src/prompts/question-names.js';
56

67
Given('the git repository will be hosted', async function () {
7-
this.setAnswerFor(questionNames.REPO_HOST, any.word());
8+
const vcsHost = any.word();
9+
10+
this.setAnswerFor(questionNames.REPO_HOST, vcsHost);
811
this.remoteOriginUrl = any.url();
12+
this.repoHost = vcsHost;
913
});
1014

1115
Given('the repository is hosted on {string}', async function (host) {
1216
this.repoHost = host;
1317
this.vcsOwner = any.word();
1418
this.vcsName = any.word();
1519
});
20+
21+
Then('the project repository is hosted on the chosen host', async function () {
22+
assert.deepEqual(this.hostedVcsDetails, {name: this.projectName, host: this.repoHost});
23+
assert.equal(this.vcsHostProjectHomepage, this.projectHomepage);
24+
});

0 commit comments

Comments
 (0)