Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve test defaults #24232

Merged
merged 2 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .mocharc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ module.exports = {
timeout: 50000,
ui: 'bdd',
extension: ['js', 'spec.cjs', 'spec.mjs', 'spec.ts', 'spec.mts'],
require: ['test/mocha.config.cjs'],
// Resolve absolute path for test with fork and different cwd.
// `loader` options is passed to forks, but `require` is not.
// Use node-option instead (it overrides loader option)
Expand Down
1 change: 1 addition & 0 deletions generators/base-application/generator.mts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export default class BaseApplicationGenerator<
});

if (this.options.applicationWithEntities) {
this.log.warn('applicationWithEntities option is deprecated');
// Write new definitions to memfs
this.config.set({
...this.config.getAll(),
Expand Down
3 changes: 3 additions & 0 deletions generators/base/api.d.mts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export type JHipsterGeneratorOptions = BaseOptions & {
/* base options */
applicationId?: string;
applicationWithConfig?: ApplicationWithConfig;
/**
* @deprecated
*/
applicationWithEntities?: any;
creationTimestamp?: string;
ignoreErrors?: boolean;
Expand Down
1 change: 1 addition & 0 deletions generators/bootstrap-application-base/generator.spec.mts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ describe(`generator - ${generator}`, () => {
"contents": "{
"generator-jhipster": {
"baseName": "jhipster",
"creationTimestamp": 1577836800000,
"entities": []
}
}
Expand Down
1 change: 1 addition & 0 deletions generators/bootstrap-application-client/generator.spec.mts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ describe(`generator - ${generator}`, () => {
"contents": "{
"generator-jhipster": {
"baseName": "jhipster",
"creationTimestamp": 1577836800000,
"entities": []
}
}
Expand Down
1 change: 1 addition & 0 deletions generators/bootstrap-application-server/generator.spec.mts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ describe(`generator - ${generator}`, () => {
"contents": "{
"generator-jhipster": {
"baseName": "jhipster",
"creationTimestamp": 1577836800000,
"entities": []
}
}
Expand Down
27 changes: 27 additions & 0 deletions generators/ci-cd/__snapshots__/ci-cd.spec.mts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ exports[`generator - CI-CD Azure Pipelines tests Azure Pipelines: Gradle Angular
"generator-jhipster": {
"baseName": "sampleMysql",
"buildTool": "gradle",
"creationTimestamp": 1577836800000,
"entities": [],
"testFrameworks": ["cypress"]
}
Expand Down Expand Up @@ -121,6 +122,7 @@ exports[`generator - CI-CD Azure Pipelines tests Azure Pipelines: Gradle Angular
"generator-jhipster": {
"baseName": "sampleMysql",
"buildTool": "gradle",
"creationTimestamp": 1577836800000,
"entities": [],
"testFrameworks": ["cypress"]
}
Expand Down Expand Up @@ -247,6 +249,7 @@ exports[`generator - CI-CD Azure Pipelines tests Azure Pipelines: Maven Angular
"generator-jhipster": {
"baseName": "sampleMysql",
"buildTool": "maven",
"creationTimestamp": 1577836800000,
"entities": [],
"testFrameworks": ["cypress"]
}
Expand Down Expand Up @@ -361,6 +364,7 @@ exports[`generator - CI-CD Azure Pipelines tests Azure Pipelines: Maven Angular
"generator-jhipster": {
"baseName": "sampleMysql",
"buildTool": "maven",
"creationTimestamp": 1577836800000,
"entities": [],
"testFrameworks": ["cypress"]
}
Expand Down Expand Up @@ -487,6 +491,7 @@ exports[`generator - CI-CD Azure Pipelines tests Azure Pipelines: autoconfigure
"generator-jhipster": {
"baseName": "sampleMysql",
"buildTool": "maven",
"creationTimestamp": 1577836800000,
"entities": [],
"testFrameworks": ["cypress"]
}
Expand Down Expand Up @@ -661,6 +666,7 @@ jobs:
"generator-jhipster": {
"baseName": "sampleMysql",
"buildTool": "gradle",
"creationTimestamp": 1577836800000,
"entities": [],
"testFrameworks": ["cypress"]
}
Expand Down Expand Up @@ -749,6 +755,7 @@ jobs:
"generator-jhipster": {
"baseName": "sampleMysql",
"buildTool": "gradle",
"creationTimestamp": 1577836800000,
"entities": [],
"testFrameworks": ["cypress"]
}
Expand Down Expand Up @@ -826,6 +833,7 @@ jobs:
"generator-jhipster": {
"baseName": "sampleMysql",
"buildTool": "maven",
"creationTimestamp": 1577836800000,
"entities": [],
"testFrameworks": ["cypress"]
}
Expand Down Expand Up @@ -914,6 +922,7 @@ jobs:
"generator-jhipster": {
"baseName": "sampleMysql",
"buildTool": "maven",
"creationTimestamp": 1577836800000,
"entities": [],
"testFrameworks": ["cypress"]
}
Expand Down Expand Up @@ -986,6 +995,7 @@ jobs:
"generator-jhipster": {
"baseName": "sampleMysql",
"buildTool": "gradle",
"creationTimestamp": 1577836800000,
"entities": [],
"testFrameworks": ["cypress"]
}
Expand Down Expand Up @@ -1098,6 +1108,7 @@ jobs:
"generator-jhipster": {
"baseName": "sampleMysql",
"buildTool": "gradle",
"creationTimestamp": 1577836800000,
"entities": [],
"testFrameworks": ["cypress"]
}
Expand Down Expand Up @@ -1207,6 +1218,7 @@ jobs:
"generator-jhipster": {
"baseName": "sampleMysql",
"buildTool": "maven",
"creationTimestamp": 1577836800000,
"entities": [],
"testFrameworks": ["cypress"]
}
Expand Down Expand Up @@ -1313,6 +1325,7 @@ jobs:
"generator-jhipster": {
"baseName": "sampleMysql",
"buildTool": "maven",
"creationTimestamp": 1577836800000,
"entities": [],
"testFrameworks": ["cypress"]
}
Expand Down Expand Up @@ -1441,6 +1454,7 @@ jobs:
"generator-jhipster": {
"baseName": "sampleMysql",
"buildTool": "maven",
"creationTimestamp": 1577836800000,
"entities": [],
"testFrameworks": ["cypress"]
}
Expand Down Expand Up @@ -1549,6 +1563,7 @@ gradle-package:
"generator-jhipster": {
"baseName": "sampleMysql",
"buildTool": "gradle",
"creationTimestamp": 1577836800000,
"entities": [],
"testFrameworks": ["cypress"]
}
Expand Down Expand Up @@ -1685,6 +1700,7 @@ deploy-to-production:
"generator-jhipster": {
"baseName": "sampleMysql",
"buildTool": "maven",
"creationTimestamp": 1577836800000,
"entities": [],
"testFrameworks": ["cypress"]
}
Expand Down Expand Up @@ -1805,6 +1821,7 @@ maven-package:
"generator-jhipster": {
"baseName": "sampleMysql",
"buildTool": "maven",
"creationTimestamp": 1577836800000,
"entities": [],
"testFrameworks": ["cypress"]
}
Expand Down Expand Up @@ -1931,6 +1948,7 @@ deploy-to-production:
"generator-jhipster": {
"baseName": "sampleMysql",
"buildTool": "maven",
"creationTimestamp": 1577836800000,
"entities": [],
"testFrameworks": ["cypress"]
}
Expand Down Expand Up @@ -2061,6 +2079,7 @@ maven-package:
"generator-jhipster": {
"baseName": "sampleMysql",
"buildTool": "maven",
"creationTimestamp": 1577836800000,
"entities": [],
"testFrameworks": ["cypress"]
}
Expand Down Expand Up @@ -2196,6 +2215,7 @@ webapp-prod:
"generator-jhipster": {
"baseName": "jhipster",
"buildTool": "maven",
"creationTimestamp": 1577836800000,
"entities": [],
"skipServer": true
}
Expand All @@ -2213,6 +2233,7 @@ exports[`generator - CI-CD Jenkins tests Jenkins: Gradle Angular NPM should matc
"generator-jhipster": {
"baseName": "sampleMysql",
"buildTool": "gradle",
"creationTimestamp": 1577836800000,
"entities": [],
"testFrameworks": ["cypress"]
}
Expand Down Expand Up @@ -2395,6 +2416,7 @@ exports[`generator - CI-CD Jenkins tests Jenkins: Maven Angular NPM inside Docke
"generator-jhipster": {
"baseName": "sampleMysql",
"buildTool": "maven",
"creationTimestamp": 1577836800000,
"entities": [],
"testFrameworks": ["cypress"]
}
Expand Down Expand Up @@ -2669,6 +2691,7 @@ exports[`generator - CI-CD Jenkins tests Jenkins: Maven Angular NPM should match
"generator-jhipster": {
"baseName": "sampleMysql",
"buildTool": "maven",
"creationTimestamp": 1577836800000,
"entities": [],
"testFrameworks": ["cypress"]
}
Expand Down Expand Up @@ -2854,6 +2877,7 @@ exports[`generator - CI-CD Jenkins tests Jenkins: Maven Angular NPM with full op
"generator-jhipster": {
"baseName": "sampleMysql",
"buildTool": "maven",
"creationTimestamp": 1577836800000,
"entities": [],
"testFrameworks": ["cypress"]
}
Expand Down Expand Up @@ -3180,6 +3204,7 @@ notifications:
"generator-jhipster": {
"baseName": "sampleMysql",
"buildTool": "gradle",
"creationTimestamp": 1577836800000,
"entities": [],
"testFrameworks": ["cypress"]
}
Expand Down Expand Up @@ -3253,6 +3278,7 @@ notifications:
"generator-jhipster": {
"baseName": "sampleMysql",
"buildTool": "maven",
"creationTimestamp": 1577836800000,
"entities": [],
"testFrameworks": ["cypress"]
}
Expand Down Expand Up @@ -3332,6 +3358,7 @@ notifications:
"generator-jhipster": {
"baseName": "sampleMysql",
"buildTool": "maven",
"creationTimestamp": 1577836800000,
"entities": [],
"testFrameworks": ["cypress"]
}
Expand Down
1 change: 1 addition & 0 deletions generators/common/__snapshots__/generator.spec.mjs.snap
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ overrides:
"contents": "{
"generator-jhipster": {
"baseName": "jhipster",
"creationTimestamp": 1577836800000,
"entities": []
}
}
Expand Down
1 change: 1 addition & 0 deletions generators/cucumber/__snapshots__/generator.spec.mts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ exports[`generator - cucumber with default config should match files snapshot 1`
"contents": "{
"generator-jhipster": {
"baseName": "jhipster",
"creationTimestamp": 1577836800000,
"entities": [],
"testFrameworks": [
"cucumber"
Expand Down
36 changes: 16 additions & 20 deletions generators/entities/generator.spec.mts
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,20 @@ describe(`generator - ${generator}`, () => {
describe('blueprint support', () => testBlueprintSupport(generator));

context('regenerating', () => {
const applicationWithEntities = {
entities: [
{
name: 'Foo',
changelogDate: '20160926101210',
},
{
name: 'Bar',
changelogDate: '20160926101211',
},
{
name: 'Skip',
changelogDate: '20160926101212',
},
],
};
const entities = [
{
name: 'Foo',
changelogDate: '20160926101210',
},
{
name: 'Bar',
changelogDate: '20160926101211',
},
{
name: 'Skip',
changelogDate: '20160926101212',
},
];

const fooFiles = [
`${SERVER_MAIN_RES_DIR}config/liquibase/changelog/20160926101210_added_entity_Foo.xml`,
Expand All @@ -79,13 +77,12 @@ describe(`generator - ${generator}`, () => {
before(async () => {
await helpers
.run(generatorPath)
.withJHipsterConfig()
.withJHipsterConfig({}, entities)
.withArguments(['Foo', 'Bar'])
.withOptions({
regenerate: true,
force: true,
ignoreNeedlesError: true,
applicationWithEntities,
})
.withMockedSource();
});
Expand Down Expand Up @@ -115,12 +112,11 @@ describe(`generator - ${generator}`, () => {
before(async () => {
await helpers
.run(generatorPath)
.withJHipsterConfig()
.withJHipsterConfig({}, entities)
.withOptions({
regenerate: true,
force: true,
ignoreNeedlesError: true,
applicationWithEntities,
})
.withMockedSource();
});
Expand Down
2 changes: 2 additions & 0 deletions generators/export-jdl/__snapshots__/export-jdl.spec.mts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ exports[`generator - export-jdl exports entities to a JDL file with file argumen
baseName standard
buildTool gradle
cacheProvider ehcache
creationTimestamp 1577836800000
databaseType sql
devDatabaseType h2Memory
enableHibernateCache true
Expand Down Expand Up @@ -127,6 +128,7 @@ exports[`generator - export-jdl exports entities to a JDL file without argument
baseName standard
buildTool gradle
cacheProvider ehcache
creationTimestamp 1577836800000
databaseType sql
devDatabaseType h2Memory
enableHibernateCache true
Expand Down
1 change: 1 addition & 0 deletions generators/gatling/__snapshots__/generator.spec.mts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ exports[`generator - gatling with default config should match files snapshot 1`]
"contents": "{
"generator-jhipster": {
"baseName": "jhipster",
"creationTimestamp": 1577836800000,
"entities": []
}
}
Expand Down
Loading
Loading