@carbonorm/carbonreact 3.3.2 → 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/hoc/setupTests.d.ts +3 -3
- package/dist/index.cjs.js +12 -14
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +12 -14
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/hoc/setupTests.tsx +13 -16
package/dist/index.esm.js
CHANGED
|
@@ -4251,33 +4251,31 @@ function validSQL$1 (sql) {
|
|
|
4251
4251
|
validSQL.push({ [expect.getState().currentTestName.replaceAll(" ", "_").toLowerCase()]: sql });
|
|
4252
4252
|
}
|
|
4253
4253
|
|
|
4254
|
-
function setupTests ({ sqlDirectory = './logs/rest/', logsDirectory = './logs/tests/' }) {
|
|
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
|
-
|
|
4269
|
-
error: (...args) => (isVerbose &&
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
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
|
-
|
|
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 () => {
|