Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server tests failed with Node.js 16 #6162

Closed
Farfurix opened this issue Apr 21, 2021 · 0 comments · Fixed by #6164
Closed

Server tests failed with Node.js 16 #6162

Farfurix opened this issue Apr 21, 2021 · 0 comments · Fixed by #6164
Assignees

Comments

@Farfurix
Copy link
Contributor

Found in https://travis-ci.com/github/testcafe-build-bot/testcafe/jobs/500074387.

module.createRequireFromPath is removed from Node.js v16 after deprecation (v12) (nodejs/node#37201)
Up to v16 we used only this method (src/api/test-controller/execution-context.js):

function createRequire (filename) {
    //Deprecated since: Node v12.2.0
    if (Module.createRequireFromPath)
        return Module.createRequireFromPath(filename);

    if (Module.createRequire) // Reachable only in v16+
        return Module.createRequire(filename);

module.createRequire throws error with the '' filename argument:

> const module = require('module')
undefined
> module.createRequire('')
Uncaught:
TypeError [ERR_INVALID_ARG_VALUE]: The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received ''
    at new NodeError (node:internal/errors:329:5)
    at Function.createRequire (node:internal/modules/cjs/loader:1189:13)
    at REPL22:1:8
    at Script.runInThisContext (node:vm:131:12)
    at REPLServer.defaultEval (node:repl:522:29)
    at bound (node:domain:416:15)
    at REPLServer.runBound [as eval] (node:domain:427:12)
    at REPLServer.onLine (node:repl:844:10)
    at REPLServer.emit (node:events:381:22)
    at REPLServer.emit (node:domain:470:12) {
  code: 'ERR_INVALID_ARG_VALUE'
}
@Farfurix Farfurix added the TYPE: bug The described behavior is considered as wrong (bug). label Apr 21, 2021
@Farfurix Farfurix added AREA: repo/workflow and removed TYPE: bug The described behavior is considered as wrong (bug). labels Apr 21, 2021
@Farfurix Farfurix self-assigned this Apr 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant