Skip to content

Commit

Permalink
Merge pull request #22 from Progi1984/improveFetchPSVersion
Browse files Browse the repository at this point in the history
Improve the fetch of the version of PS
  • Loading branch information
Progi1984 committed Mar 22, 2024
2 parents 132e267 + e02ae74 commit 28f882f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@prestashop-core/ui-testing",
"version": "0.0.10",
"version": "0.0.11",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
15 changes: 11 additions & 4 deletions src/utils/testContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,25 @@ export default {
},
/**
* Return the version of current PrestaShop (depending the env value `PS_VERSION`)
* * `1.7.8.11` => `7.8.11`
* * `1.7.8.x` => `7.8.99`
* * `8.0.1` => `8.0.1`
* * `8.0.x` => `8.0.99`
* * `` => `99.99.99`
* * `develop` => `99.99.99`
* * `nightly` => `99.99.99`
* @returns string
*/
getPSVersion(): string {
if (!process.env.PS_VERSION) {
return '0.0.0';
}
if (process.env.PS_VERSION === 'nightly') {
if (!process.env.PS_VERSION
|| process.env.PS_VERSION === 'develop'
|| process.env.PS_VERSION === 'nightly') {
return '99.99.99';
}
const version: string = process.env.PS_VERSION;

return version
.replace(/\.x$/, '.99')
.replace(/^1\.7\./, '7.');
},
};

0 comments on commit 28f882f

Please sign in to comment.