Comments (3)
what changes do you suggest? There's no way to detect the actual platform to provide some safe default values...
from jest-node-exports-resolver.
Yeah, fair enough. I guess I figured a best effort is better than nothing when conditions
isn't provided? Otherwise, it straight up doesn't work for 100% of the cases prior to about 27.1, which is pretty recent. And considering this is about providing support for legacy versions of Jest (since it works out of the box for v28) that seems helpful?
Alternatively, is there a way to let users provide the conditions themselves in a config somewhere? I've done something like this as a custom wrapper, but I don't know how many people would dig into the code to work something like this out themselves.
const baseResolver = require('jest-node-exports-resolver')
const defaultConditions = ['require', 'node', 'default']
module.exports = (request, opts) => {
let options = opts
if (!options) {
options = {
conditions: defaultConditions
}
} else if (!options.conditions || options.conditions.length <= 0) {
options.conditions = defaultConditions
}
return baseResolver(request, options)
}
from jest-node-exports-resolver.
Or even just a handful of common pre-configured ones and a little documentation, like "for Node based tests, do 'resolver': 'jest-node-exports-resolver/node'
or something. I dunno, just trying to think of ways to make it helpful and useful under more situations, even if it's not perfect or complete.
from jest-node-exports-resolver.
Related Issues (11)
- Don't require export of `package.json` file HOT 13
- Doesn't Appear to work with Top level node Exports HOT 6
- "setupFiles" and "setupFilesAfterEnv" Jest options do not work properly when using jest-node-exports-resolver HOT 2
- Doesn't seem to work with @firebase/auth
- findMainPackageJson() doesn't work properly on Windows HOT 1
- Get `Cannot find module` error after upgrade to Jest 29.0.0+ HOT 3
- Not working accessing files in scoped packages HOT 3
- Don't work with `exports` as string HOT 1
- Doesn't work with `ws` module HOT 3
- Since 1.1.3 'Cannot use import statement outside a module' HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jest-node-exports-resolver.