File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed
libs/backend-api7/e2e/support Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import axios from 'axios';
2
2
import { spawn } from 'node:child_process' ;
3
3
import { randomUUID } from 'node:crypto' ;
4
4
import { Agent } from 'node:https' ;
5
- import { gte , lt } from 'semver' ;
5
+ import * as semver from 'semver' ;
6
6
7
7
const httpClient = axios . create ( {
8
8
baseURL : 'https://localhost:7443' ,
@@ -68,7 +68,12 @@ const initUser = async (username = 'admin', password = 'admin') => {
68
68
} ) ;
69
69
70
70
// If the version is lower than 3.2.15, the license should be activated first.
71
- if ( lt ( '3.2.15' , process . env . BACKEND_API7_VERSION ?? '0.0.0' ) )
71
+ if (
72
+ semver . lt (
73
+ '3.2.15' ,
74
+ semver . coerce ( process . env . BACKEND_API7_VERSION ) ?? '0.0.0' ,
75
+ )
76
+ )
72
77
await activateAPI7 ( ) ;
73
78
74
79
console . log ( 'Modify password' ) ;
@@ -88,7 +93,12 @@ const initUser = async (username = 'admin', password = 'admin') => {
88
93
89
94
// If the version is greater than or equal to 3.2.15, the license should
90
95
// be activated after changing the password.
91
- if ( gte ( '3.2.15' , process . env . BACKEND_API7_VERSION ?? '0.0.0' ) )
96
+ if (
97
+ semver . gte (
98
+ '3.2.15' ,
99
+ semver . coerce ( process . env . BACKEND_API7_VERSION ) ?? '0.0.0' ,
100
+ )
101
+ )
92
102
await activateAPI7 ( ) ;
93
103
} ;
94
104
Original file line number Diff line number Diff line change 1
1
import * as ADCSDK from '@api7/adc-sdk' ;
2
2
import { Listr , SilentRenderer } from 'listr2' ;
3
+ import * as semver from 'semver' ;
3
4
4
5
import { BackendAPI7 } from '../../src' ;
5
6
@@ -101,7 +102,7 @@ export const conditionalDescribe = (cond: cond) =>
101
102
export const conditionalIt = ( cond : cond ) => ( cond ? it : it . skip ) ;
102
103
103
104
export const semverCondition = (
104
- op : ( v1 : string , v2 : string ) => boolean ,
105
+ op : ( v1 : string , v2 : string | semver . SemVer ) => boolean ,
105
106
target : string ,
106
- base = process . env . BACKEND_API7_VERSION ?? '0.0.0' ,
107
+ base = semver . coerce ( process . env . BACKEND_API7_VERSION ) ?? '0.0.0' ,
107
108
) => op ( target , base ) ;
You can’t perform that action at this time.
0 commit comments