fix self-test tests

This commit is contained in:
Nacho Codoñer
2025-05-13 16:57:59 +02:00
parent 7abf1cbfda
commit c3631d7baf
3 changed files with 15 additions and 13 deletions

View File

@@ -263,17 +263,20 @@ export function parseRunTargets(targets) {
export function getMeteorConfig(appDir) {
if (global.meteorConfig) return global.meteorConfig;
const packageJsonPath = files.pathJoin(appDir, 'package.json');
if (!files.exists(packageJsonPath)) {
return false;
let packageJson;
if (appDir) {
const packageJsonPath = files.pathJoin(appDir, 'package.json');
if (!files.exists(packageJsonPath)) {
return false;
}
const packageJsonFile = files.readFile(packageJsonPath, 'utf8');
packageJson = JSON.parse(packageJsonFile);
}
const packageJsonFile = files.readFile(packageJsonPath, 'utf8');
const packageJson = JSON.parse(packageJsonFile);
const meteorConfig = {
const modernForced = JSON.parse(process.env.METEOR_MODERN || "false");
global.meteorConfig = {
...(packageJson?.meteor || {}),
modern: projectContextModule.normalizeModern(projectContextModule.modernForced || packageJson?.meteor?.modern),
modern: projectContextModule.normalizeModern(modernForced || packageJson?.meteor?.modern || false),
};
global.meteorConfig = meteorConfig;
return global.meteorConfig;
}

View File

@@ -865,9 +865,9 @@ makeGlobalAsyncLocalStorage().run({}, async function () {
var appDir = files.findAppDir();
if (appDir) {
appDir = files.pathResolve(appDir);
// Initialize meteorConfig globally for command context
global.meteorConfig = getMeteorConfig(appDir);
}
// Initialize meteorConfig globally for command context
global.meteorConfig = getMeteorConfig(appDir);
await require('../tool-env/isopackets.js').ensureIsopacketsLoadable();

View File

@@ -1788,8 +1788,6 @@ export const normalizeModern = (r = false) => Object.fromEntries(
]),
);
export const modernForced = JSON.parse(process.env.METEOR_MODERN || "false");
export class MeteorConfig {
constructor({
appDirectory,
@@ -1834,11 +1832,12 @@ export class MeteorConfig {
},
}),
} : this._config;
const modernForced = JSON.parse(process.env.METEOR_MODERN || "false");
// Reinitialize meteorConfig globally for project context
// Updates config when package.json changes trigger rebuilds
global.meteorConfig = {
...(this._config || {}),
modern: normalizeModern(modernForced || this._config?.modern),
modern: normalizeModern(modernForced || this._config?.modern || false),
};
return this._config;
}