What's the path to global node_modules folder in Travis CI - travis-ci

I need to pass the path for the node_modules global installation folder to the mink-zombie-driver, but I can't find anywhere in the docs what's the path for it.
MinkExtension requires you to pass the node_modules folder in the configuration file for Behat.

Related

yarn scripts local bin missing in PATH when installed outside of cwd

I have a docker container with yarn v1.22.19 installed. A .yarnrc file includes the line --modules-folder /node_modules to lift node_modules to the container's root directory. This is a workaround for a bind mount to the working directory erasing node_modules that were installed when the image is built.
The packages and binaries are installed properly in /node_modules/.bin/. The working directory is /app.
yarn bin returns the correct path to binary directory, and yarn run <binary> properly executes the binary. However, a yarn script which attempts to execute the local binary, such as "dev": "vite dev --host" errors with /bin/sh: 1: vite: not found.
Node module resolution checks for ancestor directories if there is no node_modules directory in the working directory. Even so, I tried to change the NODE_PATH to point to /node_modules and still no luck. Why does the yarn script have a different context than yarn commands? How can I point it to the correct local binary directory?
EDIT:
While yarn bin points to the correct local binary folder, the child process produced by yarn run to run a script defined in package.json injects cwd/node_modules/.bin into PATH instead of the specified /node_modules/.bin. I suspect this is a bug in older versions of yarn.
As a workaround, is there a way to prepend a command to the execution of yarn scripts defined in pcakage.json? Then I could just manually inject the correct path into the environment.

Jenkins - Publish Over SSH Plugin: How to copy directory

I'm trying to use Jenkins' Publish Over SSH plugin to copy all files AND sub-directories of some given directory, but so far, I've only able to copy files and NOT directory.
I have a directory named foo in my workspace, and during the build, I want to copy everything in this directory to a remote server.
I've tried this pattern foo/**, but it doesn't copy all sub-directories.
Any suggestion? Or this is not the plugin I should be using?
Thanks
For recursive copy of directory you should give
foo/**/*
I verified this on my laptop using locally deploying Jenkins. It works fine.

Copy Artifact Plugin - Copy from WORKSPACE without the path from Artifacts to copy

I would like to copy Jenkins WORKSPACE items from a job to another using Copy Artifact Plugin as follows:
from Job A's WORKSPACE: /output/bundle/<all files and folders>
to Job B under ${AUT} path which is: c:/AUT
Plugin setup
Project name: project-build
Which build: Copy from WORKSPACE of latest completed build
Artifacts to copy: output/bundle/**
Target directory: ${AUT}
The copy is performed but the content of the Target Directory will be:
c:/AUT/output/bundle/<all files and folders>
How can I modify the Artifacts to copy or Target directory in order to have the following result:
c:/AUT/<all files and folders>?
Just to be more clear, I would like to copy only the content of /output/bundle/<all files and folders> not having the /output/bundle/ path in the Target directory.
There should be a "flatten directory" option in the advanced setting, which will expand whatever you have in the source directory to the target directory. However, this will also expand the folder in the source directory, to solve that you need to be more specific on the source folder and the destination folder. For example, src: output/bundle/a/**, dst: ${AUT}/a/

how to delete src folder after test cases compiled?

I am running the selenium test cases through jenkins. once the workspace is created and src folder is also there. I do not want the src folder to be exposed to all the users. how should I do ?
To restrict from other users,revoke the RWX permission for others(groups as well) to that directory and subdirectory using execute shell.
chmod -R o-rwx src
Here no role to play for jenkins
Thanks.
I used WS clean up plugin and it is able to delete the workspace or specified files and folders.

Jenkins Files to archive pattern

In the Jenkins copy artifacts plugins, it follows ant includes attributes of fileset.
If I give Output/**/*
it copies everything including the Output folder.
How can I tell to copy only everything inside Output folder but not the Output folder iteself.
source: Output/v2.1/xxx/*.*
Destination:v2.1/xxx/*.*
The answer is, its probably not possible in copy artifact plugin.
But the same objective can be reachable by another plugin, called Artifact deployer plugin. In that plugin when you deploy the artifact to local or remote server, you can specify the base directory, so the artifact is copied from the base directory excluding the base directory. In this case if I specify my base directory as Output then it copies what is inside the output directory.

Resources