@carbonorm/carbonreact 3.3.3 → 3.3.5

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.esm.js CHANGED
@@ -4253,43 +4253,40 @@ function validSQL$1 (sql) {
4253
4253
 
4254
4254
  function setupTests ({ sqlDirectory = './logs/rest/', logsDirectory = './logs/tests/' } = {}) {
4255
4255
  const originalWindowLocation = window.location;
4256
+ const consoleOriginal = console;
4256
4257
  const testName = () => expect.getState().currentTestName?.replaceAll(" ", "_").toLowerCase();
4257
4258
  const validSqlFile = () => sqlDirectory + testName() + '.json';
4258
4259
  const logsFile = () => logsDirectory + testName() + '.log';
4259
- /* eslint-disable no-undef */
4260
4260
  expect(document).not.toBeNull();
4261
- const orig = console;
4262
4261
  // @link https://stackoverflow.com/questions/13542667/create-directory-when-writing-to-file-in-node-js
4263
4262
  const asyncFileLogging = async (...args) => fs.writeFileSync(logsFile(), '\n' + inspect(args.length === 1 ? args.pop() : args, false, 10, true), { flag: "a+" });
4264
- // noinspection CommaExpressionJS
4265
4263
  global.console = {
4266
4264
  ...console,
4267
4265
  // use jest.fn() to silence, comment out to leave as it is
4268
- log: (...args) => (isVerbose && orig.log(...args), asyncFileLogging('log', ...args)),
4269
- error: (...args) => (isVerbose && orig.error(...args), asyncFileLogging('error', ...args)),
4270
- warn: (...args) => (isVerbose && orig.warn(...args), asyncFileLogging('warn', ...args)),
4271
- info: (...args) => (isVerbose && orig.info(...args), asyncFileLogging('info', ...args)),
4272
- debug: (...args) => (isVerbose && orig.debug(...args), asyncFileLogging('debug', ...args)),
4273
- table: (...args) => (isVerbose && orig.table(...args), asyncFileLogging('table', ...args)),
4274
- trace: (...args) => (isVerbose && orig.trace(...args), asyncFileLogging((() => {
4266
+ debug: (...args) => (isVerbose && consoleOriginal.debug(...args), asyncFileLogging('debug', ...args)),
4267
+ error: (...args) => (isVerbose && consoleOriginal.error(...args), asyncFileLogging('error', ...args)),
4268
+ group: (...args) => (isVerbose && consoleOriginal.group(...args), asyncFileLogging('group', ...args)),
4269
+ groupCollapsed: (...args) => (isVerbose && consoleOriginal.groupCollapsed(args), asyncFileLogging('groupCollapsed', ...args)),
4270
+ groupEnd: () => (isVerbose && consoleOriginal.groupEnd(), asyncFileLogging('groupEnd')),
4271
+ info: (...args) => (isVerbose && consoleOriginal.info(...args), asyncFileLogging('info', ...args)),
4272
+ log: (...args) => (isVerbose && consoleOriginal.log(...args), asyncFileLogging('log', ...args)),
4273
+ table: (...args) => (isVerbose && consoleOriginal.table(...args), asyncFileLogging('table', ...args)),
4274
+ trace: (...args) => (isVerbose && consoleOriginal.trace(...args), asyncFileLogging((() => {
4275
4275
  const err = new Error();
4276
4276
  return err.stack;
4277
4277
  })())),
4278
- group: (...args) => (isVerbose && orig.group(...args), asyncFileLogging('group', ...args)),
4279
- groupCollapsed: (...args) => (isVerbose && orig.groupCollapsed(args), asyncFileLogging('groupCollapsed', ...args)),
4280
- groupEnd: () => (isVerbose && orig.groupEnd(), asyncFileLogging('groupEnd')),
4278
+ warn: (...args) => (isVerbose && consoleOriginal.warn(...args), asyncFileLogging('warn', ...args)),
4281
4279
  };
4282
4280
  afterEach(async () => {
4283
4281
  await waitFor(async () => {
4284
4282
  expect(checkAllRequestsComplete()).toEqual(true);
4285
4283
  }, { timeout: 3000, interval: 1000 });
4286
- // this must be a dynamic import to avoid loading dependencies out of order
4287
- // await waitForTrailingRequests({testPassed: true, timeout: 12000})
4288
- console.log('After each Test (' + expect.getState().currentTestName + ')', expect.getState());
4284
+ const jsonSQL = JSON.stringify(validSQL, undefined, 2) ?? '';
4285
+ console.log('After each Test (' + expect.getState().currentTestName + ') + (' + jsonSQL + ')', expect.getState());
4289
4286
  // restore `window.location` to the original `jsdom`
4290
4287
  // `Location` object
4291
4288
  window.location = originalWindowLocation;
4292
- fs.writeFileSync(validSqlFile(), JSON.stringify(validSQL, undefined, 2) ?? '');
4289
+ fs.writeFileSync(validSqlFile(), jsonSQL);
4293
4290
  }, 65000);
4294
4291
  }
4295
4292