Skip to content

Commit

Permalink
fix(cargo-workspace): find workspace modules on the target branch (#1889
Browse files Browse the repository at this point in the history
)
  • Loading branch information
chingor13 authored Mar 28, 2023
1 parent faa52d3 commit 9647941
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 41 deletions.
2 changes: 1 addition & 1 deletion src/plugins/cargo-workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class CargoWorkspace extends WorkspacePlugin<CrateInfo> {
const members = (
await Promise.all(
cargoManifest.workspace.members.map(member =>
this.github.findFilesByGlob(member)
this.github.findFilesByGlobAndRef(member, this.targetBranch)
)
)
).flat();
Expand Down
74 changes: 37 additions & 37 deletions test/plugins/cargo-workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ describe('CargoWorkspace plugin', () => {
},
});
sandbox
.stub(github, 'findFilesByGlob')
.withArgs('packages/rustA')
.stub(github, 'findFilesByGlobAndRef')
.withArgs('packages/rustA', 'main')
.resolves(['packages/rustA']);
const newCandidates = await plugin.run(candidates);
expect(newCandidates).lengthOf(2);
Expand Down Expand Up @@ -173,10 +173,10 @@ describe('CargoWorkspace plugin', () => {
],
});
sandbox
.stub(github, 'findFilesByGlob')
.withArgs('packages/rustA')
.stub(github, 'findFilesByGlobAndRef')
.withArgs('packages/rustA', 'main')
.resolves(['packages/rustA'])
.withArgs('packages/rustD')
.withArgs('packages/rustD', 'main')
.resolves(['packages/rustD']);
plugin = new CargoWorkspace(github, 'main', {
'packages/rustA': {
Expand Down Expand Up @@ -228,8 +228,8 @@ describe('CargoWorkspace plugin', () => {
inlineFiles: [['Cargo.toml', '[workspace]\nmembers = ["packages/*"]']],
});
sandbox
.stub(github, 'findFilesByGlob')
.withArgs('packages/*')
.stub(github, 'findFilesByGlobAndRef')
.withArgs('packages/*', 'main')
.resolves(['packages/rustA', 'packages/rustD']);
plugin = new CargoWorkspace(github, 'main', {
'packages/rustA': {
Expand Down Expand Up @@ -287,16 +287,16 @@ describe('CargoWorkspace plugin', () => {
targetBranch: 'main',
});
sandbox
.stub(github, 'findFilesByGlob')
.withArgs('packages/rustA')
.stub(github, 'findFilesByGlobAndRef')
.withArgs('packages/rustA', 'main')
.resolves(['packages/rustA'])
.withArgs('packages/rustB')
.withArgs('packages/rustB', 'main')
.resolves(['packages/rustB'])
.withArgs('packages/rustC')
.withArgs('packages/rustC', 'main')
.resolves(['packages/rustC'])
.withArgs('packages/rustD')
.withArgs('packages/rustD', 'main')
.resolves(['packages/rustD'])
.withArgs('packages/rustE')
.withArgs('packages/rustE', 'main')
.resolves(['packages/rustE']);
const newCandidates = await plugin.run(candidates);
expect(newCandidates).lengthOf(1);
Expand Down Expand Up @@ -350,16 +350,16 @@ describe('CargoWorkspace plugin', () => {
targetBranch: 'main',
});
sandbox
.stub(github, 'findFilesByGlob')
.withArgs('packages/rustA')
.stub(github, 'findFilesByGlobAndRef')
.withArgs('packages/rustA', 'main')
.resolves(['packages/rustA'])
.withArgs('packages/rustB')
.withArgs('packages/rustB', 'main')
.resolves(['packages/rustB'])
.withArgs('packages/rustC')
.withArgs('packages/rustC', 'main')
.resolves(['packages/rustC'])
.withArgs('packages/rustD')
.withArgs('packages/rustD', 'main')
.resolves(['packages/rustD'])
.withArgs('packages/rustE')
.withArgs('packages/rustE', 'main')
.resolves(['packages/rustE']);
plugin = new CargoWorkspace(
github,
Expand Down Expand Up @@ -422,16 +422,16 @@ describe('CargoWorkspace plugin', () => {
targetBranch: 'main',
});
sandbox
.stub(github, 'findFilesByGlob')
.withArgs('packages/rustA')
.stub(github, 'findFilesByGlobAndRef')
.withArgs('packages/rustA', 'main')
.resolves(['packages/rustA'])
.withArgs('packages/rustB')
.withArgs('packages/rustB', 'main')
.resolves(['packages/rustB'])
.withArgs('packages/rustC')
.withArgs('packages/rustC', 'main')
.resolves(['packages/rustC'])
.withArgs('packages/rustD')
.withArgs('packages/rustD', 'main')
.resolves(['packages/rustD'])
.withArgs('packages/rustE')
.withArgs('packages/rustE', 'main')
.resolves(['packages/rustE']);
const newCandidates = await plugin.run(candidates);
expect(newCandidates).lengthOf(1);
Expand Down Expand Up @@ -474,16 +474,16 @@ describe('CargoWorkspace plugin', () => {
targetBranch: 'main',
});
sandbox
.stub(github, 'findFilesByGlob')
.withArgs('packages/rustA')
.stub(github, 'findFilesByGlobAndRef')
.withArgs('packages/rustA', 'main')
.resolves(['packages/rustA'])
.withArgs('packages/rustB')
.withArgs('packages/rustB', 'main')
.resolves(['packages/rustB'])
.withArgs('packages/rustC')
.withArgs('packages/rustC', 'main')
.resolves(['packages/rustC'])
.withArgs('packages/rustD')
.withArgs('packages/rustD', 'main')
.resolves(['packages/rustD'])
.withArgs('packages/rustE')
.withArgs('packages/rustE', 'main')
.resolves(['packages/rustE']);
const newCandidates = await plugin.run(candidates);
expect(newCandidates).lengthOf(1);
Expand Down Expand Up @@ -529,10 +529,10 @@ describe('CargoWorkspace plugin', () => {
],
});
sandbox
.stub(github, 'findFilesByGlob')
.withArgs('packages/rustA')
.stub(github, 'findFilesByGlobAndRef')
.withArgs('packages/rustA', 'main')
.resolves(['packages/rustA'])
.withArgs('packages/rustB')
.withArgs('packages/rustB', 'main')
.resolves(['packages/rustB']);
plugin = new CargoWorkspace(github, 'main', {
'packages/rustA': {
Expand Down Expand Up @@ -584,10 +584,10 @@ describe('CargoWorkspace plugin', () => {
],
});
sandbox
.stub(github, 'findFilesByGlob')
.withArgs('packages/rustA')
.stub(github, 'findFilesByGlobAndRef')
.withArgs('packages/rustA', 'main')
.resolves(['packages/rustA'])
.withArgs('packages/rustB')
.withArgs('packages/rustB', 'main')
.resolves(['packages/rustB']);
plugin = new CargoWorkspace(github, 'main', {
'packages/rustA': {
Expand Down
6 changes: 3 additions & 3 deletions test/plugins/compatibility/linked-versions-workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ describe('Plugin compatibility', () => {
],
});
sandbox
.stub(github, 'findFilesByGlob')
.withArgs('packages/rustA')
.stub(github, 'findFilesByGlobAndRef')
.withArgs('packages/rustA', 'main')
.resolves(['packages/rustA'])
.withArgs('packages/rustB')
.withArgs('packages/rustB', 'main')
.resolves(['packages/rustB']);
const manifest = new Manifest(
github,
Expand Down

0 comments on commit 9647941

Please sign in to comment.