Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
Level
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Unable to run npm test as a task.

I'm currently trying to run 'npm test' as a task. The command is simply 'test'. When I try to run my build plan I get the following error:

 

26-Mar-2020 18:10:25> bambootest@0.1.0 test /home/bytebaron/atlassian-bamboo-7.0.2/xml-data/build-dir/BAM-BTP-JOB1
26-Mar-2020 18:10:25> react-scripts test
26-Mar-2020 18:10:25 
26-Mar-2020 18:10:25sh: 1: react-scripts: not found
26-Mar-2020 18:10:25npm ERR! Test failed.  See above for more details.

 

It appears to me like the command isn't really being run from the correct directory? I can run this command locally in a vscode terminal fine however I'm new to Bamboo and I am unsure where this command would be executed exactly. I'd appreciate any help.

1 answer

0 votes

Hi @byte_baron,

I just answered another question from you, basically on th same npm topic. There I sent a great KB on how to configure a npm task within Bamboo. Possibly, the "magic" for you is Node.js being configured correctly, so providing the path to the node and implicitly the npm binary. And also environment variable NODE_HOME to be set.

By the way, other than using Bamboo's npm task, you can also use npm's CLI and thus run your npm commands from within a Bamboo Script task. Only take care of interactive processes, like npm init, where you need to enter a bunch of data or at least hit <CR> several times. Though, npm install and npm test should work just fine.

As of your posted build log snippet, npm test fails for you because react-scripts cannot be found and likely your defined Node.js tests are in there.

So answering your question, the build log directly tells you where the build is run, namely here:

/home/bytebaron/atlassian-bamboo-7.0.2/xml-data/build-dir/BAM-BTP-JOB1

So effectively within your <Bamboo home directory> under xml-data/build-dir Bamboo creates a new folder per build and names it using PROJ-PLAN-JOB, right as you see above.

This location is called your build working directory. E.g. if you run a Source Code Checkout task, code is copied in to here. Any build operations that this plan is performing are running here. So in other words, this folder is the "core" of your build. Hence it shall provide the environment that your Bamboo build plan requires.

Find the following KB highlighting the most important Bamboo folders: Locating important directories and files.

If you want to see what resides in your plan's build working directory, you may run the following from a Bamboo Script task with Bamboo Server hosted on Linux or UNIX.

ls -al ${bamboo.build.working.directory}

Find this and many more useful Bamboo variables here: Bamboo variables.

So, summarizing, typically the Source Code Checkout task is used to make all needed files available in your plan's build working directory. Alternatively you could think about copying in what you need, from your local server or even from remote, as per simple cp or secure scp / sftp or even via rsync.

However you do that, if your data is there and accessible as it is from within your Visual Studio Code terminal, npm test should equally work from out of Bamboo.

Please check out our suggestions and let us know what more we can assist you on.

Thanks, take care and have a great weekend!
Gerhard

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bamboo

Bamboo 101 Video

G’day Community! As we gear up to introduce Bamboo Data Center to the world, we wanted to make sure that we shared a bit more about Bamboo, the product. Our team has put together an overview video ...

55 views 2 4
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you