-
Notifications
You must be signed in to change notification settings - Fork 53
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
Advice running unit tests (via node) that import files from this package #77
Comments
Interestingly, if I add {
"name": "cockatiel",
"version": "3.1.1",
"description": "A resilience and transient-fault-handling library that allows developers to express policies such as Backoff, Retry, Circuit Breaker, Timeout, Bulkhead Isolation, and Fallback in a fluent and thread-safe manner. Inspired by .NET Polly.",
"main": "dist/index.js",
"module": "dist/esm/index.js",
"engines": {
"node": ">=16"
},
"type": "module", // < testing This makes me wonder if my tooling doesn't like the presence of the |
I don't think this is right. As the MDN page says, null coalescing has been available since Node 14 (released 3 yrs ago), and I personally have many Node 16 applications which are using this package.
I think something in your stack of loaders (tsm? esm? uvu?) is using a parser that's quite old. This doesn't seem to be an issue with this module. |
@connor4312 thanks for your response. As you pointed out, my loader chain has a few layers so it's been difficult to debug. I used The node version running my test process is +18, and I assume this isn't changing somehow during the execution. I suspect the issue is how esm in particular is handling the Noticed setting mode to strict in esm config works for my use case. Not that it's really something I want to do as I suspect will bite me in the future regarding other deps the package may introduce... Seems like others have hit similar elsewhere: vercel/ncc#889, standard-things/esm#909, standard-things/esm#866 |
So further update, the issue seems to be For anyone else that finds themselves here, this script works with this package fine. "test": "uvu -r tsm --tsmconfig ./tsm.js -r @esbuild-kit/cjs-loader -r ./jsdom.setup.ts . test.ts", Here all I've done is swap out esm for @esbuild-kit/cjs-loader. Sorry for the noise @connor4312. |
I really like this package... 👍
However, I hit something last night that I wanted to check if anyone else has hit. FWIW I'm pretty sure this isn't going to be a problem with the code within this package itself, but my hope is someone may have hit it / have some ideas.
My specs:
Context: Running unit tests. We run in both the browser and on node. Browser-based everything is okay, however on the node version, which runs:
uvu -r tsm -r esm -r ./jsdom.setup.ts --tsmconfig ./tsm.js . test.ts
I'm getting the following error due to
??
:It seems like something in my chain doesn't like the
??
on https://github.com/connor4312/cockatiel/blob/master/src/Policy.ts#L425It's weird because we run a ton of tests that use third-party deps, many of which I'm sure use
??
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing.I suspect it's an issue with the tsconfigs, compilerOptions, libs etc. I'll keep digging.
The text was updated successfully, but these errors were encountered: