I have been trying to run multiple npm commands to run some of my cypress tests in a sequence. after some research what I found was to use && in between npm commands.
package.json file, inside scripts I defined a test as,
"scripts":{
"test":"npm run cypresscommand_1 && npm run cypresscommand_2"
}
When I execute this using npm run test for some reason, npm run cypresscommand_1 got executed but npm run cypresscommand_2 didn't get executed. With further research and going through some tutorials, later I tried two modifications
modification 1: insted of && I used &
"scripts":{
"test":"npm run cypresscommand_1 & npm run cypresscommand_2"
}
modification 2: insted of && I used ||
"scripts":{
"test":"npm run cypresscommand_1 || npm run cypresscommand_2"
}
surprisingly both gave me the expected results which mean both executed npm run cypresscommand_1 and then npm run cypresscommand_2
What I want to know is,
- In the new versions of npm did they replace with && with & and ||
- Is the meaning of & is equal to and
- Is the meaning of || is equal to and
- Is there any difference between & and ||
Although the code is working perfectly, I want to make sure if I'm using the correct syntax or not. Can someone help?
Thank you.