Skip to content

Commit

Permalink
move check-enforcements back into test/support (#25462)
Browse files Browse the repository at this point in the history
* move check-enforcements back into test/support

introduced #25384
fixes #25454

* allow blueprint's test to set custom packagePath

fixes #25454

* adjust withParentBlueprintLookup test support

fixes #25454

* accept suggested chnages

* accept comment suggestion

Co-authored-by: Marcelo Shima <[email protected]>

---------

Co-authored-by: Marcelo Shima <[email protected]>
  • Loading branch information
dwarakaprasad and mshima authored Mar 12, 2024
1 parent a9369bd commit 4198698
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 35 deletions.
9 changes: 2 additions & 7 deletions generators/angular/generator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,8 @@ import { fileURLToPath } from 'url';
import { before, it, describe, after, expect } from 'esmocha';
import lodash from 'lodash';

import {
buildClientSamples,
checkEnforcements,
entitiesClientSamples as entities,
defaultHelpers as helpers,
} from '../../testing/index.js';
import { shouldSupportFeatures, testBlueprintSupport } from '../../test/support/tests.js';
import { buildClientSamples, entitiesClientSamples as entities, defaultHelpers as helpers } from '../../testing/index.js';
import { shouldSupportFeatures, testBlueprintSupport, checkEnforcements } from '../../test/support/index.js';
import Generator from './index.js';
import { clientFrameworkTypes } from '../../jdl/jhipster/index.js';
import { CLIENT_MAIN_SRC_DIR } from '../generator-constants.js';
Expand Down
4 changes: 2 additions & 2 deletions generators/client/generator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import { fileURLToPath } from 'url';
import assert from 'assert';
import lodash from 'lodash';
import { before, it, describe, expect } from 'esmocha';
import { shouldSupportFeatures, testBlueprintSupport } from '../../test/support/tests.js';
import { shouldSupportFeatures, testBlueprintSupport, checkEnforcements } from '../../test/support/index.js';
import Generator from './index.js';
import { defaultHelpers as helpers, checkEnforcements, result } from '../../testing/index.js';
import { defaultHelpers as helpers, result } from '../../testing/index.js';
import { testFrameworkTypes } from '../../jdl/jhipster/index.js';
import { GENERATOR_CLIENT } from '../generator-list.js';

Expand Down
4 changes: 2 additions & 2 deletions generators/common/generator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import { fileURLToPath } from 'url';
import { before, it, describe, expect } from 'esmocha';
import lodash from 'lodash';

import { defaultHelpers as helpers, basicHelpers, runResult, checkEnforcements } from '../../testing/index.js';
import { shouldSupportFeatures, testBlueprintSupport } from '../../test/support/tests.js';
import { defaultHelpers as helpers, basicHelpers, runResult } from '../../testing/index.js';
import { shouldSupportFeatures, testBlueprintSupport, checkEnforcements } from '../../test/support/index.js';
import Generator from './index.js';
import { GENERATOR_COMMON } from '../generator-list.js';

Expand Down
4 changes: 2 additions & 2 deletions generators/cypress/generator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import { fileURLToPath } from 'url';
import { before, it, describe, after, expect } from 'esmocha';
import lodash from 'lodash';
import { clientFrameworkTypes, testFrameworkTypes } from '../../jdl/jhipster/index.js';
import { fromMatrix, extendMatrix, AuthenticationTypeMatrix, checkEnforcements, defaultHelpers as helpers } from '../../testing/index.js';
import { shouldSupportFeatures, testBlueprintSupport } from '../../test/support/tests.js';
import { fromMatrix, extendMatrix, AuthenticationTypeMatrix, defaultHelpers as helpers } from '../../testing/index.js';
import { shouldSupportFeatures, testBlueprintSupport, checkEnforcements } from '../../test/support/index.js';
import Generator from './generator.js';
import { GENERATOR_CYPRESS } from '../generator-list.js';

Expand Down
4 changes: 2 additions & 2 deletions generators/feign-client/generator.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { basename, dirname } from 'path';
import { fileURLToPath } from 'url';
import { before, it, describe, expect } from 'esmocha';
import { checkEnforcements, defaultHelpers as helpers, runResult } from '../../testing/index.js';
import { shouldSupportFeatures, testBlueprintSupport } from '../../test/support/tests.js';
import { defaultHelpers as helpers, runResult } from '../../testing/index.js';
import { shouldSupportFeatures, testBlueprintSupport, checkEnforcements } from '../../test/support/index.js';
import Generator from '../server/index.js';

import { GENERATOR_FEIGN_CLIENT } from '../generator-list.js';
Expand Down
9 changes: 2 additions & 7 deletions generators/react/generator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,8 @@ import { fileURLToPath } from 'url';
import { before, it, describe, after, expect } from 'esmocha';
import lodash from 'lodash';

import {
buildClientSamples,
entitiesClientSamples as entities,
checkEnforcements,
defaultHelpers as helpers,
} from '../../testing/index.js';
import { shouldSupportFeatures, testBlueprintSupport } from '../../test/support/tests.js';
import { buildClientSamples, entitiesClientSamples as entities, defaultHelpers as helpers } from '../../testing/index.js';
import { shouldSupportFeatures, testBlueprintSupport, checkEnforcements } from '../../test/support/index.js';
import Generator from './index.js';

import { clientFrameworkTypes } from '../../jdl/jhipster/index.js';
Expand Down
4 changes: 2 additions & 2 deletions generators/server/generator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import { fileURLToPath } from 'url';
import { before, it, describe, expect } from 'esmocha';
import lodash from 'lodash';

import { shouldSupportFeatures, testBlueprintSupport } from '../../test/support/tests.js';
import { defaultHelpers as helpers, checkEnforcements, result as runResult } from '../../testing/index.js';
import { shouldSupportFeatures, testBlueprintSupport, checkEnforcements } from '../../test/support/index.js';
import { defaultHelpers as helpers, result as runResult } from '../../testing/index.js';
import Generator from './index.js';
import { mockedGenerators, shouldComposeWithCouchbase, shouldComposeWithSpringCloudStream } from './__test-support/index.js';
import { GENERATOR_SERVER, GENERATOR_SPRING_BOOT } from '../generator-list.js';
Expand Down
4 changes: 2 additions & 2 deletions generators/spring-boot/generator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { basename, dirname } from 'path';
import { fileURLToPath } from 'url';
import { before, it, describe, expect } from 'esmocha';
import { snakeCase } from 'lodash-es';
import { checkEnforcements, defaultHelpers as helpers, runResult } from '../../testing/index.js';
import { shouldSupportFeatures, testBlueprintSupport } from '../../test/support/tests.js';
import { defaultHelpers as helpers, runResult } from '../../testing/index.js';
import { shouldSupportFeatures, testBlueprintSupport, checkEnforcements } from '../../test/support/index.js';
import Generator from '../server/index.js';

import { mockedGenerators } from '../server/__test-support/index.js';
Expand Down
9 changes: 2 additions & 7 deletions generators/vue/generator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,8 @@ import { fileURLToPath } from 'url';
import { before, it, describe, after, expect } from 'esmocha';
import lodash from 'lodash';

import {
buildClientSamples,
entitiesClientSamples as entities,
checkEnforcements,
defaultHelpers as helpers,
} from '../../testing/index.js';
import { shouldSupportFeatures, testBlueprintSupport } from '../../test/support/tests.js';
import { buildClientSamples, entitiesClientSamples as entities, defaultHelpers as helpers } from '../../testing/index.js';
import { shouldSupportFeatures, testBlueprintSupport, checkEnforcements } from '../../test/support/index.js';
import Generator from './index.js';

import { clientFrameworkTypes } from '../../jdl/jhipster/index.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import fs, { readFileSync } from 'fs';
import path, { basename } from 'path';
import fse from 'fs-extra';
import { describe, it, before } from 'mocha';
import { getGeneratorFolder } from '../get-generator.js';
import { getGeneratorFolder } from '../../testing/get-generator.js';

const fixEnforcements = process.argv.includes('--fix-enforcements');

Expand Down
2 changes: 2 additions & 0 deletions test/support/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default as checkEnforcements } from './check-enforcements.js';
export * from './tests.js';
3 changes: 3 additions & 0 deletions testing/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ class JHipsterRunContext extends RunContext<GeneratorTestType> {
const packageRootParent = join(getPackageRoot(), '..');
if (basename(packageRootParent) === 'node_modules') {
this.withLookups([{ packagePaths: [join(packageRootParent, '..')], lookups }] as any);
} else {
// Try to lookup at current path for linked generator-jhipster.
this.withLookups([{ packagePaths: [process.cwd()], lookups }] as any);
}
return this;
}
Expand Down
1 change: 0 additions & 1 deletion testing/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export * from './helpers.js';
// test matrix
export * from './support/application-samples.js';
export * from './support/client-samples.js';
export { default as checkEnforcements } from './support/check-enforcements.js';
export * from './support/entity-samples.js';
export * from './support/matrix-utils.js';
export * from './support/matcher.js';
Expand Down

0 comments on commit 4198698

Please sign in to comment.