From 252b5c7f37c2f6e9553002a16d05c0569dd4b4a2 Mon Sep 17 00:00:00 2001
From: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>
Date: Mon, 24 Jul 2023 12:15:23 -0400
Subject: [PATCH] chore: separate e2e and integration test scripts (#55)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Requirement: separate e2e and integration test scripts.
Tests:
- Unit (15 tests)
- E2E (26 tests)
---
## PR-Codex overview
### Focus of this PR:
This PR focuses on adding e2e test configurations for different packages and updating the test script in the package.json file.
### Detailed summary:
- Deleted `vitest.config.ts` and `vitest.workspace.ts` files.
- Updated the `test:run` script in the `package.json` file for the `core`, `ethers`, `accounts`, and `alchemy` packages.
- Added `vitest.config.e2e.ts` files for the `core`, `ethers`, `accounts`, and `alchemy` packages.
- Updated the `test` script in the `package.json` file to run tests using `lerna run test:run`.
- Added `test:e2e` script in the `package.json` file to run end-to-end tests.
- Added e2e test configurations in the `vitest.config.e2e.ts` files for the `core`, `ethers`, `accounts`, and `alchemy` packages.
> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`
---
package.json | 3 ++-
packages/accounts/package.json | 3 ++-
packages/accounts/vitest.config.e2e.ts | 11 +++++++++++
packages/accounts/vitest.config.ts | 4 +++-
packages/alchemy/package.json | 3 ++-
packages/alchemy/vitest.config.e2e.ts | 11 +++++++++++
packages/alchemy/vitest.config.ts | 4 +++-
packages/core/package.json | 3 ++-
packages/core/vitest.config.e2e.ts | 11 +++++++++++
packages/core/vitest.config.ts | 4 +++-
packages/ethers/package.json | 3 ++-
packages/ethers/vitest.config.e2e.ts | 11 +++++++++++
packages/ethers/vitest.config.ts | 4 +++-
vitest.config.ts | 7 -------
vitest.workspace.ts | 2 --
15 files changed, 66 insertions(+), 18 deletions(-)
create mode 100644 packages/accounts/vitest.config.e2e.ts
create mode 100644 packages/alchemy/vitest.config.e2e.ts
create mode 100644 packages/core/vitest.config.e2e.ts
create mode 100644 packages/ethers/vitest.config.e2e.ts
delete mode 100644 vitest.config.ts
delete mode 100644 vitest.workspace.ts
diff --git a/package.json b/package.json
index 37a323b684..d1118b8dc1 100644
--- a/package.json
+++ b/package.json
@@ -11,7 +11,8 @@
"build": "lerna run build --ignore=alchemy-daapp",
"build:examples": "lerna run build",
"clean": "lerna run clean",
- "test": "vitest run",
+ "test": "lerna run test:run",
+ "test:e2e": "lerna run test:run-e2e",
"lint:write": "eslint . --fix && prettier --write --ignore-unknown .",
"lint:check": "eslint . && prettier --check .",
"prepare": "husky install",
diff --git a/packages/accounts/package.json b/packages/accounts/package.json
index e9bf85d58b..4f31ed6bcb 100644
--- a/packages/accounts/package.json
+++ b/packages/accounts/package.json
@@ -35,7 +35,8 @@
"build:types": "tsc --project tsconfig.build.json --module esnext --declarationDir ./dist/types --emitDeclarationOnly --declaration --declarationMap",
"clean": "rm -rf ./dist",
"test": "vitest",
- "test:run": "vitest run"
+ "test:run": "vitest run",
+ "test:run-e2e": "vitest run --config vitest.config.e2e.ts"
},
"devDependencies": {
"@alchemy/aa-core": "^0.1.0-alpha.17",
diff --git a/packages/accounts/vitest.config.e2e.ts b/packages/accounts/vitest.config.e2e.ts
new file mode 100644
index 0000000000..b12027a9e4
--- /dev/null
+++ b/packages/accounts/vitest.config.e2e.ts
@@ -0,0 +1,11 @@
+import { configDefaults, defineProject } from "vitest/config";
+
+export default defineProject({
+ test: {
+ singleThread: true,
+ globals: true,
+ setupFiles: ["../../.vitest/setupTests.ts"],
+ exclude: [...configDefaults.exclude, "**/__tests__/**/*.test.ts"],
+ name: "accounts",
+ },
+});
diff --git a/packages/accounts/vitest.config.ts b/packages/accounts/vitest.config.ts
index 23a5d67ee2..2cfffbd66f 100644
--- a/packages/accounts/vitest.config.ts
+++ b/packages/accounts/vitest.config.ts
@@ -1,9 +1,11 @@
-import { defineProject } from "vitest/config";
+import { configDefaults, defineProject } from "vitest/config";
export default defineProject({
test: {
+ singleThread: true,
globals: true,
setupFiles: ["../../.vitest/setupTests.ts"],
+ exclude: [...configDefaults.exclude, "**/e2e-tests/**/*.test.ts"],
name: "accounts",
},
});
diff --git a/packages/alchemy/package.json b/packages/alchemy/package.json
index 43a17d2135..f1a8420ce4 100644
--- a/packages/alchemy/package.json
+++ b/packages/alchemy/package.json
@@ -35,7 +35,8 @@
"build:types": "tsc --project tsconfig.build.json --module esnext --declarationDir ./dist/types --emitDeclarationOnly --declaration --declarationMap",
"clean": "rm -rf ./dist",
"test": "vitest",
- "test:run": "vitest run"
+ "test:run": "vitest run",
+ "test:run-e2e": "vitest run --config vitest.config.e2e.ts"
},
"devDependencies": {
"@alchemy/aa-core": "^0.1.0-alpha.17",
diff --git a/packages/alchemy/vitest.config.e2e.ts b/packages/alchemy/vitest.config.e2e.ts
new file mode 100644
index 0000000000..5bf4be6857
--- /dev/null
+++ b/packages/alchemy/vitest.config.e2e.ts
@@ -0,0 +1,11 @@
+import { configDefaults, defineProject } from "vitest/config";
+
+export default defineProject({
+ test: {
+ singleThread: true,
+ globals: true,
+ setupFiles: ["../../.vitest/setupTests.ts"],
+ exclude: [...configDefaults.exclude, "**/__tests__/**/*.test.ts"],
+ name: "aa-alchemy",
+ },
+});
diff --git a/packages/alchemy/vitest.config.ts b/packages/alchemy/vitest.config.ts
index 073e809d6e..64869aeaa1 100644
--- a/packages/alchemy/vitest.config.ts
+++ b/packages/alchemy/vitest.config.ts
@@ -1,9 +1,11 @@
-import { defineProject } from "vitest/config";
+import { configDefaults, defineProject } from "vitest/config";
export default defineProject({
test: {
+ singleThread: true,
globals: true,
setupFiles: ["../../.vitest/setupTests.ts"],
+ exclude: [...configDefaults.exclude, "**/e2e-tests/**/*.test.ts"],
name: "aa-alchemy",
},
});
diff --git a/packages/core/package.json b/packages/core/package.json
index 3afe10864f..ba049c58ee 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -39,7 +39,8 @@
"build:types": "tsc --project tsconfig.build.json --module esnext --declarationDir ./dist/types --emitDeclarationOnly --declaration --declarationMap",
"clean": "rm -rf ./dist",
"test": "vitest",
- "test:run": "vitest run"
+ "test:run": "vitest run",
+ "test:run-e2e": "vitest run --config vitest.config.e2e.ts"
},
"devDependencies": {
"dotenv": "^16.0.3",
diff --git a/packages/core/vitest.config.e2e.ts b/packages/core/vitest.config.e2e.ts
new file mode 100644
index 0000000000..c80474672b
--- /dev/null
+++ b/packages/core/vitest.config.e2e.ts
@@ -0,0 +1,11 @@
+import { configDefaults, defineProject } from "vitest/config";
+
+export default defineProject({
+ test: {
+ singleThread: true,
+ globals: true,
+ setupFiles: ["../../.vitest/setupTests.ts"],
+ exclude: [...configDefaults.exclude, "**/__tests__/**/*.test.ts"],
+ name: "core",
+ },
+});
diff --git a/packages/core/vitest.config.ts b/packages/core/vitest.config.ts
index 0d61b56b29..6c19119b57 100644
--- a/packages/core/vitest.config.ts
+++ b/packages/core/vitest.config.ts
@@ -1,9 +1,11 @@
-import { defineProject } from "vitest/config";
+import { configDefaults, defineProject } from "vitest/config";
export default defineProject({
test: {
+ singleThread: true,
globals: true,
setupFiles: ["../../.vitest/setupTests.ts"],
+ exclude: [...configDefaults.exclude, "**/e2e-tests/**/*.test.ts"],
name: "core",
},
});
diff --git a/packages/ethers/package.json b/packages/ethers/package.json
index 270d13220c..0b3cbe5c24 100644
--- a/packages/ethers/package.json
+++ b/packages/ethers/package.json
@@ -38,7 +38,8 @@
"build:types": "tsc --project tsconfig.build.json --module esnext --declarationDir ./dist/types --emitDeclarationOnly --declaration --declarationMap",
"clean": "rm -rf ./dist",
"test": "vitest",
- "test:run": "vitest run"
+ "test:run": "vitest run",
+ "test:run-e2e": "vitest run --config vitest.config.e2e.ts"
},
"devDependencies": {
"@alchemy/aa-core": "^0.1.0-alpha.17",
diff --git a/packages/ethers/vitest.config.e2e.ts b/packages/ethers/vitest.config.e2e.ts
new file mode 100644
index 0000000000..c7d2b7ee67
--- /dev/null
+++ b/packages/ethers/vitest.config.e2e.ts
@@ -0,0 +1,11 @@
+import { configDefaults, defineProject } from "vitest/config";
+
+export default defineProject({
+ test: {
+ singleThread: true,
+ globals: true,
+ setupFiles: ["../../.vitest/setupTests.ts"],
+ exclude: [...configDefaults.exclude, "**/__tests__/**/*.test.ts"],
+ name: "ethers",
+ },
+});
diff --git a/packages/ethers/vitest.config.ts b/packages/ethers/vitest.config.ts
index fb3516eb21..26e624ca56 100644
--- a/packages/ethers/vitest.config.ts
+++ b/packages/ethers/vitest.config.ts
@@ -1,9 +1,11 @@
-import { defineProject } from "vitest/config";
+import { configDefaults, defineProject } from "vitest/config";
export default defineProject({
test: {
+ singleThread: true,
globals: true,
setupFiles: ["../../.vitest/setupTests.ts"],
+ exclude: [...configDefaults.exclude, "**/e2e-tests/**/*.test.ts"],
name: "ethers",
},
});
diff --git a/vitest.config.ts b/vitest.config.ts
deleted file mode 100644
index 6040832dee..0000000000
--- a/vitest.config.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { defineProject } from "vitest/dist/config";
-
-export default defineProject({
- test: {
- singleThread: true,
- },
-});
diff --git a/vitest.workspace.ts b/vitest.workspace.ts
deleted file mode 100644
index 6e29c9136f..0000000000
--- a/vitest.workspace.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-// eslint-disable-next-line import/no-anonymous-default-export
-export default ["packages/*"];