Only use fetch for search when running in cypress
This commit is contained in:
parent
a50d46ba32
commit
1b60fb5988
|
@ -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) }
|
||||
}
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue