@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carbonorm/carbonreact",
3
- "version": "3.3.3",
3
+ "version": "3.3.4",
4
4
  "browser": "dist/index.umd.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "main": "dist/index.cjs.js",
@@ -8,41 +8,38 @@ export default function ({sqlDirectory = './logs/rest/', logsDirectory = './logs
8
8
 
9
9
  const originalWindowLocation = window.location
10
10
 
11
+ const consoleOriginal = console;
12
+
11
13
  const testName = () => expect.getState().currentTestName?.replaceAll(" ", "_").toLowerCase()
12
14
 
13
15
  const validSqlFile = () => sqlDirectory + testName() + '.json';
14
16
 
15
17
  const logsFile = () => logsDirectory + testName() + '.log';
16
18
 
17
- /* eslint-disable no-undef */
18
19
  expect(document).not.toBeNull();
19
20
 
20
-
21
- const orig = console;
22
-
23
21
  // @link https://stackoverflow.com/questions/13542667/create-directory-when-writing-to-file-in-node-js
24
22
  const asyncFileLogging = async (...args) => fs.writeFileSync(
25
23
  logsFile(),
26
24
  '\n' + inspect(args.length === 1 ? args.pop() : args, false, 10, true),
27
25
  {flag: "a+"});
28
26
 
29
- // noinspection CommaExpressionJS
30
27
  global.console = {
31
28
  ...console,
32
29
  // use jest.fn() to silence, comment out to leave as it is
33
- log: (...args) => (isVerbose && orig.log(...args), asyncFileLogging('log', ...args)),
34
- error: (...args) => (isVerbose && orig.error(...args), asyncFileLogging('error', ...args)),
35
- warn: (...args) => (isVerbose && orig.warn(...args), asyncFileLogging('warn', ...args)),
36
- info: (...args) => (isVerbose && orig.info(...args), asyncFileLogging('info', ...args)),
37
- debug: (...args) => (isVerbose && orig.debug(...args), asyncFileLogging('debug', ...args)),
38
- table: (...args) => (isVerbose && orig.table(...args), asyncFileLogging('table', ...args)),
39
- trace: (...args) => (isVerbose && orig.trace(...args), asyncFileLogging((() => {
30
+ debug: (...args) => (isVerbose && consoleOriginal.debug(...args), asyncFileLogging('debug', ...args)),
31
+ error: (...args) => (isVerbose && consoleOriginal.error(...args), asyncFileLogging('error', ...args)),
32
+ group: (...args) => (isVerbose && consoleOriginal.group(...args), asyncFileLogging('group', ...args)),
33
+ groupCollapsed: (...args) => (isVerbose && consoleOriginal.groupCollapsed(args), asyncFileLogging('groupCollapsed', ...args)),
34
+ groupEnd: () => (isVerbose && consoleOriginal.groupEnd(), asyncFileLogging('groupEnd')),
35
+ info: (...args) => (isVerbose && consoleOriginal.info(...args), asyncFileLogging('info', ...args)),
36
+ log: (...args) => (isVerbose && consoleOriginal.log(...args), asyncFileLogging('log', ...args)),
37
+ table: (...args) => (isVerbose && consoleOriginal.table(...args), asyncFileLogging('table', ...args)),
38
+ trace: (...args) => (isVerbose && consoleOriginal.trace(...args), asyncFileLogging((() => {
40
39
  const err = new Error();
41
40
  return err.stack;
42
41
  })())),
43
- group: (...args) => (isVerbose && orig.group(...args), asyncFileLogging('group', ...args)),
44
- groupCollapsed: (...args) => (isVerbose && orig.groupCollapsed(args), asyncFileLogging('groupCollapsed', ...args)),
45
- groupEnd: () => (isVerbose && orig.groupEnd(), asyncFileLogging('groupEnd')),
42
+ warn: (...args) => (isVerbose && consoleOriginal.warn(...args), asyncFileLogging('warn', ...args)),
46
43
  };
47
44
 
48
45
  afterEach(async () => {