@lwc/jest-resolver
Advanced tools
Comparing version 0.35.6-alpha1 to 0.35.6
{ | ||
"name": "@lwc/jest-resolver", | ||
"version": "0.35.6-alpha1", | ||
"version": "0.35.6", | ||
"description": "Jest resolver to resolve LWC specific packages", | ||
@@ -15,6 +15,6 @@ "main": "src/index.js", | ||
"devDependencies": { | ||
"@lwc/engine": "0.35.6-alpha1", | ||
"@lwc/jest-transformer": "0.35.6-alpha1", | ||
"@lwc/module-resolver": "0.35.6-alpha1", | ||
"@lwc/wire-service": "0.35.6-alpha1" | ||
"@lwc/engine": "0.35.6", | ||
"@lwc/jest-transformer": "0.35.6", | ||
"@lwc/module-resolver": "0.35.6", | ||
"@lwc/wire-service": "0.35.6" | ||
}, | ||
@@ -24,3 +24,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "5aa40c386dfdac48b9db4afb7a7c5711b81ebc3a" | ||
"gitHead": "b9a3237c080ec83ec8223b33eaccf440cac4dbb3" | ||
} |
@@ -9,5 +9,19 @@ /* | ||
const { resolve, extname, join, dirname, basename, sep } = require('path'); | ||
const { default: defaultResolver } = require('jest-resolve/build/default_resolver'); | ||
const lwcNpmResolver = require('@lwc/module-resolver'); | ||
/* | ||
* In Jest version 24 the default resolver was renamed to camelCase. Temporarily | ||
* support both file names until consumers upgrade their Jest version. | ||
* | ||
* Jest master branch has the default resolver passed as a param to custom | ||
* resolvers like this. Once that is released we can remove this entire block. | ||
* https://github.com/facebook/jest/commit/3f4661f141562aeca65cdad3802e930835dcf0d9 | ||
*/ | ||
let resolver; | ||
try { | ||
resolver = require('jest-resolve/build/default_resolver').default; | ||
} catch (e) { | ||
resolver = require('jest-resolve/build/defaultResolver').default; | ||
} | ||
const EMPTY_CSS_MOCK = resolve(__dirname, '..', 'resources', 'emptyStyleMock.js'); | ||
@@ -66,3 +80,3 @@ const EMPTY_HTML_MOCK = resolve(__dirname, '..', 'resources', 'emptyHtmlMock.js'); | ||
module.exports = function (path, options) { | ||
return defaultResolver(getLwcPath(path, options), options); | ||
return resolver(getLwcPath(path, options), options); | ||
}; |
8034
129