@@ -10,15 +10,14 @@ import { setupTestProject } from "./setup-test-project.mjs";
1010import { updateWidget } from "./utils.mjs" ;
1111
1212const MX_VERSION_MAP_URL =
13+ // Remove after merge
1314 "https://raw.githubusercontent.com/mendix/widgets-resources/master/configs/e2e/mendix-versions.json" ;
14-
15- // const MX_VERSION_MAP_URL =
16- // "https://raw.githubusercontent.com/mendix/web-widgets/main/automation/run-e2e/mendix-versions.json";
15+ // Uncomment after merge
16+ // "https://raw.githubusercontent.com/mendix/web-widgets/main/automation/run-e2e/mendix-versions.json";
1717
1818const { ls, cat } = sh ;
1919
2020export async function ci ( ) {
21- // assert.ok(process.env.CI, "This command meant to run in CI env");
2221 console . log ( c . cyan ( "Run e2e tests in CI environment" ) ) ;
2322
2423 const parseArgsOptions = {
@@ -31,7 +30,7 @@ export async function ci() {
3130 configuration : {
3231 // https://github.com/yargs/yargs-parser#boolean-negation
3332 "boolean-negation" : true ,
34- // https://github.com/yargs/yargs-parser#boolean-negation
33+ // https://github.com/yargs/yargs-parser#camel-case-expansion
3534 "camel-case-expansion" : true
3635 }
3736 } ;
@@ -94,19 +93,16 @@ async function getMendixVersion(options) {
9493 return process . env . MENDIX_VERSION ;
9594 }
9695
97- try {
98- const versionMapResponse = await fetch ( MX_VERSION_MAP_URL ) ;
99- if ( versionMapResponse . ok ) {
100- const { mxVersion } = options ;
101- const versionMap = await versionMapResponse . json ( ) ;
102- if ( mxVersion in versionMap ) {
103- return versionMap [ mxVersion ] ;
104- }
105-
106- return versionMap . latest ;
96+ const versionMapResponse = await fetch ( MX_VERSION_MAP_URL ) ;
97+ if ( versionMapResponse . ok ) {
98+ const { mxVersion } = options ;
99+ const versionMap = await versionMapResponse . json ( ) ;
100+ if ( mxVersion in versionMap ) {
101+ return versionMap [ mxVersion ] ;
107102 }
108- } catch ( err ) {
109- console . err ( err ) ;
110- throw new Error ( "Couldn't fetch mendix-versions.json" ) ;
103+
104+ return versionMap . latest ;
105+ } else {
106+ throw new Error ( `Couldn't fetch mendix-versions.json: ${ versionMapResponse . statusText } ` ) ;
111107 }
112108}
0 commit comments