diff --git a/packages/server/src/api/controllers/row/internal.js b/packages/server/src/api/controllers/row/internal.js index b500ce7fd3..02bfad85d2 100644 --- a/packages/server/src/api/controllers/row/internal.js +++ b/packages/server/src/api/controllers/row/internal.js @@ -351,8 +351,8 @@ exports.bulkDestroy = async ctx => { } exports.search = async ctx => { - // Fetch the whole table when running tests, as search doesn't work - if (env.isTest()) { + // Fetch the whole table when running in cypress, as search doesn't work + if (env.isCypress()) { return { rows: await exports.fetch(ctx) } } diff --git a/packages/server/src/environment.js b/packages/server/src/environment.js index 89e015b6f5..5012808950 100644 --- a/packages/server/src/environment.js +++ b/packages/server/src/environment.js @@ -13,6 +13,10 @@ function isDev() { ) } +function isCypress() { + return process.env.NODE_ENV === "cypress" +} + let LOADED = false if (!LOADED && isDev() && !isTest()) { require("dotenv").config() @@ -61,6 +65,7 @@ module.exports = { module.exports[key] = value }, isTest, + isCypress, isDev, isProd: () => { return !isDev()