Skip to content

Commit

Permalink
fix "TypeError: readConfig is not a function" issue
Browse files Browse the repository at this point in the history
  • Loading branch information
faisal-alvi committed Jun 21, 2024
1 parent af67f95 commit 9095494
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/cypress/config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const { defineConfig } = require('cypress');
const { readConfig } = require('@wordpress/env/lib/config');
const { loadConfig } = require('@wordpress/env/lib/config');
const getCacheDirectory = require('@wordpress/env/lib/config/get-cache-directory');

module.exports = defineConfig({
fixturesFolder: 'tests/cypress/fixtures',
Expand Down Expand Up @@ -32,7 +33,8 @@ module.exports = defineConfig({
* @returns config Updated Cypress Config object.
*/
const setBaseUrl = async (on, config) => {
const wpEnvConfig = await readConfig('wp-env');
const cacheDirectory = await getCacheDirectory();
const wpEnvConfig = await loadConfig(cacheDirectory);

if (wpEnvConfig) {
const port = wpEnvConfig.env.tests.port || null;
Expand Down

0 comments on commit 9095494

Please sign in to comment.