Skip to content
Open
Changes from all commits
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
28 changes: 27 additions & 1 deletion automation/run-e2e/lib/dev.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import { spawnSync } from "node:child_process";
import { spawnSync, execSync } from "node:child_process";
import { delimiter } from "node:path";
import { fileURLToPath } from "node:url";
import parseArgs from "yargs-parser";
import c from "ansi-colors";
import enquirer from "enquirer";
import sh from "shelljs";
import { setupTestProject } from "./setup-test-project.mjs";
import { updateTestProject } from "./update-test-project.mjs";
import { await200 } from "./utils.mjs";
import * as config from "./config.mjs";

const { ls } = sh;

export async function dev() {
console.log(c.cyan("Run e2e tests in development environment"));

Expand Down Expand Up @@ -53,6 +56,29 @@ export async function dev() {
)
);

// Print out Mendix version from MPR file
try {
const mprFiles = ls(config.mprFileGlob);
if (mprFiles.length > 0) {
const mprFile = mprFiles[0];
try {
const version = execSync(`sqlite3 "${mprFile}" "select _ProductVersion from _MetaData;"`, {
encoding: "utf-8",
stdio: ["pipe", "pipe", "pipe"]
}).trim();
console.log(c.cyan(`Test project was created with Mendix version: ${c.bold(version)}`));
} catch (error) {
if (error.message.includes("sqlite3") || error.code === "ENOENT") {
console.log(c.gray("sqlite3 command not found, unable to get Mendix version info"));
} else {
console.log(c.gray("Unable to read Mendix version from project file"));
}
}
}
} catch {
console.log(c.gray("Unable to determine Mendix version"));
}

await enquirer.prompt({
type: "confirm",
name: "__ignore__",
Expand Down
Loading