When npm test is executed, an error is encountered during the execution of Protractor with

Encountered an error while running protractor tests in visual studio code using npm test. The issue seems to be related to

node_modules/@types/jasmine/index.d.ts
. How can this error be resolved?

C:\MyFiles\NewTechonologies\Protractor\TypeScript\Test>npm test

> <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="214459404c514d440c5558514452425348515561100f110f11">[email protected]</a> pretest C:\MyFiles\NewTechonologies\Protractor\TypeScript\Test
> npm run tsc


> <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c2a7baa3afb2aea7efb6bbb2a7b1a1b0abb2b682f3ecf2ecf2">[email protected]</a> tsc C:\MyFiles\NewTechonologies\Protractor\TypeScript\Test
> tsc

node_modules/@types/jasmine/index.d.ts(26,41): error TS2314: Generic type 'Matchers<T>' requires 1 type argument(s).
...
(snip)
...

node_modules/@types/jasminewd2/index.d.ts(48,20): error TS2304: Cannot find name 'Expected'.
node_modules/@types/jasminewd2/index.d.ts(49,23): error TS2304: Cannot find name 'Expected'.

npm ERR! Windows_NT 6.1.7601
npm ERR! (additional error messages)

Provided below are the files utilized for executing protractor with typescript and jasmine framework in visual studio code:

package.json

{
  "name": "example-typescript",
  "version": "1.0.0",
  "description": "a typescript example",
  "author": "",
  "license": "MIT",
  "scripts": {
    (script content)
  },
  "dependencies": {
    (dependency details)
  },
  "devDependencies": {
    (dev dependency details)
  }
}

spec.ts

(typescript code snippet)

tsconfig.json

(typescript configuration details)

Answer №1

I encountered a similar problem and was able to resolve it by taking the following steps:

1) I updated "@types/jasmine": "2.5.41" to "@types/jasmine": "^2.5.51" and "typescript": "~2.0.0" to "typescript": "2.1"

2) After running npm install && npm test, I encountered a new error, which led me to the next two actions.

3) I ran node_modules/.bin/webdriver-manager update

4) I commented out the line in conf.ts that read

seleniumAddress: 'http://localhost:4444/wd/hub',

5) Finally, I reran npm test and found that everything was working as expected.

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

What is the best way to display information in a Handlebars template file?

Having trouble displaying data in the template using NestJS with mysql. Here is the code snippet from controller.ts: import { Controller, Get, Post, Put, Delete, Body, Param, Render, UsePipes, Logger, UseGuards} from '@nestjs/common'; import { P ...

Leveraging NPM or Yarn alongside Webpacker in a Rails application

As I delve into the Webpacker documentation for Rails in hopes of incorporating ReactJS into a Rails project, I came across the requirement of Yarn as a dependency for Webpacker. However, with the recent upgrades to NPM 5 making it just as fast and effic ...

"Encountering an error in Next Js: module 'next

I recently set up a Next.js project and deployed it to my CPanel. I also created a server.js file within the directory. However, when trying to access my website, I encountered an error message. The error displayed was: internal/modules/cjs/loader.js:638 ...

Type that specifically targets the 'path' property within the object

Examine this code sample: /* eslint-disable */ type Primitive = boolean | null | number | string; export type DataAddress<T> = T extends Primitive ? [T] : ObjectAddress<T>; export type ObjectAddress<T> = { [K in keyof T]: [K, ...DataA ...

Tips for breaking free from the clutches of the Jest watchman while running it alongside husky

Hey there, I'm currently trying to incorporate husky into my workflow but I'm facing some challenges getting it to work with Jest watchman. Here's how I have it set up: At the root level, I have a .husky/pre-push file #!/bin/sh . " ...

Exploring the capabilities of Typescript arrays by implementing a forEach loop in conjunction with the

I possess an array: set Array ( [0] => Array ( [name0] => J [name1] => L [name2] => C ) [1] => Array ( [data0] => 3,1,3 [data1] => 5,3 ...

Leverage generics to assign a static type to the key of a record in a way that refers back to

I am working on developing a finite state machine companion for my chatbot automation library. The aim is to guide users towards different conversation phases while interacting with the bot. The plan is for the users of the library to supply a "state mach ...

`ìf the navigation button is clicked, the onSlideChange function runs twice`

For my project, I implemented multiple slides per group using Swiper.js and React@^18. However, I encountered an issue where the onSlideChange function runs twice when clicking the navigation button at the first slide's group. This causes it to skip t ...

Maintaining the ngFor value when clicked and passing it to another component

Currently tackling an angular project and seeking assistance with a particular issue... I have successfully displayed data from an array, but now I am looking to store the value of the element I click on so that I can utilize it in another component along ...

npm installs an incorrect package version

Currently attempting to set up karma, and encountering issues while using the command npm i karma@^1.0.0. Instead of the latest version, npm is installing <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="167d77645b72562738263826" ...

Material Angular table fails to sort columns with object values

Currently, I am in the process of developing a web application using Angular Material. One of the challenges I have encountered is displaying a table with sorting functionality. While sorting works perfectly fine on all columns except one specific column. ...

What are the constants that TypeScript compiles at runtime?

I'm in the process of developing a TypeScript library that needs to support both Node and Browser environments. Currently, I have been compiling my code twice using tsc with different targets for each environment, and it seems to be functioning correc ...

Change validators dynamically according to conditions

Scenario: At the start, there is a single text box named Name1, a date picker called DOB1, and a check box labeled Compare. Both Name1 and DOB1 are mandatory. When the checkbox is clicked, two new form controls are dynamically included, named Name2 and DO ...

Converting a custom object into a params-object in Typescript/Angular 12

I am seeking to utilize the fromObject property of HttpParamsOptions in order to convert a custom object into a params-object. Here is an example where it works: foo(): void { const testObject = { id: 123; name: 'test'; someExa ...

Validate a string to determine if it is a legitimate numerical value using Javascript

How can we accurately determine if a string is a valid number in JavaScript? Although the method isNaN(str) is commonly used, it has limitations in certain cases, Current behavior: isNaN("1") = false, as it is a number, isNaN("1 ") = ...

Error in Angular 7: node_modules missing following npm installation

Today, I encountered some unexpected errors while running my Angular 7 project using 'ng serve'. The errors I received were as follows: node_modules/@angular/common/http/src/client.d.ts(2514,30): error TS2304: Cannot find name 'ArrayBuffer&a ...

Incorporating ngrx/Store into a current Angular application

Currently, I am working on an Angular 7 project that consists of numerous components communicating with an API to update data. The constant refreshing of the data using setTimeout has made it quite overwhelming as all the components are pulling data from t ...

What is the best way to standardize a table with data that consists of key pairs?

I am developing a platform where trainers can add courses to their profiles. However, before adding a course, they must go through an application acceptance process. Initially, I organized my database into three parts: users | trainer | course After som ...

Is it possible for transclusion to display content from external sources using *ngIf and <ng-content>?

In my Angular4 Project, I have come across this snippet of code: <div class="divider"></div> <ng-content select=".nav-toggle"></ng-content> Now, I am trying to figure out a way to display the divider only when there is content pr ...

Troubleshooting Angular: Issues with Table Data Display and Source Map Error

I'm currently tackling a challenge in my Angular application where I am unable to display data in a table. When I fetch data from a service and assign it to a "rows" variable within the ngOnInit of my component, everything seems to be working fine bas ...