@jsenv/test 3.0.14 → 3.0.15

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.
Files changed (2) hide show
  1. package/dist/jsenv_test.js +44 -1
  2. package/package.json +1 -1
@@ -5,7 +5,6 @@ import { takeCoverage } from "node:v8";
5
5
  import stripAnsi from "strip-ansi";
6
6
  import { URL_META, createException } from "./js/exception.js";
7
7
  import stringWidth from "string-width";
8
- import { isBrowser } from "environment";
9
8
  import tty from "node:tty";
10
9
  import { pathToFileURL, fileURLToPath } from "node:url";
11
10
  import { dirname } from "node:path";
@@ -619,6 +618,50 @@ const error = (...args) => console.error(...args);
619
618
 
620
619
  const errorDisabled = () => {};
621
620
 
621
+ /* globals WorkerGlobalScope, DedicatedWorkerGlobalScope, SharedWorkerGlobalScope, ServiceWorkerGlobalScope */
622
+
623
+ const isBrowser = globalThis.window?.document !== undefined;
624
+
625
+ globalThis.process?.versions?.node !== undefined;
626
+
627
+ globalThis.process?.versions?.bun !== undefined;
628
+
629
+ globalThis.Deno?.version?.deno !== undefined;
630
+
631
+ globalThis.process?.versions?.electron !== undefined;
632
+
633
+ globalThis.navigator?.userAgent?.includes('jsdom') === true;
634
+
635
+ typeof WorkerGlobalScope !== 'undefined' && globalThis instanceof WorkerGlobalScope;
636
+
637
+ typeof DedicatedWorkerGlobalScope !== 'undefined' && globalThis instanceof DedicatedWorkerGlobalScope;
638
+
639
+ typeof SharedWorkerGlobalScope !== 'undefined' && globalThis instanceof SharedWorkerGlobalScope;
640
+
641
+ typeof ServiceWorkerGlobalScope !== 'undefined' && globalThis instanceof ServiceWorkerGlobalScope;
642
+
643
+ // Note: I'm intentionally not DRYing up the other variables to keep them "lazy".
644
+ const platform = globalThis.navigator?.userAgentData?.platform;
645
+
646
+ platform === 'macOS'
647
+ || globalThis.navigator?.platform === 'MacIntel' // Even on Apple silicon Macs.
648
+ || globalThis.navigator?.userAgent?.includes(' Mac ') === true
649
+ || globalThis.process?.platform === 'darwin';
650
+
651
+ platform === 'Windows'
652
+ || globalThis.navigator?.platform === 'Win32'
653
+ || globalThis.process?.platform === 'win32';
654
+
655
+ platform === 'Linux'
656
+ || globalThis.navigator?.platform?.startsWith('Linux') === true
657
+ || globalThis.navigator?.userAgent?.includes(' Linux ') === true
658
+ || globalThis.process?.platform === 'linux';
659
+
660
+ platform === 'Android'
661
+ || globalThis.navigator?.platform === 'Android'
662
+ || globalThis.navigator?.userAgent?.includes(' Android ') === true
663
+ || globalThis.process?.platform === 'android';
664
+
622
665
  const ESC = '\u001B[';
623
666
 
624
667
  !isBrowser && process$1.env.TERM_PROGRAM === 'Apple_Terminal';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/test",
3
- "version": "3.0.14",
3
+ "version": "3.0.15",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",