@carbonorm/carbonreact 3.3.3 → 3.3.4
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.cjs.js +11 -13
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +11 -13
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/hoc/setupTests.tsx +12 -15
package/dist/index.cjs.js
CHANGED
|
@@ -4255,31 +4255,29 @@ function validSQL$1 (sql) {
|
|
|
4255
4255
|
|
|
4256
4256
|
function setupTests ({ sqlDirectory = './logs/rest/', logsDirectory = './logs/tests/' } = {}) {
|
|
4257
4257
|
const originalWindowLocation = window.location;
|
|
4258
|
+
const consoleOriginal = console;
|
|
4258
4259
|
const testName = () => expect.getState().currentTestName?.replaceAll(" ", "_").toLowerCase();
|
|
4259
4260
|
const validSqlFile = () => sqlDirectory + testName() + '.json';
|
|
4260
4261
|
const logsFile = () => logsDirectory + testName() + '.log';
|
|
4261
|
-
/* eslint-disable no-undef */
|
|
4262
4262
|
expect(document).not.toBeNull();
|
|
4263
|
-
const orig = console;
|
|
4264
4263
|
// @link https://stackoverflow.com/questions/13542667/create-directory-when-writing-to-file-in-node-js
|
|
4265
4264
|
const asyncFileLogging = async (...args) => fs.writeFileSync(logsFile(), '\n' + util.inspect(args.length === 1 ? args.pop() : args, false, 10, true), { flag: "a+" });
|
|
4266
|
-
// noinspection CommaExpressionJS
|
|
4267
4265
|
global.console = {
|
|
4268
4266
|
...console,
|
|
4269
4267
|
// use jest.fn() to silence, comment out to leave as it is
|
|
4270
|
-
|
|
4271
|
-
error: (...args) => (carbonnode.isVerbose &&
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4268
|
+
debug: (...args) => (carbonnode.isVerbose && consoleOriginal.debug(...args), asyncFileLogging('debug', ...args)),
|
|
4269
|
+
error: (...args) => (carbonnode.isVerbose && consoleOriginal.error(...args), asyncFileLogging('error', ...args)),
|
|
4270
|
+
group: (...args) => (carbonnode.isVerbose && consoleOriginal.group(...args), asyncFileLogging('group', ...args)),
|
|
4271
|
+
groupCollapsed: (...args) => (carbonnode.isVerbose && consoleOriginal.groupCollapsed(args), asyncFileLogging('groupCollapsed', ...args)),
|
|
4272
|
+
groupEnd: () => (carbonnode.isVerbose && consoleOriginal.groupEnd(), asyncFileLogging('groupEnd')),
|
|
4273
|
+
info: (...args) => (carbonnode.isVerbose && consoleOriginal.info(...args), asyncFileLogging('info', ...args)),
|
|
4274
|
+
log: (...args) => (carbonnode.isVerbose && consoleOriginal.log(...args), asyncFileLogging('log', ...args)),
|
|
4275
|
+
table: (...args) => (carbonnode.isVerbose && consoleOriginal.table(...args), asyncFileLogging('table', ...args)),
|
|
4276
|
+
trace: (...args) => (carbonnode.isVerbose && consoleOriginal.trace(...args), asyncFileLogging((() => {
|
|
4277
4277
|
const err = new Error();
|
|
4278
4278
|
return err.stack;
|
|
4279
4279
|
})())),
|
|
4280
|
-
|
|
4281
|
-
groupCollapsed: (...args) => (carbonnode.isVerbose && orig.groupCollapsed(args), asyncFileLogging('groupCollapsed', ...args)),
|
|
4282
|
-
groupEnd: () => (carbonnode.isVerbose && orig.groupEnd(), asyncFileLogging('groupEnd')),
|
|
4280
|
+
warn: (...args) => (carbonnode.isVerbose && consoleOriginal.warn(...args), asyncFileLogging('warn', ...args)),
|
|
4283
4281
|
};
|
|
4284
4282
|
afterEach(async () => {
|
|
4285
4283
|
await react$1.waitFor(async () => {
|