Context
We have a nodejs project which gets built and deployed through Jenkins pipeline. During the build step, it performs eslint for all the .js files under a directory and generate eslint report. In case of any eslint error, the Jenkins pipeline fails.
Problem statement
We have introduced a sub-directory which contains further .js files. We want to generate eslint report for this, but don't want to fail the pipeline in case of any eslint error.
Can anyone please suggest how can we solve this?
Thanks in advnace.
It depends how eslint is performed.
With gyandeeps/gruntify-eslint task, there is a silent option which allows to not fail the job on errors.
In a regular shell step, you can force the command to not fail with:
sh "<your eslint command> || true"
Related
I'm using cucumber preprocessor and we do not have a standard folder structure. The cypress.json file is under a e2e folder. With cypress open, it was fine because I could specify the cypress.json file location. However, with cypress-tags run, there seems to be no way to specify the location of the cypress.json file and it just fails with error:
Failed to read cypress.json, using default configuration
Could not find a Cypress configuration file, exiting.
Anyway to support a different folder structure with cucumber?
I also stumbled upon this problem and realized that this does not work actually.
As a workaround I therefore moved away from the approach of using cypress-tags and instead adjusted the naming of my feature files. This allowed me to avoid the use of cypress-tags and use the normal cypress run command instead specifying config and feature files like:
cypress run --config-file some-cypress.json --spec **/*.integration.feature
I'm wondering if I could get some advice on how to get around this. I'm using flow and jest on a library, but the flow type annotations are causing all of my tests to fail.
I have babel flow plugin, so I can run the tests from the transcoded dist folder, however this breaks any real time testing capability and is very cumbersome.
I feel like I'm missing something obvious here, but if anyone could explain to me how to strip flow anotations at the time of testing that would be amazing!
Thanks
I think the problem you're describing can be fixed by using babel-jest, which teaches jest to first run your files through babel and then execute them.
I would try babel-jest and babel-plugin-transform-flow-strip-types.
Just install them with yarn add --dev babel-jest babel-plugin-transform-flow-strip-types and then create .babelrc file with:
{
"plugins": ["transform-flow-strip-types"]
}
Now your Jest based tests should work without any other configuration. Just execute yarn jest or whatever command you used to use to start them.
i've renamed my test folder to "test". Before it was set to AndroidTest and everything works. But i have a task from my superior that the test folder must be called "test". After i renamed the folder to test in android studio the test stopped running so i went into the run configuration for the test and specified teh package name but that did not help. Here are some details on issue:
and here is the build configuration i am running for the test:
The manifest does not have anything about test in it. This is just a dummy project i made. Do i need to enter something in the manifest ?
After reading the article provided in the comments i thought i'd share how one might resolved the issue:
Android studio does not know how to respond to our test runner unless we tell it. so i made a gradle task like the following:
when you run this gradle task it will run all test cases.
To explain, here we will cleanTest (which cleans all previous tests) then we will run the test task (its like doing gradle test on command line to run test). The test dont run again if they are successful so if you give it the option of --rerun-tasks then it will return the same test task. As for the --tests * option its used to specify which tests you want to run. in my case it was everything but you can specify a class path or even down to the method level here. very useful. so its like running this on the command line: gradle test --rerun-tasks
I have a Javascript project which uses Grunt for build process, QUnit for tests, Blanket for code coverage and a custom Grunt task to convert coverage results into LCOV files, sended to Coveralls. Everything running on TravisCI.
the project : https://github.com/mistic100/jQuery-QueryBuilder
my Grunt task : https://github.com/mistic100/grunt-qunit-blanket-lcov
So what should happen is that npm test runs QUnit+Blanket tests in a PhantomJS process and in the meanwhile, coverage results are saved in .coverage-results/all.lcov.
After a successfull build, grunt coveralls sends this file to Coveralls.
And my problem is here, the task does not find the file, although when I test on my computer it does.
see the last Travis log: https://travis-ci.org/mistic100/jQuery-QueryBuilder#L389
The only thing I can think about is that the file, for some reason, is deleted once npm test is finished. Is it possible ?
edit
so this has nothing to do with Travis but with my Grunt task where I use absolute paths thinking it's relative paths (I still don't know why it doesn't append on Windows though)
The only thing I can think about is that the file, for some reason, is deleted once npm test is finished. Is it possible ?
No, lifecycle-wise the build artefacts are still present, when running after_success commands.
The gruntfile.js configures force true and defines path - no issue here.
This should work.
I would suggest to throw in some commands to check the folders and files on Travis.
- sudo ls -alh /home/travis/build/mistic100/jQuery-QueryBuilder/*
- sudo ls -alh /home/travis/build/mistic100/jQuery-QueryBuilder/.coverage-results/*
Maybe you spot a permission issue during folder and file creation.
But that's my only guess.
I would like to avoid adding the generated JavaScript files to the git source control repository. Does the Azure Git Deploy support running addition commands to run the build before deploying the files?
Yes, you can run arbitrary logic using a custom deployment script. You'll need to either include the tools you need in your repo, or preferably download them as needed (to avoid commiting binaries).
For now you can generate a custom deployment script custom deployment script
Then edit the npm command to use the newer node.exe version (0.8.2) with the following command:
call "D:\Program Files (x86)\nodejs\0.8.2\node.exe" "D:\Program Files (x86)\nodejs\node_modules\npm\bin\npm-cli.js" install --production
Just in case somebody else is looking, this is what I needed to do to get this working.
First, I make sure that TypeScript is installed where the Kudu build server can reach it, by adding these lines somewhere towards the top of my deploy.cmd file:
call npm install typescript
IF %ERRORLEVEL% NEQ 0 (
echo Unable to install TypeScript
goto error
)
This places the Node-callable version of TypeScript in .\node_modules\.bin\tsc.cmd.
The batch file that actually performs the build (callable in various ways, but primarily as a post-build event) looks like this:
#echo off
if (%1%=="") goto settsc
cd %1%
:settsc
if exist ".\node_modules\.bin\tsc.cmd" (
set tsc=call ".\node_modules\.bin\tsc.cmd"
goto build
)
if exist "%ProgramFiles(x86)%\Microsoft Sdks\Typescript\0.9\tsc.exe" (
set tsc="%ProgramFiles(x86)%\Microsoft Sdks\Typescript\0.9\tsc.exe"
goto build
)
if exist "%ProgramFiles%\Microsoft Sdks\Typescript\0.9\tsc.exe" (
set tsc="%ProgramFiles%\Microsoft Sdks\Typescript\0.9\tsc.exe"
goto build
)
echo TypeScript compiler not found
exit 999
:build
echo Building TypeScript: Payboard.Site.js (using %tsc%)
%tsc% --sourcemap --out Scripts\Payboard\Payboard.Site.js #tsbuild_Site.txt
echo Building TypeScript: Payboard Widget (using %tsc%)
%tsc% --sourcemap --out Widget\v1.0\Payboard.js #tsbuild_Widget_v10.txt
echo Building TypeScript: App\Payboard.App.js (using %tsc%)
%tsc% --sourcemap --out App\Payboard.App.js #tsbuild_App.txt
Hope this helps someone else out.
And here is another option for a workaround that doesn't require custom deploy scripts, no batch files and only minimal changes to the project file.
The blog post with details is available at http://manfredlange.blogspot.co.nz/2014/01/aspnet-mvc-typescript-azure-website-and.html. The source code for the example project referred to in the blog post is available at https://bitbucket.org/ml_agileutilities/typescript-sample. There is a branch that reproduces the issue and there is a second branch that includes the workaround.
Please be aware that as far as I know Microsoft is working on a proper solution. At the time you are reading this the workaround may no longer be required.
Typescript can now be used without any scripting. Just make sure TypeScript works from VS, then it will also work in the Kudu build. Note that you may have TypeScript version clashes, see e.g. this question .