vona-core 5.1.48 → 5.1.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2872,6 +2872,15 @@ class AppHmr extends BeanSimple {
2872
2872
  }
2873
2873
  }
2874
2874
 
2875
+ const TEST_REQUIRE_FRESH_RESOURCES_ENV = 'VONA_TEST_REQUIRE_FRESH_RESOURCES';
2876
+ function requiresFreshTestResources(env = process.env) {
2877
+ const value = env[TEST_REQUIRE_FRESH_RESOURCES_ENV];
2878
+ if (value !== undefined && value !== 'true') {
2879
+ throw new Error('Invalid strict test resource freshness flag');
2880
+ }
2881
+ return value === 'true';
2882
+ }
2883
+
2875
2884
  const SymbolLoggerInstances = Symbol('SymbolLoggerInstances');
2876
2885
  const SymbolRawLoggerInstances = Symbol('SymbolRawLoggerInstances');
2877
2886
  class AppLogger extends BeanSimple {
@@ -2887,7 +2896,9 @@ class AppLogger extends BeanSimple {
2887
2896
  }
2888
2897
  }
2889
2898
  get(clientName) {
2890
- if (getRequestBoundary()) return getSuppressedDiagnosticLogger();
2899
+ if (requiresFreshTestResources() || getRequestBoundary()) {
2900
+ return getSuppressedDiagnosticLogger();
2901
+ }
2891
2902
  clientName = clientName || 'default';
2892
2903
  if (!this[SymbolLoggerInstances][clientName]) {
2893
2904
  const raw = this._createClient(clientName);
@@ -2897,7 +2908,9 @@ class AppLogger extends BeanSimple {
2897
2908
  return this[SymbolLoggerInstances][clientName];
2898
2909
  }
2899
2910
  child(childName, clientName) {
2900
- if (getRequestBoundary()) return getSuppressedDiagnosticLogger();
2911
+ if (requiresFreshTestResources() || getRequestBoundary()) {
2912
+ return getSuppressedDiagnosticLogger();
2913
+ }
2901
2914
  const logger = this.get(clientName);
2902
2915
  if (!childName) return logger;
2903
2916
  return logger.child({
@@ -2953,6 +2966,9 @@ class AppLogger extends BeanSimple {
2953
2966
  }, Winston);
2954
2967
  }
2955
2968
  createTransportFile(fileName, clientInfo, options) {
2969
+ if (requiresFreshTestResources()) {
2970
+ throw new Error('Strict test file logger transport is disabled');
2971
+ }
2956
2972
  const dirname = this.app.config.logger.baseDir;
2957
2973
  if (!fse.existsSync(dirname)) {
2958
2974
  const [_, err] = catchErrorSync(() => {
@@ -4482,15 +4498,7 @@ function assertTestClaimRedisClient(app, clientName, options) {
4482
4498
  if (plan.kind === 'client' ? options.keyPrefix !== plan.prefix : options.keyPrefix !== undefined) throw new Error('Unregistered managed Redis key prefix');
4483
4499
  }
4484
4500
 
4485
- const TEST_REQUIRE_FRESH_RESOURCES_ENV = 'VONA_TEST_REQUIRE_FRESH_RESOURCES';
4486
4501
  const freshApps = new WeakSet();
4487
- function requiresFreshTestResources() {
4488
- const value = process.env[TEST_REQUIRE_FRESH_RESOURCES_ENV];
4489
- if (value !== undefined && value !== 'true') {
4490
- throw new Error('Invalid strict test resource freshness flag');
4491
- }
4492
- return value === 'true';
4493
- }
4494
4502
  function assertFreshTestResourcesReady(app) {
4495
4503
  if (!requiresFreshTestResources()) return;
4496
4504
  if (!freshApps.has(app)) throw new Error('Strict test resource freshness was not established');