Skip to content

Commit 28f882f

Browse files
authored
Merge pull request #22 from Progi1984/improveFetchPSVersion
Improve the fetch of the version of PS
2 parents 132e267 + e02ae74 commit 28f882f

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@prestashop-core/ui-testing",
3-
"version": "0.0.10",
3+
"version": "0.0.11",
44
"description": "",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/utils/testContext.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,25 @@ export default {
3232
},
3333
/**
3434
* Return the version of current PrestaShop (depending the env value `PS_VERSION`)
35+
* * `1.7.8.11` => `7.8.11`
36+
* * `1.7.8.x` => `7.8.99`
37+
* * `8.0.1` => `8.0.1`
38+
* * `8.0.x` => `8.0.99`
39+
* * `` => `99.99.99`
40+
* * `develop` => `99.99.99`
41+
* * `nightly` => `99.99.99`
3542
* @returns string
3643
*/
3744
getPSVersion(): string {
38-
if (!process.env.PS_VERSION) {
39-
return '0.0.0';
40-
}
41-
if (process.env.PS_VERSION === 'nightly') {
45+
if (!process.env.PS_VERSION
46+
|| process.env.PS_VERSION === 'develop'
47+
|| process.env.PS_VERSION === 'nightly') {
4248
return '99.99.99';
4349
}
4450
const version: string = process.env.PS_VERSION;
4551

4652
return version
53+
.replace(/\.x$/, '.99')
4754
.replace(/^1\.7\./, '7.');
4855
},
4956
};

0 commit comments

Comments
 (0)