execute lerna tasks based on the module's condition

I manage a monorepo using lerna in conjunction with npm. My goal is to determine if it's possible to selectively execute a lerna command based on where changes have been made.

For instance: I have the following packages:

package-common-base
package-a
package-b

If a change occurs in package-common-base, I want to run lerna run test. If a change occurs in either package-a or package-b (but not in package-common-base), I'd like to run lerna run test:unit.

I've experimented with various approaches involving lerna flags and also explored @lerna/filter-options, but so far haven't found a solution that fits this specific scenario.

It's possible my understanding of the situation isn't correct, but this feature would be valuable to me, particularly when I need to limit or broaden the scope of running tests based on changes to critical packages...

Cheers,

Answer №1

If you want to specify a specific time range for the libraries that have been changed, you can utilize the --since flag.

To run unit tests only on the libraries changed since the master branch:
lerna run test:unit --since master

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Guide on integrating React.js into an HTML development webpage

I can't seem to get this code to work properly. I have saved it as an .html file on my computer, but it's not displaying anything when I try to open it in Google Chrome. <DOCTYPE! html> <html> <head> <script src= ...

ACL - Utilize ACL in conjunction with the passport authentication system

I am experimenting with node_acl in combination with passport-local. Unfortunately, I am facing an issue when trying to secure the route for the admin-user '/admin', as it keeps redirecting me to the /login page. Below is a simplified version of ...

Firebase firestore is reporting an error stating that the requested document cannot be found

Using nodejs, I am working on creating firestore documents in a specific structure that includes the collection name followed by an ID and then the document itself. While my code successfully adds the document, it does not create the parent document (ID) i ...

Exploring the process of sending props via the render method in Vue.js and observing their behavior

Struggling with passing a prop from a parent component down to a child created using CreateElement/render in vue.js and then watching it. Here is the parent component: Vue.component('my-drawing', MyDrawing) new Vue({ el: '#drawing' ...

struggling with typing an object in react typescript - Element is assumed to have an 'any' type due to its type

Having trouble with the code snippet below: // if I remove the `any` below it breaks. const teams: any = { liverpool: <Liverpool />, manUtd: <ManUtd />, arsenal: <Arsenal />, }; export const TeamCrest = ({ team }: { team: ke ...

The npm installation process has come to a sudden halt

Starting a web application in Angular 17 has been my goal. I typically run npm install followed by ng serve. However, this process suddenly stopped working. To troubleshoot, here are the steps I've taken: Updated npm to the latest version (10.2. ...

Update the image source through an AJAX call

I've experimented with various methods to update an image src using an AJAX request. The new URL is obtained through the AJAX call, and when inspecting the data in Developer Tools, the 'DATA' variable contains the correct URL. However, the i ...

Using an npm package in client-side JavaScript

I've been exploring client-side GitHub packages recently and came across developers mentioning that the packages can be downloaded using npm. This confuses me as I thought these were client-side JavaScript packages. They also mentioned something about ...

Transitioning from utilizing Stripe Checkout to implementing Stripe Elements

After using Stripe Checkout for a while, I've decided to make the switch to Stripe Elements. You can find more information about Stripe Elements here. When sending the name and address fields as tokenData, I follow this format: let tokenData = { ...

The preflight request's response failed to meet the access control criteria due to the absence of the 'Access-Control-Allow-Origin' header

I encountered an issue while using ngResource to call a REST API hosted on Amazon Web Services: Upon making the request to , I received the following error message: "XMLHttpRequest cannot load. Response to preflight request doesn't pass access cont ...

method that provides route-specific variable outputs

I have a situation where multiple routes require the same userdata from the database. Although I have a function to verify if the user is logged in, this function does not return the user variables. Here is an example route: app.get('/template', ...

Create dynamically generated expressions to filter a JavaScript array

Looking to refine an array based on a variable number of items in another array. Consider the initial array: var toBeFiltered = [ {name:"A", parentId: 0}, {name: "B", parentId: 3}, {name: "C", parentId: 0}, {name: "D", parentId: 1}, ... ] I wan ...

The datepicker in Vue.js is experiencing a limitation where it does not allow for the default value of an

I incorporated the vue-date-picker for date picker functionality in my input fields because it perfectly aligned with all of my requirements. The issue I encountered is that when loading the page, I attempted to pass a default value from the database, but ...

Using ngFor in Angular 6 to create a table with rowspan functionality

Check out this functional code snippet Desire for the table layout: <table class="table table-bordered "> <thead> <tr id="first"> <th id="table-header"> <font color="white">No.</font> </th> <th id="table-hea ...

Error in Node.js: Unhandled promise rejection due to undefined value

We're currently facing an issue with the create user controller in Node.js Express. The problem arises when attempting to sign up on the front end, resulting in an error message: "Unhandled promise rejection error value is not defined." Although it ap ...

Error-free ngClick doesn't trigger AngularJS controller method

I am struggling to trigger the removePlayer(playerId) method upon clicking a button. However, it seems that the method is not being called, as I have placed a console.log() statement at the top and the console remains empty. This situation has left me puz ...

Tips for importing several makeStyles in tss-react

When upgrading from MUI4 to MUI5 using tss-react, we encountered a problem with multiple styles imports in some files. const { classes } = GridStyles(); const { classes } = IntakeTableStyles(); const { classes } = CommonThemeStyles(); This resulted in ...

Embedding content from another website onto my website

I'm in search of a solution to incorporate a part of another website into my own. Is it possible to do this using an iframe? And if so, how can I specify that only a specific section should be displayed? For instance, if the other website contains: ...

Overwriting the responseText from a previous XMLHttpRequest in JavaScript

I am working on updating two different JavaScript charts displayed on a PHP page by making sequential XMLHttpRequests using JavaScript. The goal is to update the data on these charts simultaneously. <!DOCTYPE HTML> <html> <head> <scri ...

Building an efficient shopping cart feature on a website with asp.net mvc4, incorporating the use of html5 local

After receiving suggestions on my previous question, I delved into further research and began the coding process. The flowchart I am currently following is as follows: I have a products page and a partial view for the Cart. ====> When a user c ...