Gitlab pipeline fails since the package.json has windows commands

Viewed 100

I am working on a cypress project. The package.json has commands to delete old report folder and create new folder with same name.

I achieve this by using windows commands in package.json:

“Clean-reports”: “rmdir /s /q cypress\reports && mkdircypress\reports” “Test”:”npm run Clean-reports && cypress run”

But when running this project on gitlab pipeline It gets stuck on rmdir command.

How do we achieve directory deletion and creation when running tests over gitlab pipeline ??

1 Answers

If you have Git for Windows, you have 200+ Linux command accessible in <Path\to\GIt>\usr\bin

That includes command rm.exe

Your Clean-reports steps can then become:

rm -Rf cypress\reports && ...

That command would be interpreted in a Linux environment.

Related