Skip to content

Commit

Permalink
feat: fix config-overrides to work with jest
Browse files Browse the repository at this point in the history
  • Loading branch information
juanmahidalgo committed Nov 16, 2023
1 parent ca17f11 commit 12b2e02
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 116 deletions.
61 changes: 34 additions & 27 deletions webapp/config-overrides.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,39 @@
const { override, babelInclude } = require('customize-cra')
const path = require('path')

const overridedConfig = override(
babelInclude([
path.resolve(__dirname, 'src'),
path.resolve(__dirname, 'node_modules/react-virtualized-auto-sizer'),
path.resolve(
__dirname,
'node_modules/decentraland-connect/node_modules/@walletconnect'
),
path.resolve('node_modules/@metamask/utils/node_modules/superstruct'),
path.resolve(__dirname, 'node_modules/@walletconnect'),
path.resolve(__dirname, 'node_modules/@dcl/single-sign-on-client'),
path.resolve(__dirname, 'node_modules/@0xsquid/sdk'),
path.resolve(__dirname, 'node_modules/@cosmjs'),
path.resolve(__dirname, 'node_modules/cosmjs-types'),
path.resolve(__dirname, 'node_modules/ethers-multicall-provide'),
path.resolve(__dirname, 'node_modules/@noble')
])
)

const jestConfig = config => {
config.transformIgnorePatterns = [
'node_modules/?!@0xsquid|eccrypto|libsodium-wrappers-sumo'
]
config.moduleNameMapper = {
'@dcl/single-sign-on-client': 'identity-obj-proxy',
'^react-native$': 'react-native-web',
'^.+\\.module\\.(css|sass|scss)$': 'identity-obj-proxy'
}
console.log('config: ', config)
return config
}

module.exports = {
jest: config => {
config.transformIgnorePatterns = [
'node_modules/?!@0xsquid|eccrypto|libsodium-wrappers-sumo'
]
config.moduleNameMapper = {
'@dcl/single-sign-on-client': 'identity-obj-proxy'
}
return config
},
...override(
babelInclude([
path.resolve(__dirname, 'src'),
path.resolve(__dirname, 'node_modules/react-virtualized-auto-sizer'),
path.resolve(
__dirname,
'node_modules/decentraland-connect/node_modules/@walletconnect'
),
path.resolve('node_modules/@metamask/utils/node_modules/superstruct'),
path.resolve(__dirname, 'node_modules/@walletconnect'),
path.resolve(__dirname, 'node_modules/@dcl/single-sign-on-client'),
path.resolve(__dirname, 'node_modules/@0xsquid/sdk'),
path.resolve(__dirname, 'node_modules/@cosmjs'),
path.resolve(__dirname, 'node_modules/cosmjs-types'),
path.resolve(__dirname, 'node_modules/ethers-multicall-provide'),
path.resolve(__dirname, 'node_modules/@noble')
])
)
...overridedConfig,
jest: jestConfig
}
7 changes: 1 addition & 6 deletions webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,5 @@
"last 1 safari version"
]
},
"homepage": "",
"jest": {
"moduleNameMapper": {
"@dcl/single-sign-on-client": "identity-obj-proxy"
}
}
"homepage": ""
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { ItemSaleActions } from '../SaleActionBox/ItemSaleActions'
import { BuyOptions, Props } from './BestBuyingOption.types'
import styles from './BestBuyingOption.module.css'

const BestBuyingOption = ({ asset, tableRef, onBuyWithCrypto }: Props) => {
const BestBuyingOption = ({ asset, tableRef }: Props) => {
const [buyOption, setBuyOption] = useState<BuyOptions | null>(null)
const [isLoading, setIsLoading] = useState(false)
const [listing, setListing] = useState<{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,10 @@ import { t } from 'decentraland-dapps/dist/modules/translation/utils'
import { getBuilderCollectionDetailUrl } from '../../../../modules/collection/utils'
import { AssetType } from '../../../../modules/asset/types'
import { BuyNFTButtons } from '../BuyNFTButtons'

import styles from './ItemSaleActions.module.css'
import { Props } from './ItemSaleActions.types'
import styles from './ItemSaleActions.module.css'

const ItemSaleActions = ({
item,
wallet,
customClassnames,
onBuyWithCrypto
}: Props) => {
const ItemSaleActions = ({ item, wallet, customClassnames }: Props) => {
const isOwner = wallet?.address === item.creator
const canBuy = !isOwner && item.isOnSale && item.available > 0
const builderCollectionUrl = getBuilderCollectionDetailUrl(
Expand Down

This file was deleted.

0 comments on commit 12b2e02

Please sign in to comment.