Skip to content

Commit

Permalink
fix filter check to allow firestore targets (#4722)
Browse files Browse the repository at this point in the history
* allow filter targets for firestore

* changelog

* better error message, fix tests

* loosen error checking

* fix tests for once and all
  • Loading branch information
bkendall committed Jul 8, 2022
1 parent b908476 commit bb64f99
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Fixes issue where `firestore:*` did not work with `--only` in `deploy`. (#4698)
4 changes: 2 additions & 2 deletions src/checkValidTargetFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ export async function checkValidTargetFilters(options: Options): Promise<void> {
return reject(new FirebaseError("Cannot specify both --only and --except"));
}
const nonFilteredTypes = VALID_DEPLOY_TARGETS.filter(
(t) => !["hosting", "functions"].includes(t)
(t) => !["hosting", "functions", "firestore"].includes(t)
);
const targetsForNonFilteredTypes = targetsForTypes(only, ...nonFilteredTypes);
if (targetsForNonFilteredTypes.length && targetsHaveFilters(...targetsForNonFilteredTypes)) {
return reject(
new FirebaseError(
"Filters specified with colons (e.g. --only functions:func1,functions:func2) are only supported for functions and hosting"
"Filters specified with colons (e.g. --only functions:func1,functions:func2) are only supported for functions, hosting, and firestore"
)
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/checkValidTargetFilters.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const SAMPLE_OPTIONS: Options = {
filteredTargets: [],
rc: new RC(),
};
const UNFILTERABLE_TARGETS = ["database", "storage", "firestore", "remoteconfig", "extensions"];
const UNFILTERABLE_TARGETS = ["database", "storage", "remoteconfig", "extensions"];

describe("checkValidTargetFilters", () => {
it("should resolve", async () => {
Expand Down Expand Up @@ -54,7 +54,7 @@ describe("checkValidTargetFilters", () => {
except: null,
});
await expect(checkValidTargetFilters(options)).to.be.rejectedWith(
"Filters specified with colons (e.g. --only functions:func1,functions:func2) are only supported for functions and hosting"
/Filters specified with colons \(e.g. --only functions:func1,functions:func2\) are only supported for .*/
);
});
});
Expand Down

0 comments on commit bb64f99

Please sign in to comment.