is-ci-cli package doesn't work on Microsoft Azure Pipelines - azure

is-ci-cli package doesn't work on Microsoft Azure Pipelines.
When I add to my package.json
"scripts": {
"test": "is-ci-cli test:ci test:local",
"test:ci": "jest",
"test:local": "jest --watch"
}
on my local machine runs "jest --watch"
and on Microsoft Azure Pipeline runs also "jest --watch" instead of "jest"

Related

Azure Nuxt not found

I've a problem when I generate a website in Node.js
I've a WebApp On Linux, the Pipeline success, the release success, but when I go to the site, returns
:( Application Error
Looking in the logs, returns "Nuxt not found".
What's the problem?
"scripts": {
"dev": "nuxt -o",
"dev:e2e": "cypress open",
"build": "nuxt build --modern",
"start": "nuxt start",
"generate": "nuxt generate --modern",
"generate:dev": "cross-env ENV_DEV=true nuxt generate --modern",
"docs:dev": "vuepress dev docs",
"docs:build": "vuepress build docs",
"lint:eslint": "eslint --fix",
"lint:stylelint": "stylelint --fix",
"lint:markdownlint": "markdownlint",
"lint:prettier": "prettier --write --loglevel warn",
"lint:all:eslint": "yarn lint:eslint --ext .js,.vue .",
"lint:all:stylelint": "yarn lint:stylelint \"**/*.{vue,scss}\"",
"lint:all:markdownlint": "yarn lint:markdownlint \"docs/*.md\" \"*.md\"",
"lint:all:prettier": "yarn lint:prettier \"**/*.{js,json,css,scss,vue,html,md}\"",
"lint": "run-s lint:all:*",
"new": "hygen new"
},
If I try with a blobstorage it's ok, but I can't make the root domain go to the Blobstorage (example.com) because need a CNAME.
Method 1.
Try to add startup command. If it doesn't work, try method 2.
pm2 serve /home/site/wwwroot --no-daemon --spa
or
Usually use it in Angular Project.
npx serve -s
Method 2.
Use copy below code and paste it to package.json. Then tell me the result.
"scripts": {
"dev": "nuxt",
"build": "nuxt build --modern",
"start": "nuxt start",
"generate": "nuxt generate --modern",
"docs:dev": "vuepress dev docs",
"docs:build": "vuepress build docs",
"lint:eslint": "eslint --fix",
"lint:stylelint": "stylelint --fix",
"lint:markdownlint": "markdownlint",
"lint:prettier": "prettier --write --loglevel warn",
"lint:all:eslint": "yarn lint:eslint --ext .js,.vue .",
"lint:all:stylelint": "yarn lint:stylelint \"**/*.{vue,scss}\"",
"lint:all:markdownlint": "yarn lint:markdownlint \"docs/*.md\" \"*.md\"",
"lint:all:prettier": "yarn lint:prettier \"**/*.{js,json,css,scss,vue,html,md}\"",
"lint": "run-s lint:all:*",
"new": "hygen new"
},
In nuxt.config.js.
server: {
port: process.env.PORT, // default: 3000
host: '0.0.0.0' // default: localhost
},
How to deploy nuxt(nuxt.js) in azure(web app)? (not found module)
It's solved
The problem was in the release.
WebApp Service is in PHP 7.4, so, the release (Job Azure Service Deploy) in the dropdown "Runtime Stack" needs to be in PHP 7.4

Office addin (custom functions) deployment to Azure app service

Using "yo office" generated the custom functions add-in project. Implemented all the necessary custom functions and the addin works fine in local environment.
Now facing following deployment issue when deploying to Azure services.
Invalid start-up command "office-addin-debugging start manifest.xml" in package.json. Please use the format "node ".
Missing server.js/app.js files, web.config is not generated
Invalid start-up command "office-addin-debugging start manifest.xml" in package.json. Please use the format "node ".\r\nMissing server.js/app.js files, web.config is not generated\r\nC:\Program Files (x86)\SiteExtensions\Kudu\92.30310.5111\bin\Scripts\starter.cmd "C:\home\site\deployments\tools\deploy.cmd"
Following is the script block in package.json
scripts": {
"build": "webpack -p --mode production --https false",
"build:dev": "webpack --mode development --https false",
"build-dev": "webpack --mode development --https false && echo . && echo . && echo . && echo Please use 'build:dev' instead of 'build-dev'.",
"dev-server": "webpack-dev-server --mode development",
"prod-server": "webpack-dev-server --mode production",
"start": "office-addin-debugging start manifest.xml",
"start:desktop": "office-addin-debugging start manifest.xml desktop",
"start:web": "office-addin-debugging start manifest.xml web",
"stop": "office-addin-debugging stop manifest.xml",
"validate": "office-addin-manifest validate manifest.xml",
"watch": "webpack --mode development --watch",
"configure-sso": "office-addin-sso configure manifest.xml"}
Thanks!!
Modified the code base. Used express and webpack for deploying to the servers. Tested in both Azure and AWS. Application is up and running.
By following https://binyamin.medium.com/creating-a-node-express-webpack-app-with-dev-and-prod-builds-a4962ce51334 able to resolve the deployment issues

Why is a dist folder being created in all the directories in my local repository

I am working on a project which is using Apollo graphql server, Unit testing frameworks like Mocha, Chai, Sinon and nyc.
I really don't understand why does my project creates a dist folder in all the directory in the project after every few minutes on save. I have never seen this behaviour in any of my other local repositories.
I can't find this on any forums. Is it because of the Apollo graphql server I am using?
my script looks like this
"scripts": {
"lint": "npx standard",
"test:unit": "mocha test/**",
"coverage": "nyc --reporter=text --reporter=cobertura mocha test/**",
"lint:fix": "npx standard --fix",
"dev": "nodemon index.js",
"start": "node index.js",
"crypto": "node test.js"
},

`npm run` command doesn't obey the file seek pattern

Ok, I never faced this problem before. It's very strange. I've a package.json scripts as folowed:
{
"scripts": {
"test": "node_modules/jest/bin/jest.js --coverage",
"lint": "node_modules/eslint/bin/eslint.js ./src/**/*.{js,md} --fix",
"format": "node_modules/prettier-standard/src/cli.js ./src/**/*.{js,md} --fix",
"start": "sls offline"
}
}
If I type npm run lint for example, the pattern for seek files seems doesn't work (going through only the first subfolder). But if I exec the command at the terminal it works fine.
The question: why this works fine
~ node_modules/eslint/bin/eslint.js ./src/**/*.{js,md} --fix
and this won't
npm run lint?
Why are you using a full path to the modules? You only need to install the modules and npm will figure out where the scripts are.
npm i -D eslint jest prettier
If the pattern for files still does not work, try to surround it by '...', there used to be known issues about that
"scripts": {
"test": "jest --coverage",
"lint": "eslint './src/**/*.{js,md}' --fix",
"format": "prettier './src/**/*.{js,md}' --fix",
"start": "sls offline"
}
I solved my problem just wrapping the seek pattern into single quotes.
{
"scripts": {
"test": "node_modules/jest/bin/jest.js --coverage",
"lint": "node_modules/eslint/bin/eslint.js './src/**/*.{js,md}' --fix",
"format": "node_modules/prettier-standard/src/cli.js './src/**/*.{js,md}' --fix",
"start": "sls offline"
}
}
Thanks!

npm test -- --coverage never exits

I am using create-react-app to create a react application. When I executes npm test -- --coverage the test never exists. npm test actually runs react-scripts test. Any Idea?
-- --coverage part won't work, and should use one of the commands below to set CI to true.
By default npm test runs the watcher with interactive CLI. However, you can force it to run tests once and finish the process by setting an environment variable called CI.
source: React docs
Windows (cmd.exe)
set CI=true && npm test
set CI=true && npm run build
Windows (Powershell)
($env:CI = "true") -and (npm test)
($env:CI = "true") -and (npm run build)
Linux, macOS (Bash)
CI=true npm test
CI=true npm run build
NOT included in the docs
For Docker (node and react):
docker run -e CI=true [myImage] npm run test
Coverage won't work with Jest in watch mode.
Because "react-scripts test --env=jsdom" works in watch mode by default, the watch mode has to be switched off while generating the coverage output.
The following excerpt from the package.json contains a line "coverage" for illustration, how code coverage can be achieved within an app which was bootet by create-react-app.
It's just the modified "test" script, where the options --watchAll=false and --coverage are added in combination:
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"coverage": "react-scripts test --env=jsdom --watchAll=false --coverage",
"eject": "react-scripts eject"
}
Please note that it is obsolete to use standalone double-dash -- .
Most of the time this issue can be occur because of following reasons.
Not mentioning the required npm-script arguments in the
package.json file. If you use create-react-app to create your
react application, then it will not accept any command line
arguments. To resolve this problem, add following line under the
script tag in your package.json.
"test": "react-scripts test --coverage --watchAll", //mark --watchAll=false if you want.
Not mentioning the required jest configuration arguments in
the package.json or jest.config.js files. You should mention the files
which needed to include in your test coverage under the jest
configurations. Add following configurations in your
package.json.
package.json
"jest": {
"collectCoverageFrom": [
"src/**/*.js",
"!src/index.js", // files you need to avoid in test coverage
"!src/hooks/*.js",
"!src/context/*.js"
],
"coverageThreshold": {
"global": {
"branches": 90,
"functions": 90,
"lines": 90,
"statements": 90
}
},
"coverageReporters": [
"html",
"text"
]
},
Specifying a directory worked in my case
"test:cover": "react-scripts test --coverage src"
I tried all the solutions above, and for me it was still hanging with the message: Ran all test suites..
But this little hack helped:
"test:ci": "cross-env CI=true react-scripts test --forceExit --detectOpenHandles",
Explanation: The problem was coming from Jest not being able to close all processes. The above is a quick workaround. Ideally you should track the process that's stopping Jest from exiting.
In my case just added a new script "test:coverage": "react-scripts test --coverage"
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"test:coverage": "react-scripts test --coverage",
"eject": "react-scripts eject"
},

Resources