The entando-blueprint is the repository of the Entando Component Generator and is Entando's implementation of JHipster that allows users to quickly and efficiently generate the skeleton of an Entando Component in the Entando Component Repository
When I fixed the lint errors, I figured out that npm tests are still failing because of errors.
> Subgenerator entity of entando JHipster blueprint
> Sample test
> foo
> 1) "before all" hook for "it works"
> (node:16681) UnhandledPromiseRejectionWarning: Error: Copying template ui/widgets/detailsWidget/src/components/__tests__/EntityDetails.test.js.ejs failed. [TypeError: /Users/anthonyviard/projects/entando/fork/entando-blueprint/generators/entity-server/templates/ui/widgets/detailsWidget/src/components/__tests__/EntityDetails.test.js.ejs:14
> 12| const { getByText } = render(<<%= entityClass %>Details <%= entityInstance %>={<%= entityInstance %>Mock} />);
> 13| <%# TODO: THIS ONLY APPLIES IF THE DATA IS NOT SHOWN AS A DIFFERENT ITEM (e.g. Boolean as checkbox) #%>
> >> 14| <%_ const firstField = fields[0].fieldName; _%>
> 15| expect(getByText('entities.<%= entityInstance %>.<%= firstField %>')).toBeInTheDocument();
> 16| });
> 17| });
>
> Cannot read property 'fieldName' of undefined]
> at module.exports.error (node_modules/generator-jhipster/generators/generator-base.js:1590:15)
> at /Users/anthonyviard/projects/entando/fork/entando-blueprint/node_modules/generator-jhipster/generators/utils.js:256:23
> at tryHandleCache (node_modules/generator-jhipster/node_modules/ejs/lib/ejs.js:275:14)
> at Object.exports.renderFile (node_modules/generator-jhipster/node_modules/ejs/lib/ejs.js:478:10)
> at Object.renderContent (node_modules/generator-jhipster/generators/utils.js:252:9)
> at module.exports.template (node_modules/generator-jhipster/generators/generator-base-private.js:769:23)
> at /Users/anthonyviard/projects/entando/fork/entando-blueprint/node_modules/generator-jhipster/generators/generator-base.js:2040:42
> at Array.forEach ()
> at module.exports.writeFilesToDisk (node_modules/generator-jhipster/generators/generator-base.js:2002:45)
> at module.exports.writeMicroFrontendFiles (generators/entity-server/phases/writing/index.js:24:10)
> at Object. (node_modules/yeoman-generator/lib/index.js:893:25)
> at /Users/anthonyviard/projects/entando/fork/entando-blueprint/node_modules/run-async/index.js:49:25
> at new Promise ()
> at /Users/anthonyviard/projects/entando/fork/entando-blueprint/node_modules/run-async/index.js:26:19
> at runLoop.add.once.once (node_modules/yeoman-generator/lib/index.js:894:11)
> at processImmediate (internal/timers.js:456:21)
> (node:16681) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
> (node:16681) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
>
> Subgenerator server of entando JHipster blueprint
> Sample test
> 2) creates expected files for the blueprint
> 3) verifies application configuration contains EntandoProperties reference
> 4) verifies application.yml file contains entando properties
>
>
> 0 passing (6s)
> 4 failing
>
> 1) Subgenerator entity of entando JHipster blueprint
> Sample test
> "before all" hook for "it works":
> Uncaught Error: Copying template ui/widgets/detailsWidget/src/components/__tests__/EntityDetails.test.js.ejs failed. [TypeError: /Users/anthonyviard/projects/entando/fork/entando-blueprint/generators/entity-server/templates/ui/widgets/detailsWidget/src/components/__tests__/EntityDetails.test.js.ejs:14
> 12| const { getByText } = render(<<%= entityClass %>Details <%= entityInstance %>={<%= entityInstance %>Mock} />);
> 13| <%# TODO: THIS ONLY APPLIES IF THE DATA IS NOT SHOWN AS A DIFFERENT ITEM (e.g. Boolean as checkbox) #%>
> >> 14| <%_ const firstField = fields[0].fieldName; _%>
> 15| expect(getByText('entities.<%= entityInstance %>.<%= firstField %>')).toBeInTheDocument();
> 16| });
> 17| });
>
> Cannot read property 'fieldName' of undefined]
> at module.exports.error (node_modules/generator-jhipster/generators/generator-base.js:1590:15)
> at /Users/anthonyviard/projects/entando/fork/entando-blueprint/node_modules/generator-jhipster/generators/utils.js:256:23
> at tryHandleCache (node_modules/generator-jhipster/node_modules/ejs/lib/ejs.js:275:14)
> at Object.exports.renderFile (node_modules/generator-jhipster/node_modules/ejs/lib/ejs.js:478:10)
> at Object.renderContent (node_modules/generator-jhipster/generators/utils.js:252:9)
> at module.exports.template (node_modules/generator-jhipster/generators/generator-base-private.js:769:23)
> at /Users/anthonyviard/projects/entando/fork/entando-blueprint/node_modules/generator-jhipster/generators/generator-base.js:2040:42
> at Array.forEach ()
> at module.exports.writeFilesToDisk (node_modules/generator-jhipster/generators/generator-base.js:2002:45)
> at module.exports.writeMicroFrontendFiles (generators/entity-server/phases/writing/index.js:24:10)
> at Object. (node_modules/yeoman-generator/lib/index.js:893:25)
> at /Users/anthonyviard/projects/entando/fork/entando-blueprint/node_modules/run-async/index.js:49:25
> at new Promise ()
> at /Users/anthonyviard/projects/entando/fork/entando-blueprint/node_modules/run-async/index.js:26:19
> at runLoop.add.once.once (node_modules/yeoman-generator/lib/index.js:894:11)
> at processImmediate (internal/timers.js:456:21)
>
> 2) Subgenerator server of entando JHipster blueprint
> Sample test
> creates expected files for the blueprint:
>
> AssertionError [ERR_ASSERTION]: undefinedconfig/application.yml, no such file or directory
> + expected - actual
>
> -false
> +true
>
> at /Users/anthonyviard/projects/entando/fork/entando-blueprint/node_modules/yeoman-assert/index.js:56:12
> at Array.forEach ()
> at Function.assert.file (node_modules/yeoman-assert/index.js:54:26)
> at Context. (test/server.spec.js:51:14)
> at processImmediate (internal/timers.js:456:21)
>
> 3) Subgenerator server of entando JHipster blueprint
> Sample test
> verifies application configuration contains EntandoProperties reference:
>
> AssertionError [ERR_ASSERTION]: src/main/java/com/mycompany/myapp/EntandoPluginApp.java did not match '/EntandoProperties\.class/'. Contained:
>
> package com.mycompany.myapp;
>
> import com.mycompany.myapp.config.ApplicationProperties;
> import com.mycompany.myapp.config.DefaultProfileUtil;
>
> import io.github.jhipster.config.JHipsterConstants;
>
> import org.apache.commons.lang3.StringUtils;
> import org.slf4j.Logger;
> import org.slf4j.LoggerFactory;
> import org.springframework.beans.factory.InitializingBean;
> import org.springframework.boot.SpringApplication;
> import org.springframework.boot.autoconfigure.SpringBootApplication;
>
> import org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties;
> import org.springframework.boot.context.properties.EnableConfigurationProperties;
> import org.springframework.core.env.Environment;
>
> import java.net.InetAddress;
> import java.net.UnknownHostException;
> import java.util.Arrays;
> import java.util.Collection;
>
> @SpringBootApplication
> @EnableConfigurationProperties({LiquibaseProperties.class, ApplicationProperties.class})
> public class EntandoPluginApp implements InitializingBean {
>
> private static final Logger log = LoggerFactory.getLogger(EntandoPluginApp.class);
>
> private final Environment env;
>
> public EntandoPluginApp(Environment env) {
> this.env = env;
> }
>
> /**
> * Initializes entandoPlugin.
> *
> * Spring profiles can be configured with a program argument --spring.profiles.active=your-active-profile
> *
> * You can find more information on how profiles work with JHipster on https://www.jhipster.tech/profiles/.
> */
> @Override
> public void afterPropertiesSet() throws Exception {
> Collection activeProfiles = Arrays.asList(env.getActiveProfiles());
> if (activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) && activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_PRODUCTION)) {
> log.error("You have misconfigured your application! It should not run " +
> "with both the 'dev' and 'prod' profiles at the same time.");
> }
> if (activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) && activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_CLOUD)) {
> log.error("You have misconfigured your application! It should not " +
> "run with both the 'dev' and 'cloud' profiles at the same time.");
> }
> }
>
> /**
> * Main method, used to run the application.
> *
> * @param args the command line arguments.
> */
> public static void main(String[] args) {
> SpringApplication app = new SpringApplication(EntandoPluginApp.class);
> DefaultProfileUtil.addDefaultProfile(app);
> Environment env = app.run(args).getEnvironment();
> logApplicationStartup(env);
> }
>
> private static void logApplicationStartup(Environment env) {
> String protocol = "http";
> if (env.getProperty("server.ssl.key-store") != null) {
> protocol = "https";
> }
> String serverPort = env.getProperty("server.port");
> String contextPath = env.getProperty("server.servlet.context-path");
> if (StringUtils.isBlank(contextPath)) {
> contextPath = "/";
> }
> String hostAddress = "localhost";
> try {
> hostAddress = InetAddress.getLocalHost().getHostAddress();
> } catch (UnknownHostException e) {
> log.warn("The host name could not be determined, using `localhost` as fallback");
> }
> log.info("\n----------------------------------------------------------\n\t" +
> "Application '{}' is running! Access URLs:\n\t" +
> "Local: \t\t{}://localhost:{}{}\n\t" +
> "External: \t{}://{}:{}{}\n\t" +
> "Profile(s): \t{}\n----------------------------------------------------------",
> env.getProperty("spring.application.name"),
> protocol,
> serverPort,
> contextPath,
> protocol,
> hostAddress,
> serverPort,
> contextPath,
> env.getActiveProfiles());
> }
> }
>
> + expected - actual
>
> -false
> +true
>
> at /Users/anthonyviard/projects/entando/fork/entando-blueprint/node_modules/yeoman-assert/index.js:115:5
> at Array.forEach ()
> at Function.assert.fileContent (node_modules/yeoman-assert/index.js:102:26)
> at Context. (test/server.spec.js:58:14)
> at processImmediate (internal/timers.js:456:21)
>
> 4) Subgenerator server of entando JHipster blueprint
> Sample test
> verifies application.yml file contains entando properties:
> Error: ENOENT: no such file or directory, open 'undefinedconfig/application.yml'
> at Object.openSync (fs.js:458:3)
> at Object.readFileSync (fs.js:360:35)
> at readFile (test/server.spec.js:10:19)
> at Context. (test/server.spec.js:63:27)
> at processImmediate (internal/timers.js:456:21)
When I fixed the lint errors, I figured out that npm tests are still failing because of errors.