Skip to content

Commit

Permalink
fix issues for review
Browse files Browse the repository at this point in the history
  • Loading branch information
Seroxdesign committed Jul 1, 2024
1 parent 31b6976 commit ef4d995
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 11 deletions.
6 changes: 2 additions & 4 deletions packages/cache/src/cli/cliEntrypoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,8 @@ export const cliEntrypoint = async () => {
if (os.platform() === 'win32') {
console.log(
[
chalk.redBright('🚨 Sorry, building cach on Windows is currently not supported. Please use WSL instead! 🚨'),
chalk.gray(
'You can still run tests on windows without cache by setting the USECACHE flag to false in the wallet fixture 😇'
)
chalk.redBright('🚨 Sorry, building cache on Windows is currently not supported. Please use WSL instead! 🚨'),
chalk.gray('You can still run tests on windows without cache by setting SYNPRESS_USE_CACHE=FALSE in your ENV')
].join('\n')
)
process.exit(1)
Expand Down
32 changes: 32 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion wallets/metamask/.env

This file was deleted.

2 changes: 1 addition & 1 deletion wallets/metamask/environment.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ declare global {
interface ProcessEnv {
CI: boolean
HEADLESS: boolean
SYNPRESS_USE_CACHE: boolean
SYNPRESS_USE_CACHE: string
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions wallets/metamask/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,15 @@
"@viem/anvil": "0.0.7",
"app-root-path": "3.1.0",
"axios": "1.6.7",
"dotenv": "16.4.2",
"find-config": "1.0.0",
"fs-extra": "11.2.0",
"unzipper": "0.10.14",
"zod": "3.22.4"
},
"devDependencies": {
"@synthetixio/synpress-tsconfig": "0.0.1-alpha.7",
"@types/find-config": "1.0.4",
"@types/fs-extra": "11.0.4",
"@types/node": "20.11.17",
"@types/unzipper": "0.10.9",
Expand Down
11 changes: 11 additions & 0 deletions wallets/metamask/src/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import dotenv from 'dotenv'
import findConfig from 'find-config'

export const loadEnv = () => {
const envFiles = ['.env', '.env.e2e', '.env.local', '.env.dev']
envFiles.forEach((envFile) => {
const envConfig = findConfig(envFile)
if (!envConfig) return
dotenv.config({ path: envConfig })
})
}
File renamed without changes.
10 changes: 5 additions & 5 deletions wallets/metamask/src/fixtures/metaMaskFixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import {
} from '@synthetixio/synpress-cache'
import { type Anvil, type CreateAnvilOptions, createPool } from '@viem/anvil'
import fs from 'fs-extra'
import { loadEnv } from '../config'
import { importAndConnectForFixtures } from '../fixture-actions/importAndConnectForFixtures'
import { cachelessSetupMetaMask } from '../fixture-actions/noCachMetaMaskSetup'
import { cachelessSetupMetaMask } from '../fixture-actions/noCacheMetaMaskSetup'
import { persistLocalStorage } from '../fixture-actions/persistLocalStorage'
import { SEED_PHRASE } from '../utils/constants'

// This is a workaround for the issue with the cache on Windows.
// The cache is not supported on Windows, so we need to disable it.
// process.env.SYNPRESS_USE_CACHE === true will enable the cache.
const USECACHE = true && process.platform !== 'win32'
loadEnv()

const USECACHE: boolean = process.env.SYNPRESS_USE_CACHE === undefined || process.env.SYNPRESS_USE_CACHE === 'true'

type MetaMaskFixtures = {
_contextPath: string
Expand Down

0 comments on commit ef4d995

Please sign in to comment.