generator-ui5-project icon indicating copy to clipboard operation
generator-ui5-project copied to clipboard

Feat add specific unit and opa5 test templates

Open heimwege opened this issue 1 year ago • 9 comments

In case the project is a TypeScript project the generator should generate .ts files for opa5 and unit tests

Out of scope for this PR: In case the project is a Fiori Elements (fpmpage) project the generator should make use of sap.fe.test in the generated opa5 tests

Depends on https://github.com/SAP/open-ux-tools/pull/2164

heimwege avatar Jul 16 '24 08:07 heimwege

Looks good!

Does this mean we should merge this and https://github.com/SAP/open-ux-tools/pull/2164 at the same time? Or merge the open-ux-tools first and make sure this generator uses the latest version after its release?

nicoschoenteich avatar Jul 16 '24 09:07 nicoschoenteich

Looks good!

Does this mean we should merge this and SAP/open-ux-tools#2164 at the same time? Or merge the open-ux-tools first and make sure this generator uses the latest version after its release?

I would wait till the preview-middleware fix is in. Won't take that long 🤞🏻

heimwege avatar Jul 16 '24 12:07 heimwege

Thanks for the newest commits. Just waiting for https://github.com/SAP/open-ux-tools/pull/2164 and will merge after that.

nicoschoenteich avatar Jul 18 '24 07:07 nicoschoenteich

@nicoschoenteich luckily we waited. I'll adjust the templates according to what @petermuessig just implemented 🐱

UPDATE: now that I had a look at it it's not relevant for the templates because everything that changed is served via preview-middleware 🥳

heimwege avatar Jul 22 '24 12:07 heimwege

@nicoschoenteich I just merged https://github.com/SAP/open-ux-tools/pull/2164 so 0.16.23 should be the right version for the preview middleware but I don't find where it is maintained in the generator 🕵🏻 Or is it only an indirect dependency of @sap/ux-ui5-tooling? For testing purposes I added it to the package.json of the generated ui app and everything seems to work with the ts template. But please double check as well 😸

heimwege avatar Jul 24 '24 15:07 heimwege

@nicoschoenteich not sure what this error is all about 🤷🏻

npm error Lifecycle script `ts-typecheck` failed with error:
npm error Error: command failed
npm error   in workspace: [email protected]
npm error   at location: /home/runner/work/generator-ui5-project/generator-ui5-project/test-output/com.myorg.myui5project/myui5app
npm error Lifecycle script `build` failed with error:
npm error Error: command failed
npm error   in workspace: [email protected]
npm error   at location: /home/runner/work/generator-ui5-project/generator-ui5-project/test-output/com.myorg.myui5project/myui5app
make: *** [Makefile_20241028135626.mta:28: pre_build] Error 1
Error: could not build the MTA project: could not execute the "make -f Makefile_20241028135626.mta p=cf mtar=com.myorg.myui5project.mtar strict=true mode=" command: exit status 2

      at checkExecSyncError (node:child_process:890:11)
      at execSync (node:child_process:962:15)
      at Context.<anonymous> (file:///home/runner/work/generator-ui5-project/generator-ui5-project/test/all-projects.js:162:11)
      at process.processImmediate (node:internal/timers:476:21)

heimwege avatar Oct 28 '24 14:10 heimwege

I think a new version of the template now runs tsc as part of a ts-typecheck script, so we would need tsc as a dev dependency if this.options.config.enableTypescript. I think this shouldn't be fixed here, but rather on the template side in @sap-ux/ui5-application-writer.

nicoschoenteich avatar Oct 28 '24 14:10 nicoschoenteich

I think a new version of the template now runs tsc as part of a ts-typecheck script, so we would need tsc as a dev dependency if this.options.config.enableTypescript. I think this shouldn't be fixed here, but rather on the template side in @sap-ux/ui5-application-writer.

The tsc command comes with the typescript package. And this is part of the core templates for typescript/package.json. So I would have expected it is already in 🤔

heimwege avatar Oct 28 '24 16:10 heimwege

You are right. This particular test also passes locally (after uninstalling typescript globally). Not sure what is going on here - we might just merge anyway. What do you think?

nicoschoenteich avatar Oct 28 '24 16:10 nicoschoenteich

@nicoschoenteich this PR is still open. Can it be merged?

heimwege avatar Jul 08 '25 21:07 heimwege

Hi @heimwege, as briefly discussed in the hall a minute ago, my apologies for letting this sit for so long. I was stupid enough to more or less the same changes myself beginning of this week, but merged your PR now. Thanks!

nicoschoenteich avatar Jul 09 '25 13:07 nicoschoenteich