Error encountered: Could not find the specified file or directory, 'resultsCapturer.js:.will-be-removed-after-cucumber-runs.tmp'

I'm currently working on automating an Angular 4 application. Whenever I execute "protractor config.js"

SCENARIO 1: If the format option in my config.ts file looks like this:

format: ['json:../reporting/results.json']

An error message is generated:

Unhandled rejection Error: ENOENT: no such file or directory, open 'C:\MyWorkspace\ProtractorProjects\protractor-cucumber-sample\test\config\MyWorkspace\ProtractorProjects\protractor-cucumber-sample\node_modules\protractor-cucumber-framework\lib\resultsCapturer.js:.will-be-removed-after-cucumber-runs.tmp'
at Error (native)

Process finished with exit code 100
Empty test suite.

The issue seems to be related to the inability to access "resultsCapturer.js". The addition of the config.js file's relative path seems to be causing this problem, and I'm unsure how to resolve it.

SCENARIO 2: Changing the format option to:

format: ['pretty']

Results in an error:

Unhandled rejection Error: Cannot find module 'C:\MyWorkspace\protractor-cucumber-sample\test\config\pretty'
at Function.Module._resolveFilename (module.js:469:15)

I referred to this documentation but couldn't find a solution to the problem.

Details of my project are as follows:

Node version: v6.10.3

Protractor version: 5.1.2

config.ts:

import { Config } from 'protractor';

export let config: Config = {

seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ["../features/*.feature"],

framework: 'custom',
frameworkPath: require.resolve('node_modules/protractor-cucumber-framework'),

baseUrl: "http://localhost:4200/",

cucumberOpts: {
    compiler: "ts:ts-node/register",
    strict: true,
    format: ['json:../reporting/results.json'],
    require: ['../steps/*.js'],
    tags: '@smoke'
 }
}

package.json:

{
 "name": "protractor-cucumber-sample",
 "version": "0.0.0",
 "private": true,
 "scripts": {
 "start": "node ./bin/www"
  },
"dependencies": {
 "@types/jasmine": "^2.5.53",
 "body-parser": "~1.17.1",
 "cookie-parser": "~1.4.3",
 "debug": "~2.6.3",
 "express": "~4.15.2",
 "jade": "~1.11.0",
 "morgan": "~1.8.1",
 "serve-favicon": "~2.4.2"
 },
"devDependencies": {
 "@types/chai": "^4.0.3",
 "@types/cucumber": "^2.0.3",
 "@types/mkdirp": "^0.5.0",
 "chai": "^4.1.1",
 "chai-as-promised": "^7.1.1",
 "cucumber": "^3.0.0",
 "cucumber-html-reporter": "^2.0.3",
 "jasmine": "^2.7.0",
 "jasminewd2": "^2.1.0",
 "protractor-cucumber-framework": "^4.0.2",
 "ts-node": "^3.3.0",
 "typescript": "^2.4.2"
  }
}

tsconfig.json:

{
 "compilerOptions": {
  "target": "es5",
  "module": "commonjs",
  "moduleResolution": "node",
  "noImplicitAny": false,
  "sourceMap": true,
  "typeRoots": [
   "./node_modules/@types/"
    ],
  "lib": ["es2015"],
  "strict": true
 },
 "compileOnSave": true,
 "exclude": [
  "node_modules/*",
  "**/*-aot.ts"
  ]
}

If more information is needed to address this issue, please let me know.

Additionally, if this is not the appropriate forum for this question, or if you know of other forums where it can be posted, please advise.

Thank you in advance.

Answer №1

Scenario 1: The error you're encountering stating "No such file or directory" is due to the absence of the reporting/results.json directory. Cucumber does not create directories automatically, so you'll need to manually create the reporting directory for it to work properly.

Scenario 2: After reviewing your package.json file, it appears you're utilizing cucumber 3.0, which no longer supports the pretty format as of the latest release. Refer to the official cucumber changelog for more information. You'll need to switch to alternative formatting options using cucumber formats, or consider downgrading your cucumber version.

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

Refresh the project once logged in using angular

Thank you in advance for your response. I am facing an issue with monitoring user activity and automatically logging them out after a certain period of inactivity. I have successfully implemented this feature in my app.component.ts file, however, it only s ...

Issue encountered when transferring Angular app to Python Flask

Not sure what information to provide, but I will give as much detail as possible. Currently, my Angular app is running on IIS and utilizing Classic ASP. Everything is working smoothly. There is a dropdown that fetches JSON data to populate a table. Recen ...

Implement code to execute exclusively on the initial success of react-query

I have a unique scenario where I need to utilize standard useQuery behavior, while also executing a piece of code only on the initial onSuccess event. Although I understand that I can accomplish this using useRef, I am curious if there is an alternative a ...

Efficiently loading Angular Material components in feature modules

Currently, my Angular module named MyAngularModule looks like this: /app/material/material.module.ts import { MatButtonModule, MatIconModule } from '@angular/material'; const MaterialComponents = [ MatButtonModule, MatIconModule, ... ]; @ ...

React: Unable to locate an index signature with a parameter of type 'string' on type N

While working with a React component, I encountered an issue when trying to access a property from my component state using a key. My editor showed the following warning: Element implicitly has an 'any' type because expression of type 'str ...

Issues with routing in AngularJS2 causing navigation problems

My Angularjs 2 routing seems to be malfunctioning, even when I manually enter the URL it still doesn't work. Below are my configuration details and versions: var ngVer = '@2.0.0-rc.5'; // locking in the angular package version var routerV ...

Despite attempts to exclude them, types in node_modules continue to be compiled in TypeScript

During my attempt to compile my typescript source code, I've noticed that the compiler is also attempting to compile the types found within my node_modules directory. I am currently utilizing typescript version 2.6.1 and have my tsconfig file set up ...

In Typescript, issues arise when trying to assign types with inheritance in Generics - Type mismatch detected

As I work on creating a generic parent class to handle multiple children, I have encountered a challenge. My goal is to define an abstract function in the parent class that will take in a child object and return that same class. Here's my initial atte ...

Issue encountered while importing TypeScript files from an external module in a Next.js project

Encountering an issue within my Next.js project with the following project structure: ├── modules/ │ └── auth/ │ ├── index.ts │ ├── page.tsx │ └── package.json └── nextjs-project/ ├─ ...

Transferring data between pages in Next JS using App Route and Typescript

Seeking assistance to extract data from an array on one page and display it on another page. I am working with NextJs, Typescript, and AppRoute. Code in app/page.tsx: import Image from 'next/image' import Link from 'next/link' const l ...

Can you explain the reference to "ng2" in relation to Angular 2?

In countless blog posts discussing Angular 2, I often come across references to ng2. Can someone clarify what ng2 stands for? Is it the CLI for Angular 2? ...

What is the best way to pass the modal dialog parameter sent from HTML to the TypeScript page?

I have implemented a dialog window using Angular where it opens by passing a parameter in the HTML side along with a transaction. To further enhance the functionality of my page, I want to incorporate the fab button. However, I am facing a challenge in sen ...

Using React TypeScript: maximize the efficiency of sending multiple JSON objects to the frontend with the useData hook

Currently, I am experimenting with a customized useData hook based on the React Beginner course by CodingWithMosh. This modified hook contains multiple objects within it. In the original course content, all data was stored in the results JSON object. I am ...

Angular - Switching Displayed Information

I am currently working with Angular 4 and I am attempting to switch between contenteditable="true" and contenteditable="false" Here is what I have so far: <h1 (dblclick)="edit($event)" contentEditable="true">Double-click Here to edit</h1> Al ...

Optimizing the sorting of object properties based on specific values (numbers or strings)

My goal is to simplify the process of sorting both number and string values. The first step involves checking if the parameter I've passed (which belongs to the DeliveryDetailsColumns constants) matches another parameter from a different type (Electro ...

Configuring ordered imports in TSLint

Need help with configuring my TSLint rule ordered-imports. I want the import order to be like this: // React import React from 'react'; import { View } from 'react-native'; // Libs import * as _ from 'lodash'; import * as mo ...

The switchMap function in Angular does not trigger the async validator as expected

To ensure that the username entered by the user is unique, I am sending an HTTP request for every input event from the target element. It is important to debounce this operation so that only one HTTP request is made for X consecutive input events within a ...

Having difficulty ensuring DayJs is accessible for all Cypress tests

Currently embarking on a new Cypress project, I find myself dealing with an application heavily focused on calendars, requiring frequent manipulations of dates. I'm facing an issue where I need to make DayJs globally available throughout the entire p ...

Facing numerous "error TS1005" messages when performing a gulp build due to node_modules/@types/ [prop types] and [react] index.d.ts with SPFx Webpart

I am currently in the process of developing a custom spfx webpart that includes a feature to display link previews. In order to achieve this functionality, I integrated this specific library. However, I encountered some challenges during the implementation ...

Unclear error message when implementing union types in TypeScript

Currently, I am attempting to define a union type for a value in Firestore: interface StringValue { stringValue: string; } interface BooleanValue { booleanValue: boolean; } type ValueType = StringValue | BooleanValue; var value: ValueType = { bo ...