test: add cypress-hardhat (#6394)

* chore: ignore hardhat cache files

* test: add forking hardhat config

* test: install cypress-hardhat

* build: add cypress-hardhat

* fix: lint

* build: add hardhat

* build: add @sentry/types

* fix: better origin
This commit is contained in:
Zach Pomerantz 2023-04-19 10:50:25 -07:00 committed by GitHub
parent 55f1e35ffc
commit 04a0479236
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 1035 additions and 98 deletions

1
.gitignore vendored

@ -17,6 +17,7 @@ schema.graphql
# testing
/coverage
/cache
# builds
/build

@ -1,5 +1,6 @@
import codeCoverageTask from '@cypress/code-coverage/task'
import { defineConfig } from 'cypress'
import { setupHardhatEvents } from 'cypress-hardhat'
export default defineConfig({
projectId: 'yp82ef',
@ -8,7 +9,8 @@ export default defineConfig({
chromeWebSecurity: false,
retries: { runMode: 2 },
e2e: {
setupNodeEvents(on, config) {
async setupNodeEvents(on, config) {
await setupHardhatEvents(on, config)
codeCoverageTask(on, config)
return {
...config,

22
hardhat.config.js Normal file

@ -0,0 +1,22 @@
/* eslint-env node */
require('dotenv').config()
const mainnetFork = {
url: `https://mainnet.infura.io/v3/${process.env.REACT_APP_INFURA_KEY}`,
blockNumber: 17023328,
httpHeaders: {
Origin: 'localhost:3000', // infura allowlists requests by origin
},
}
module.exports = {
networks: {
hardhat: {
chainId: 1,
forking: mainnetFork,
accounts: {
count: 1,
},
},
},
}

@ -100,8 +100,10 @@
"@vanilla-extract/babel-plugin": "^1.1.7",
"@vanilla-extract/webpack-plugin": "^2.1.11",
"cypress": "10.3.1",
"cypress-hardhat": "^1.0.0",
"env-cmd": "^10.1.0",
"eslint": "^7.11.0",
"hardhat": "^2.14.0",
"jest-fetch-mock": "^3.0.3",
"jest-styled-components": "^7.0.8",
"ms.macro": "^2.0.0",
@ -139,6 +141,7 @@
"@reduxjs/toolkit": "^1.6.1",
"@sentry/react": "^7.45.0",
"@sentry/tracing": "^7.45.0",
"@sentry/types": "^7.45.0",
"@types/react-window-infinite-loader": "^1.0.6",
"@uniswap/analytics": "^1.3.1",
"@uniswap/analytics-events": "^2.10.0",

1103
yarn.lock

File diff suppressed because it is too large Load Diff