1
0
Fork 0
mirror of synced 2024-06-03 02:55:14 +12:00

Only use fetch for search when running in cypress

This commit is contained in:
Andrew Kingston 2021-09-29 18:22:56 +01:00
parent a50d46ba32
commit 1b60fb5988
2 changed files with 7 additions and 2 deletions

View file

@ -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) }
}

View file

@ -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()