Skip to content

Commit 35463ad

Browse files
committed
swap to hardhat instead of core
1 parent c856215 commit 35463ad

File tree

6 files changed

+12
-55
lines changed

6 files changed

+12
-55
lines changed

pnpm-lock.yaml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

v-next/hardhat-errors/src/descriptors.ts

-20
Original file line numberDiff line numberDiff line change
@@ -196,26 +196,6 @@ Please add the property "type" with the value "module" in your package.json to e
196196
websiteTitle: "Invalid config",
197197
websiteDescription: `The configuration you provided is invalid. Please check the documentation to learn how to configure Hardhat correctly.`,
198198
},
199-
TYPESCRIPT_NOT_INSTALLED: {
200-
number: 17,
201-
messageTemplate: `Your Hardhat project uses typescript, but it's not installed.
202-
203-
Please run: npm install --save-dev typescript`,
204-
websiteTitle: "typescript not installed",
205-
websiteDescription: `You are running a Hardhat project that uses typescript, but it's not installed.
206-
207-
Please run this and try again: \`npm install --save-dev typescript\``,
208-
},
209-
TSX_NOT_INSTALLED: {
210-
number: 18,
211-
messageTemplate: `Your Hardhat project uses typescript, but tsx is not installed.
212-
213-
Please run: npm install --save-dev tsx`,
214-
websiteTitle: "tsx not installed",
215-
websiteDescription: `You are running a Hardhat project that uses typescript, but you haven't installed tsx.
216-
217-
Please run this and try again: \`npm install --save-dev tsx\``,
218-
},
219199
},
220200
INTERNAL: {
221201
ASSERTION_ERROR: {

v-next/hardhat-node-test-runner/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"typescript-eslint": "7.7.1"
5757
},
5858
"dependencies": {
59-
"@ignored/hardhat-vnext-core": "workspace:^3.0.0-next.2",
59+
"@ignored/hardhat-vnext": "workspace:^3.0.0-next.2",
6060
"@ignored/hardhat-vnext-errors": "workspace:^3.0.0-next.2",
6161
"@ignored/hardhat-vnext-node-test-reporter": "workspace:^3.0.0-next.2",
6262
"@ignored/hardhat-vnext-utils": "workspace:^3.0.0-next.2",

v-next/hardhat-node-test-runner/src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type { HardhatPlugin } from "@ignored/hardhat-vnext-core/types/plugins";
1+
import type { HardhatPlugin } from "@ignored/hardhat-vnext/types/plugins";
22

3-
import { task } from "@ignored/hardhat-vnext-core/config";
3+
import { task } from "@ignored/hardhat-vnext/config";
44

55
const hardhatPlugin: HardhatPlugin = {
66
id: "test",

v-next/hardhat-node-test-runner/src/task-action.ts

+6-29
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import type { HardhatConfig } from "@ignored/hardhat-vnext-core/types/config";
2-
import type { NewTaskActionFunction } from "@ignored/hardhat-vnext-core/types/tasks";
1+
import type { HardhatConfig } from "@ignored/hardhat-vnext/types/config";
2+
import type { NewTaskActionFunction } from "@ignored/hardhat-vnext/types/tasks";
33

44
import { resolve } from "node:path";
55
import { run } from "node:test";
6+
import { fileURLToPath } from "node:url";
67

7-
import { HardhatError } from "@ignored/hardhat-vnext-errors";
88
import hardhatTestReporter from "@ignored/hardhat-vnext-node-test-reporter";
9-
import { findUp, getAllFilesMatching } from "@ignored/hardhat-vnext-utils/fs";
9+
import { getAllFilesMatching } from "@ignored/hardhat-vnext-utils/fs";
1010

1111
interface TestActionArguments {
1212
testFiles: string[];
@@ -39,37 +39,14 @@ async function getTestFiles(
3939
);
4040
}
4141

42-
async function hasTypescriptConfig(): Promise<boolean> {
43-
const hhConfig = await findUp("hardhat.config.ts");
44-
45-
return hhConfig !== undefined;
46-
}
47-
4842
const testWithHardhat: NewTaskActionFunction<TestActionArguments> = async (
4943
{ testFiles, only },
5044
hre,
5145
) => {
5246
const files = await getTestFiles(testFiles, hre.config);
5347

54-
// the second check is needed for the case of a user having a hardhat.config.ts file
55-
// but all their test files are js files. probably an edge case, but we should handle it
56-
if (files.some((f) => isTypescriptFile(f)) || (await hasTypescriptConfig())) {
57-
try {
58-
import.meta.resolve("typescript");
59-
} catch {
60-
throw new HardhatError(
61-
HardhatError.ERRORS.GENERAL.TYPESCRIPT_NOT_INSTALLED,
62-
);
63-
}
64-
65-
try {
66-
import.meta.resolve("tsx");
67-
} catch {
68-
throw new HardhatError(HardhatError.ERRORS.GENERAL.TSX_NOT_INSTALLED);
69-
}
70-
71-
process.env.NODE_OPTIONS = "--import tsx";
72-
}
48+
const tsx = fileURLToPath(import.meta.resolve("tsx/esm"));
49+
process.env.NODE_OPTIONS = `--import ${tsx}`;
7350

7451
run({ files, only }).compose(hardhatTestReporter).pipe(process.stdout);
7552
};

v-next/hardhat-node-test-runner/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"extends": "../../config-v-next/tsconfig.json",
33
"references": [
44
{
5-
"path": "../core"
5+
"path": "../hardhat"
66
},
77
{
88
"path": "../hardhat-errors"

0 commit comments

Comments
 (0)