I have an error after generating entity from a microservice as follows:
date-utils has no expected member displaydefaultdatetime
So how to solve this issue?
Just declare it in the file! In file src/main/webapp/app/shared/util/date-utils.ts add this:
export const displayDefaultDateTime = () =>
moment()
.startOf('day')
.format(APP_LOCAL_DATETIME_FORMAT);
And run the following command again:
$ npm start
OR
$ yarn start
Related
When run the this code got below error-
Invalid testing path
Like the error message states.
You have
'default', 'chrome-local'
environments available to you in your configuration file.
You will need to run the command npx nightwatch -e chrome-local like the user 'AutomatedTester' said.
1. I have added testing-library add-commands in support.js
2. I have created 2 jsconfig.js files to include cypress types
3. I have added comments in spec file to include cypress.
The tests works fine when run through cypress browser but when I run test in terminal using docker-compose command: docker-compose up --exit-code-from cypress
I get Type error Type Error: cy. find All By Text is not a function
I want to use Cypress to test locally and on CI at the same time. On CI, I would like to test a production version of my application, which has a different baseUrl than the local version, obviously. I am using the https://github.com/bjowes/cypress-ntlm-auth package to ause windows authentication for the CI, and to do so I have to call cy.ntlm line in my tests. I want to make an IF function that calls the cy.ntlm line ONLY if the baseUrl matches the production one. If the baseUrl is localhost then I would like the cy.ntlm line to be ignored. So my bottom line questions are, how do I let cypress know that I want to use 2 different URLs and how do I pack that into an IF statement? Thank you
You can check the baseUrl to conditionally call cy.ntlm,
const baseUrl = Cypress.config('baseUrl')! // use non-null assertion operator
const isLocal = baseUrl.includes('localhost')
if (!isLocal) {
cy.ntlm(...)
}
When using Typescript with Cypress you will get complaints because Typescript has no idea if you have set the baseUrl configuration or not.
You can overcome that by adding ! after getting the baseUrl value.
Ref Typescript - Non-null assertion operator
I separated the steps to make it clearer.
Assuming your cypress config file has the baseUrl. You can then update the baseUrl using the CLI during run time. For this create two different scripts with the staging and production URL's in your package.json like this:
"scripts": {
"test:local": "cypress run --config baseUrl=https://example.com/staging",
"test:ci": "cypress run --config baseUrl=https://example.com/production"
}
Then to run the scripts in CI use npm run test:ci and for local use npm run test:local.
I have a boiler template saved in my local. How do I create a template using it? I tried the below command, but it did not work:
serverless create --template-path '.\Boiler plate\' --name UserRegistration
I got the following error:
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
at validateString (internal/validators.js:120:11)
at Object.join (path.js:375:7).....
.........
None of the solutions I find online worked for me.
The error says the serverless command argument path is undefined. On the serverless create documentation page, there is an example listed that says:
serverless create --template-path path/to/my/template/folder --path path/to/my/service --name my-new-service
This will copy the path/to/my/template/folder folder into path/to/my/service and rename the service to my-new-service.
In order to solve your problem, you need to provide a valid template-path pointing to a local Serverless template and provide a 'target path' using --path to which your template will be copied. So you command will probably look like this:
serverless create --template-path '.\Boiler plate' --path /target/for/your/template.yml --name UserRegistration
Note: I haven't adjusted '.\Boiler plate\' in this command. Are you sure it's correct using a backslash \ after . ?
How does npm/yarn serverless packageadded locally in a project know where to locate the serverless.yml file?
I am trying to locate the exact piece of code in the source code of serverless framework ( https://github.com/serverless/serverless), where this happens, but haven't had any luck so far.
I need to know this because my
yarn sls offline start
command does not seem to the new changes that i did in serverless.yml file.
It keeps picking the old one.
This is the code used by Serverless to load the configuration:
https://github.com/serverless/serverless/blob/master/lib/utils/getServerlessConfigFile.js#L9
Relevant excerpt:
const servicePath = srvcPath || process.cwd();
const jsonPath = path.join(servicePath, 'serverless.json');
const ymlPath = path.join(servicePath, 'serverless.yml');
const yamlPath = path.join(servicePath, 'serverless.yaml');
const jsPath = path.join(servicePath, 'serverless.js');
return BbPromise.props({
json: fileExists(jsonPath),
yml: fileExists(ymlPath),
yaml: fileExists(yamlPath),
js: fileExists(jsPath),
}).then(exists => {
Note that from the CLI servicePath is set to the current working directory.
Looking at the code, my guess is that you may have a serverless.json which takes precedence over serverless.yaml? The command serverless print will show your resolved configuration. (https://serverless.com/framework/docs/providers/aws/cli-reference/print/#print)