Skip to content

Commit

Permalink
Merge pull request #1851 from form8ion/alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
travi authored Jan 25, 2025
2 parents 6150d18 + 028affc commit bad2a50
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/scaffolder.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export async function scaffold(options) {
projectRoot,
vcs: vcsResults.vcs,
results: mergedResults,
enhancers: {...dependencyUpdaters, ...vcsHosts}
enhancers: {...dependencyUpdaters, ...languages, ...vcsHosts}
});

if (language && language.verificationCommand) {
Expand Down
2 changes: 1 addition & 1 deletion src/scaffolder.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ describe('project scaffolder', () => {
projectRoot: projectPath,
vcs,
results: mergedResults,
enhancers: {...dependencyUpdaters, ...vcsHosts}
enhancers: {...dependencyUpdaters, ...vcsHosts, ...languages}
});
expect(resultsReporter.reportResults).toHaveBeenCalledWith(mergedResults);
});
Expand Down
2 changes: 2 additions & 0 deletions test/integration/features/scaffold/git.feature
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ Feature: Git Repository
Scenario: to be versioned and hosted
Given the project should be versioned in git
And the git repository will be hosted
And a language scaffolder is chosen
When the project is scaffolded
Then the remote origin is defined
And the project repository is hosted on the chosen host

Scenario: already versioned
Given the project root is already initialized as a git repository
Expand Down
33 changes: 30 additions & 3 deletions test/integration/features/step_definitions/common-steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ When(/^the project is scaffolded$/, async function () {

this.projectName = 'project-name';
this.projectDescription = any.sentence();
this.projectHomepage = any.url();

this.languageLiftResults = {...any.simpleObject(), homepage: this.projectHomepage};

await scaffold({
plugins: {
Expand All @@ -66,16 +69,40 @@ When(/^the project is scaffolded$/, async function () {
info(`Scaffolding ${chosenLanguage} language details for ${projectName}`);

return this.languageScaffolderResults;
},
test: ({projectRoot}) => {
info(`Determining if project at ${projectRoot} uses the ${chosenLanguage} language`);

return true;
},
lift: ({projectRoot}) => {
info(`Applying the ${chosenLanguage} language lifter to the project at ${projectRoot}`);

return this.languageLiftResults;
}
}
}
},
...vcsHost && 'Other' !== vcsHost && {
vcsHosts: {
[vcsHost]: {
scaffold: ({projectName, owner}) => ({
vcs: {sshUrl: this.remoteOriginUrl, name: projectName, owner, host: vcsHost}
})
scaffold: ({projectName, owner}) => {
this.hostedVcsDetails = {name: projectName, host: vcsHost};

return ({
vcs: {sshUrl: this.remoteOriginUrl, name: projectName, owner, host: vcsHost}
});
},
test: ({projectRoot}) => {
info(`Determining if project at ${projectRoot} uses the ${vcsHost} VCS host`);

return true;
},
lift: ({results}) => {
this.vcsHostProjectHomepage = results.homepage;

return results;
}
}
}
}
Expand Down
13 changes: 11 additions & 2 deletions test/integration/features/step_definitions/vcs/vcs-host-steps.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
import {Given} from '@cucumber/cucumber';
import {Given, Then} from '@cucumber/cucumber';
import any from '@travi/any';
import {assert} from 'chai';

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

Given('the git repository will be hosted', async function () {
this.setAnswerFor(questionNames.REPO_HOST, any.word());
const vcsHost = any.word();

this.setAnswerFor(questionNames.REPO_HOST, vcsHost);
this.remoteOriginUrl = any.url();
this.repoHost = vcsHost;
});

Given('the repository is hosted on {string}', async function (host) {
this.repoHost = host;
this.vcsOwner = any.word();
this.vcsName = any.word();
});

Then('the project repository is hosted on the chosen host', async function () {
assert.deepEqual(this.hostedVcsDetails, {name: this.projectName, host: this.repoHost});
assert.equal(this.vcsHostProjectHomepage, this.projectHomepage);
});

0 comments on commit bad2a50

Please sign in to comment.