Skip to content

Commit

Permalink
rename exceptFilter to filter
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima committed Jul 3, 2024
1 parent d96b7aa commit 3b0c0d9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions test/support/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ export const testBlueprintSupport = (generatorName, options = {}) => {
before(async () => {
result = await helpers
.run(generatorPath)
.withMockedJHipsterGenerators({ exceptFilter: () => true })
.withMockedJHipsterGenerators({ filter: () => true })
.withMockedGenerators([`jhipster-foo:${generatorName}`])
.withJHipsterConfig()
.withOptions({ blueprint: 'foo' })
Expand All @@ -301,7 +301,7 @@ export const testBlueprintSupport = (generatorName, options = {}) => {
}
const context = helpers
.run(generatorPath)
.withMockedJHipsterGenerators({ exceptFilter: () => true })
.withMockedJHipsterGenerators({ filter: () => true })
.withMockedGenerators([`jhipster-foo-sbs:${generatorName}`])
.withJHipsterConfig(
{},
Expand Down
8 changes: 4 additions & 4 deletions testing/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,14 @@ class JHipsterRunContext extends RunContext<GeneratorTestType> {
* withMockedJHipsterGenerators({ except: ['bootstrap', 'server'] })
* @example
* // Mock every generator including bootstrap-*
* withMockedJHipsterGenerators({ exceptFilter: () => true })
* withMockedJHipsterGenerators({ filter: () => true })
*/
withMockedJHipsterGenerators(options: string[] | { except?: string[]; exceptFilter?: (string) => boolean } = {}): this {
withMockedJHipsterGenerators(options: string[] | { except?: string[]; filter?: (string) => boolean } = {}): this {
const optionsObj = Array.isArray(options) ? { except: options } : options;
const { except = [], exceptFilter = filterBootstrapGenerators } = optionsObj;
const { except = [], filter = filterBootstrapGenerators } = optionsObj;
const jhipsterExceptList = except.map(gen => (gen.startsWith('jhipster:') ? gen : `jhipster:${gen}`));
return this.withMockedGenerators(
allGenerators.filter(exceptFilter).filter(gen => !jhipsterExceptList.includes(gen) && (this as any).Generator !== gen),
allGenerators.filter(filter).filter(gen => !jhipsterExceptList.includes(gen) && (this as any).Generator !== gen),
);
}

Expand Down

0 comments on commit 3b0c0d9

Please sign in to comment.