jest-environment-hardhat
Advanced tools
Comparing version 1.1.5 to 1.1.6
{ | ||
"name": "jest-environment-hardhat", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"description": "A jest environment with hardhat built in", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/Uniswap/jest-environment-hardhat", |
@@ -15,3 +15,3 @@ # jest-environment-hardhat | ||
The environment needs `@nomiclabs/hardhat-ethers`, `ethers`, and `hardhat` installed as well. These are installed as peer dependencies to ensure that you retain control over versioning, so you'll need to install them explicitly. | ||
The environment needs `@nomiclabs/hardhat-ethers`, `ethers`, and `hardhat` installed as well. These are installed as peer dependencies to ensure that you retain control over versioning, so you'll need to install them explicitly: | ||
@@ -23,3 +23,3 @@ ```sh | ||
Then, use the runner either using a doc-comment, or using jest configuration. See the [jest documentation](https://jestjs.io/docs/configuration#testenvironment-string) for more. | ||
Then, use the runner either using a doc-comment, or using jest configuration (see the [jest documentation](https://jestjs.io/docs/configuration#testenvironment-string) for details): | ||
@@ -36,7 +36,7 @@ ``` | ||
`jest-environment-hardhat` extends a `node` environment by default. A `jsdom` environment is also available, using `hardhat/dist/jsdom`. | ||
`jest-environment-hardhat` extends a `node` environment by default. A `jsdom` environment is also available, using `hardhat/jsdom`. | ||
``` | ||
/** | ||
* @jest-environment hardhat/dist/jsdom | ||
* @jest-environment hardhat/jsdom | ||
*/ | ||
@@ -53,4 +53,6 @@ | ||
`jest-environment-hardhat` exports a `node` (by default) and `jsdom` environment. If you'd like to extend your own environment, you can use the setup function exported by `jest-environment-hardhat/setup`. See [`src/node.ts`](./src/node.ts) for an example. | ||
`jest-environment-hardhat` subclasses a `node` environment by default, and exports a `jsdom` environment under `hardhat/jsdom`. | ||
If you'd like to extend your own environment, you can use the setup function exported by `jest-environment-hardhat/setup`. See [`src/node.ts`](./src/node.ts) for an example. | ||
## Documentation | ||
@@ -60,3 +62,3 @@ | ||
For documentation on the hardhat global, see the [type definitions](./src/hardhat.ts). | ||
For documentation on the hardhat global, see the [type declarations](./src/hardhat.ts). | ||
@@ -67,6 +69,18 @@ For examples of how to interact with the hardhat network, see the [tests](./src/internal/hardhat.test.ts). | ||
If you are using Typescript, you can import types by adding `import jest-environment-hardat` to your test file, or by adding `jest-environment-hardhat` types to your `tsconfig`. | ||
If you are using Typescript, import types by importing the library in your test or setup file: | ||
``` | ||
/** | ||
* @jest-environment hardhat | ||
*/ | ||
import 'jest-environment-hardat' | ||
test('use hardhat in this test file', () => { | ||
expect(hardhat).toBeDefined() | ||
}) | ||
``` | ||
--- | ||
Made with 🦄 by [Uniswap Labs](https://uniswap.org) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
95960
56
2193
81