Skip to content

Can not configure custom directory with custom pattern in v4.0.x #4

Description

@rngnrs

Expected Behavior

zUnit-test

Summary
  Tests: 0, Passed: 0, Failed: 0, Skipped: 0, Duration: 4ms

Current Behavior

node:internal/errors:490
    ErrorCaptureStackTrace(err);
    ^

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file and data are supported by the default ESM
loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
    at new NodeError (node:internal/errors:399:5)
    at throwIfUnsupportedURLScheme (node:internal/modules/esm/resolve:1059:11)
    at defaultResolve (node:internal/modules/esm/resolve:1135:3)
    at nextResolve (node:internal/modules/esm/loader:163:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:838:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
    at ESMLoader.import (node:internal/modules/esm/loader:525:22)
    at importModuleDynamically (node:internal/modules/cjs/loader:1159:29)
    at importModuleDynamicallyWrapper (node:internal/vm/module:429:21)
    at importModuleDynamically (node:internal/vm:102:46) {
  code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}

Node.js v18.14.0
 ELIFECYCLE  Test failed. See above for more details.

Possible Solution

Use String(url.pathToFileURL(filePath))

Steps to Reproduce

  1. Init new project.
  2. Run npm i zunit --save-dev
  3. Add .zUnit.js with such content:
const path = require("node:path");
module.exports = {
  name: "zUnit-test",
  directory: path.resolve('Domain'),
  pattern: /\.(spec|test)\.js$/
}
  1. Run zUnit

Environment

  • zUnit 4.0.2
  • node 18.14.0
  • Win 10

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions