diff --git a/packages/server/src/tests/filters/datasource-tests.js b/packages/server/src/tests/filters/datasource-tests.js new file mode 100644 index 0000000000..c82de4a556 --- /dev/null +++ b/packages/server/src/tests/filters/datasource-tests.js @@ -0,0 +1,9 @@ +const { isDatasourceTest } = require(".") + +module.exports = paths => { + return { + filtered: paths + .filter(path => isDatasourceTest(path)) + .map(path => ({ test: path })), + } +} diff --git a/packages/server/src/tests/filters/datasource-tests.ts b/packages/server/src/tests/filters/datasource-tests.ts deleted file mode 100644 index ca8b431cf6..0000000000 --- a/packages/server/src/tests/filters/datasource-tests.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { DATASOURCE_TEST_FILES } from "." - -export default (paths: string[]) => { - return { - filtered: paths - .filter(path => DATASOURCE_TEST_FILES.includes(path)) - .map(path => ({ test: path })), - } -} diff --git a/packages/server/src/tests/filters/index.js b/packages/server/src/tests/filters/index.js new file mode 100644 index 0000000000..03d3d44aa5 --- /dev/null +++ b/packages/server/src/tests/filters/index.js @@ -0,0 +1,10 @@ +const fs = require("fs") + +function isDatasourceTest(path) { + const content = fs.readFileSync(path, "utf8") + return content.includes("datasourceDescribe(") +} + +module.exports = { + isDatasourceTest, +} diff --git a/packages/server/src/tests/filters/index.ts b/packages/server/src/tests/filters/index.ts deleted file mode 100644 index 84d7c10cd7..0000000000 --- a/packages/server/src/tests/filters/index.ts +++ /dev/null @@ -1,18 +0,0 @@ -// Generated with: -// cd packages/server -// rg -l "datasourceDescribe" --glob "*.spec.ts" -export const DATASOURCE_TEST_FILES = [ - "src/automations/tests/executeQuery.spec.ts", - "src/integration-test/mysql.spec.ts", - "src/integration-test/postgres.spec.ts", - "src/api/routes/tests/rowAction.spec.ts", - "src/automations/tests/scenarios/scenarios.spec.ts", - "src/api/routes/tests/queries/generic-sql.spec.ts", - "src/api/routes/tests/table.spec.ts", - "src/api/routes/tests/queries/mongodb.spec.ts", - "src/api/routes/tests/datasource.spec.ts", - "src/api/routes/tests/viewV2.spec.ts", - "src/api/routes/tests/row.spec.ts", - "src/api/routes/tests/search.spec.ts", - "src/sdk/app/rows/search/tests/search.spec.ts", -] diff --git a/packages/server/src/tests/filters/non-datasource-tests.js b/packages/server/src/tests/filters/non-datasource-tests.js new file mode 100644 index 0000000000..31272f3ec8 --- /dev/null +++ b/packages/server/src/tests/filters/non-datasource-tests.js @@ -0,0 +1,9 @@ +const { isDatasourceTest } = require(".") + +module.exports = paths => { + return { + filtered: paths + .filter(path => !isDatasourceTest(path)) + .map(path => ({ test: path })), + } +} diff --git a/packages/server/src/tests/filters/non-datasource-tests.ts b/packages/server/src/tests/filters/non-datasource-tests.ts deleted file mode 100644 index 0fc8650da3..0000000000 --- a/packages/server/src/tests/filters/non-datasource-tests.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { DATASOURCE_TEST_FILES } from "." - -export default (paths: string[]) => { - return { - filtered: paths - .filter(path => !DATASOURCE_TEST_FILES.includes(path)) - .map(path => ({ test: path })), - } -}