Utilize Hardhat and NPM to distinguish between unit tests and integration tests efficiently

Struggling with setting up two commands in my package.json for running unit tests and integration tests. I am having trouble defining the location of the testset for each type of testing.

Within the scripts section of my package.json, I have created two commands for unit tests and integration tests:

….
“unit”: “hardhat test test/unit/**/*.test.ts”,
 “integration”: “hardhat test test/integration/**/*.inttest.ts”
….

Unfortunately, the hardhat test task does not handle the wildcard specification effectively. It only runs test files directly within the integration directory for integration test cases, failing to execute test files in subfolders within the descendant folders.

This limitation seems to be in the implementation of the test task in Hardhat. Does anyone know how to create a command that will run all test files in all descendant folders of either the unit or integration directories?

Answer №1

Belated response, however,

try using the grep command to execute specific tests in Hardhat.

hardhat test --grep 'MySmartContract unit test'

Ensure your tests include the MySmartContract unit test phrases within the describe() or it() functions:

describe('MySmartContract unit test', () => {
    it('should accomplish something', () => {})
})

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

reloading a webpage while keeping the current tab's URL selected

I want to incorporate a feature I saw on the jQuery website at http://jqueryui.com/support/. When a specific tab is pressed, its contents should open. However, when the page is refreshed, the same tab should remain open. I'm trying to implement this i ...

Vue.js has a feature where it automatically closes the form tag within a for loop

In my Vue.js application, I have created a table where each row is a form with a submit button. This is the code snippet I am using: <div id="admin-user"> <table class="table"> <tr v-for="(user, index) in users"> < ...

Inconsistent CSS3 transitions behavior in Firefox 4

I have been playing around with some css3 transitions and created a slider test. It works perfectly in webkit browsers, but I have noticed an issue in Firefox 4. When clicking on the left link for the first time, the slider is supposed to slide to the left ...

Django: Error - < found where unexpected

Using a combination of Django and jQuery, I have implemented a file upload feature with AJAX. Everything seems to be working correctly - the files are successfully uploaded, reflected in the database, and stored on the server. However, upon completion of t ...

"Integrating Git with mvn and npm for efficient package management

In our development environment, we have a mix of git repositories containing Maven projects and NPM projects. Each repository includes shell and python scripts for performing various build actions. I've noticed that these scripts are essentially the s ...

Shift every ng-repeat child element and display the updated outcome

I am looking to create an animation that will shift all items displayed using the ng-repeat directive to the left, hide the first item, and show a new element in place of the last one. The elements are being displayed using the ng-repeat directive from a ...

Tips on selecting specific data from a nested JSON array based on conditions and fetching just one value from the initial filtered result with Javascript (designed for Google Sheets)

Utilizing the TMDB API for retrieving movie data and integrating it into a Google Sheet. The original Google Sheet was revamped from Reddit user 6745408's "MediaSheet 3.0". This sheet incorporates a Javascript-based script. By following the patterns/c ...

What's the reason "console.log()" doesn't function on this particular site?

When I go to https://www.google.com/ and enter console.log("Hello world!") into the Chrome DevTools console, it prints "Hello world!" as expected. However, when I try the same command on , nothing shows up in the console. Why doesn't it work for this ...

In the event that the $state cannot be located, redirect to a different URL using Ui

Our platform is a unique combination of WordPress backend and AngularJS frontend, utilizing ui.router with html5 mode turned on and a base href="/" due to the stack sites being in the root of the site. We are currently facing an issue: 1) Previously, whe ...

Clicking to enter fullscreen mode on a website will result in the Fullscreen API automatically closing

For my current project, I am creating an offline website and would like it to display in full screen when opened. I have been using the Fullscreen API, but it exits fullscreen mode when a user navigates to another page. After researching the issue, it seem ...

Run a Javascript function when the expected event fails to happen

I currently have this setup: <input type="text" name="field1" onblur="numericField(this);" /> However, I am struggling to figure out how to execute the numericField() function for the element before the form is submitted. I attempted using document ...

Top method for organizing an array based on an object's property and displaying the outcome

I encountered a problem for which I couldn't find an immediate solution. I have an array of objects representing products, with each product having a category property. My goal is to group these products by their categories. After some trial and error ...

Encountered an issue with reading the property 'drop' from an undefined source during a straightforward migration

I recently started using the migrate-mongo library and encountered an issue during a simple migration process to create a view. Despite success in migrating up, I faced an error when attempting to migrate down. ERROR: Could not migrate down 20220620114132 ...

Ways to separate a portion of the information from an AJAX Success response

I am currently working on a PHP code snippet that retrieves data from a database as follows: <?php include './database_connect.php'; $ppid=$_POST['selectPatientID']; $query="SELECT * FROM patient WHERE p_Id='$ppid'"; $r ...

AngularJS controllers and $scope are essential components in structuring and

As a newcomer to Angular, I've spent some time reading up on scopes and controllers, but I still feel like something isn't quite clicking for me. Let's take a look at this code snippet: var myApp = angular.module("myApp", []); myAp ...

Establishing an efficient development environment with continuous integration for react-native using typescript and nodejs

Unfortunately, we encounter the challenge of working with different nodejs versions in our projects. I am unsure if this is similar to Java where multiple jdks can be installed (multiple nodejs installations), and each project automatically utilizes the co ...

Tips on waiting for Vue component's asynchronous mount to complete before proceeding with testing

In my Vue2 component, I have an asynchronous lifecycle hook method: // create report when component is loading async mounted(): Promise<void> { await this.createReport(); } Now, I want to test my component using jest and vue/test-utils, but the te ...

The npm install command encounters issues related to node-libcurl

Encountering issues with npm install due to node-libcurl on Ubuntu, while it works fine on MacOSX. Seeking advice on troubleshooting and resolving the problem. Node.js Version: v9.4.0 NPM Version: 5.6.0 Ubuntu 17.10 > <a href="/cdn-cgi/l/email-prot ...

Error encountered while configuring development tools in VS code: Permission denied

Just diving into using VS code and attempting to set up Hubspot tools through npm install -g @hubspot/cli However, I'm encountering the following error: Thorins-MBP:Practice project thorinphoenix$ npm install -g @hubspot/cli npm ERR! code EACCES npm ...

Wave Filter in SVG

While attempting to create a fisheye-esque filter in my SVG, I came across this interesting codepen example: http://codepen.io/johanberonius/pen/RopjYW The effect works well, but I would like it to be a bit more pronounced. Unfortunately, I am unable to m ...