Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #138: Make SCENARIO_URLS dynamic and depending on the running test #141

Merged
merged 2 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions config/scenarioUrls.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"test:llcssbg": {
"home": {
"path": ""
},
"llcss": {
"path": "lazyload_css_background_images"
},
"noJsLlcss": {
"path": "lazyload_css_background_images",
"disableJs": true
},
"elementorLlcss": {
"path": "elementor-overlay"
},
"doubleColon": {
"path": "ll_bg_css_double_colon"
},
"singleColon": {
"path": "ll_bg_css_single_colon"
}
}
}
38 changes: 8 additions & 30 deletions config/wp.config.sample.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import ScenarioUrls from "./scenarioUrls.json";

/**
* The default WordPress admin user configuration for both local and live environments.
* @constant
Expand Down Expand Up @@ -57,38 +59,14 @@ const {
* }
* }}
*/
const SCENARIO_URLS = {
/**
* The value will hold the url paths
*/
home: {
path: ''
},
llcss: {
path: 'lazyload_css_background_images'
},
noJsLlcss: {
path: 'lazyload_css_background_images',
disableJs: true
},
elementorLlcss: {
path: 'elementor-overlay'
},
delayJs: {
path: ''
},
delayJsMobile: {
path: '',
mobile: true,
},
doubleColon: {
path: 'll_bg_css_double_colon'
},
singleColon: {
path: 'll_bg_css_single_colon'
}

function getScenarioUrls(scriptName: string) {
Miraeld marked this conversation as resolved.
Show resolved Hide resolved
return ScenarioUrls[scriptName];
}

const scriptName = process.env.npm_lifecycle_event;
const SCENARIO_URLS = getScenarioUrls(scriptName);

/**
* Exported WordPress environment configuration.
* @exports
Expand Down