cucumber / screenplay.js

Library to ease implementation of the Screenplay pattern with CucumberJS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using different task implementations is not working

JeremiePat opened this issue Β· comments

πŸ‘“ What did you see?

I'm trying to use the "Using different task implementations" feature, unfortunately, while using it I got the following error message in my console : Error: No task in: myfile/path.{ts,js,tsx,jsx}

βœ… What did you expect to see?

It should work as expected

πŸ“¦ Which tool/library version are you using?

Note that I'm using Node.JS 20.3.1
I'm NOT using TypeScript so there is not transpilation happening in my stack.

πŸ”¬ How could we reproduce it?

Just follow the @cucumber/screenplay documentation, it is simply not working

πŸ“š Any additional context?

I did some investigation on that bug and the error is thrown here :

const task = await Function(`return import("${path}")`)()

The issue is due to the lack of extension in the dynamique import statement (I tried to manually add an extension, it works just fine). As per the Node.JS documentation : "A file extension must be provided when using the import keyword", see : https://nodejs.org/api/esm.html#mandatory-file-extensions

It looks like PR #133 could help fixing this.