Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

node v20 --loader error #3195

Closed
iambumblehead opened this issue Apr 19, 2023 · 0 comments
Closed

node v20 --loader error #3195

iambumblehead opened this issue Apr 19, 2023 · 0 comments

Comments

@iambumblehead
Copy link

Checking in here to notify about an issue using ava with node v20 and --loader. There is a problem demonstrated at the repo here: https://github.com/iambumblehead/nodejs-v20-loader-ava-noop; using npm test from that repo with node v20 causes the test to incorrectly fail.

Essentially ava fails when used with --loader

anyloader.js

export const load = async (url, context, nextLoad) => {
  if (url.endsWith('anyfile.js')) {
    return {
      format: 'module',
      shortCircuit: true,
      responseURL: url,
      source: 'export default "fromloader"'
    }
  }
  return nextLoad(url, context)
}

anyfile.spec.js

import test from 'ava'

test('should user loader', async t => {
  const anyfile = await import('./anyfile.js')

  t.is(anyfile.default, 'fromloader')
})
ava --node-arguments="--loader=./anyloader.js"


(node:59341) ExperimentalWarning: Custom ESM Loaders is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
  ✖ should user loader Promise returned by test never resolved


  should user loader

  Error: Promise returned by test never resolved



  1 test failed

It might be caused by an upstream issue reported earlier this evening nodejs/node#47614, however opening an issue here may be useful because the error manifests itself in a special way with ava, indicating a possibly separate issue.

@avajs avajs locked and limited conversation to collaborators May 21, 2023
@novemberborn novemberborn converted this issue into discussion #3199 May 21, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Projects
None yet
Development

No branches or pull requests

1 participant