diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index a677468..d35e1ba 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -60,24 +60,11 @@ jobs: with: java-version: 21 - run: npm install - - run: npm install clickhouse - - run: npm install redis - - run: npm install mongodb - - run: npm install pg-promise - - run: npm install sqlite3 - - run: npm run build:compact --if-present - - run: npm run build:module:compact --if-present - - run: npm run build:light --if-present - - run: npm run build:module:light --if-present + - run: npm run build:compact + - run: npm run build:module:compact + - run: npm run build:light + - run: npm run build:module:light - run: npm install working-directory: test - - run: npm run test:github-1 - working-directory: test - - run: npm run test:github-2 - working-directory: test - - run: npm run test:github-3 - working-directory: test - - run: npm run test:github-4 - working-directory: test - - run: npm run test:github-5 + - run: npm run test:github working-directory: test diff --git a/test/package.json b/test/package.json index 2fe5fb8..752c5cc 100644 --- a/test/package.json +++ b/test/package.json @@ -4,11 +4,7 @@ "scripts": { "test": "mocha ./*.js --exit", "test:ts": "npx tsc --noEmit --lib esnext ./types.ts", - "test:github-1": "npm run test:ts ", - "test:github-2": "mocha ./*.js --exit flexsearch.light.min", - "test:github-3": "mocha ./*.js --exit flexsearch.light.module.min", - "test:github-4": "mocha ./*.js --exit flexsearch.compact.min", - "test:github-5": "mocha ./*.js --exit flexsearch.compact.module.min", + "test:github": "npm run test:ts && mocha ./*.js --exit flexsearch.light.min && mocha ./*.js --exit flexsearch.light.module.min && mocha ./*.js --exit flexsearch.compact.min && mocha ./*.js --exit flexsearch.compact.module.min", "test:coverage": "c8 -c ./.c8rc.json mocha ./*.js --exit", "test:keystore": "set NODE_OPTIONS=--max-old-space-size=16000 && c8 -c ./.c8rc.json mocha ./keystore.js --exit", "test:db": "c8 -c ./.c8rc.json mocha ./persistent.*.js --exit", diff --git a/test/persistent.clickhouse.js b/test/persistent.clickhouse.js index 2e46f26..89c005c 100644 --- a/test/persistent.clickhouse.js +++ b/test/persistent.clickhouse.js @@ -10,12 +10,10 @@ const build_compact = env && env.includes("compact"); const build_esm = !env || env.startsWith("module"); const Charset = _Charset || (await import("../src/charset.js")).default; -import Clickhouse_src from "../src/db/clickhouse/index.js"; -import Clickhouse_dist from "../dist/module/db/clickhouse/index.js"; import tests from "./persistent.js"; if(!build_light && !build_compact){ - describe("Persistent: Clickhouse", function(){ - tests(env ? Clickhouse_dist : Clickhouse_src, "Clickhouse"); + describe("Persistent: Clickhouse", async function(){ + await tests("Clickhouse"); }); } diff --git a/test/persistent.js b/test/persistent.js index 898506d..7e4fa2d 100644 --- a/test/persistent.js +++ b/test/persistent.js @@ -10,7 +10,24 @@ const build_compact = env && env.includes("compact"); const build_esm = !env || env.startsWith("module"); const Charset = _Charset || (await import("../src/charset.js")).default; -export default function(DB, DBClass){ +export default async function(DBClass){ + + let DB; + if(DBClass === "Clickhouse"){ + DB = (await import(env ? "../dist/module/db/clickhouse/index.js" : "../src/db/clickhouse/index.js")).default; + } + if(DBClass === "Redis"){ + DB = (await import(env ? "../dist/module/db/redis/index.js" : "../src/db/redis/index.js")).default; + } + if(DBClass === "Mongo"){ + DB = (await import(env ? "../dist/module/db/mongodb/index.js" : "../src/db/mongodb/index.js")).default; + } + if(DBClass === "SQLite"){ + DB = (await import(env ? "../dist/module/db/sqlite/index.js" : "../src/db/sqlite/index.js")).default; + } + if(DBClass === "Postgres"){ + DB = (await import(env ? "../dist/module/db/postgres/index.js" : "../src/db/postgres/index.js")).default; + } const data = [{ "tconst": "tt0000001", diff --git a/test/persistent.mongo.js b/test/persistent.mongo.js index 8f458e3..16762ff 100644 --- a/test/persistent.mongo.js +++ b/test/persistent.mongo.js @@ -10,12 +10,10 @@ const build_compact = env && env.includes("compact"); const build_esm = !env || env.startsWith("module"); const Charset = _Charset || (await import("../src/charset.js")).default; -import Mongo_src from "../src/db/mongodb/index.js"; -import Mongo_dist from "../dist/module/db/mongodb/index.js"; import tests from "./persistent.js"; if(!build_light && !build_compact){ - describe("Persistent: Mongo", function(){ - tests(env ? Mongo_dist : Mongo_src, "Mongo"); + describe("Persistent: Mongo", async function(){ + await tests("Mongo"); }); } diff --git a/test/persistent.postgres.js b/test/persistent.postgres.js index 40054fe..3ec2904 100644 --- a/test/persistent.postgres.js +++ b/test/persistent.postgres.js @@ -10,12 +10,10 @@ const build_compact = env && env.includes("compact"); const build_esm = !env || env.startsWith("module"); const Charset = _Charset || (await import("../src/charset.js")).default; -import Postgres_src from "../src/db/postgres/index.js"; -import Postgres_dist from "../dist/module/db/postgres/index.js"; import tests from "./persistent.js"; if(!build_light && !build_compact){ - describe("Persistent: Postgres", function(){ - tests(env ? Postgres_dist : Postgres_src, "Postgres"); + describe("Persistent: Postgres", async function(){ + await tests("Postgres"); }); } diff --git a/test/persistent.redis.js b/test/persistent.redis.js index 832de5a..d0cdd66 100644 --- a/test/persistent.redis.js +++ b/test/persistent.redis.js @@ -10,12 +10,10 @@ const build_compact = env && env.includes("compact"); const build_esm = !env || env.startsWith("module"); const Charset = _Charset || (await import("../src/charset.js")).default; -import Redis_src from "../src/db/redis/index.js"; -import Redis_dist from "../dist/module/db/redis/index.js"; import tests from "./persistent.js"; if(!build_light && !build_compact){ - describe("Persistent: Redis", function(){ - tests(env ? Redis_dist : Redis_src, "Redis"); + describe("Persistent: Redis", async function(){ + await tests("Redis"); }); } diff --git a/test/persistent.sqlite.js b/test/persistent.sqlite.js index bc89de7..9568f87 100644 --- a/test/persistent.sqlite.js +++ b/test/persistent.sqlite.js @@ -10,12 +10,10 @@ const build_compact = env && env.includes("compact"); const build_esm = !env || env.startsWith("module"); const Charset = _Charset || (await import("../src/charset.js")).default; -import SQLite_src from "../src/db/sqlite/index.js"; -import SQLite_dist from "../dist/module/db/sqlite/index.js"; import tests from "./persistent.js"; if(!build_light && !build_compact){ - describe("Persistent: SQLite", function(){ - tests(env ? SQLite_dist : SQLite_src, "SQLite"); + describe("Persistent: SQLite", async function(){ + await tests("SQLite"); }); }