@gjsify/assert 0.41.0 → 0.43.0

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/lib/esm/index.js CHANGED
@@ -1 +1 @@
1
- import"./_virtual/_rolldown/runtime.js";import{AssertionError as e}from"./assertion-error.js";import{isDeepEqual as t,isDeepStrictEqual as n}from"./deep-equal.js";function innerFail(t){throw t.message instanceof Error?t.message:new e({actual:t.actual,expected:t.expected,message:t.message,operator:t.operator,stackStartFn:t.stackStartFn})}function isPromiseLike(e){return typeof e==`object`&&!!e&&typeof e.then==`function`}function ok(e,t){e||innerFail({actual:e,expected:!0,message:t,operator:`==`,stackStartFn:ok})}function equal(e,t,n){e!=t&&innerFail({actual:e,expected:t,message:n,operator:`==`,stackStartFn:equal})}function notEqual(e,t,n){e==t&&innerFail({actual:e,expected:t,message:n,operator:`!=`,stackStartFn:notEqual})}function strictEqual(e,t,n){Object.is(e,t)||innerFail({actual:e,expected:t,message:n,operator:`strictEqual`,stackStartFn:strictEqual})}function notStrictEqual(e,t,n){Object.is(e,t)&&innerFail({actual:e,expected:t,message:n,operator:`notStrictEqual`,stackStartFn:notStrictEqual})}function deepEqual(e,n,r){t(e,n)||innerFail({actual:e,expected:n,message:r,operator:`deepEqual`,stackStartFn:deepEqual})}function notDeepEqual(e,n,r){t(e,n)&&innerFail({actual:e,expected:n,message:r,operator:`notDeepEqual`,stackStartFn:notDeepEqual})}function deepStrictEqual(e,t,r){n(e,t)||innerFail({actual:e,expected:t,message:r,operator:`deepStrictEqual`,stackStartFn:deepStrictEqual})}function notDeepStrictEqual(e,t,r){n(e,t)&&innerFail({actual:e,expected:t,message:r,operator:`notDeepStrictEqual`,stackStartFn:notDeepStrictEqual})}function getActual(e){let t=Symbol(`NO_EXCEPTION`);try{e()}catch(e){return e}return t}async function getActualAsync(e){let t=Symbol(`NO_EXCEPTION`);try{if(typeof e==`function`){let t=e();isPromiseLike(t)&&await t}else await e}catch(e){return e}return t}function expectedException(t,r,i,a){if(r===void 0)return!0;if(r instanceof RegExp){let n=String(t);if(r.test(n))return!0;throw new e({actual:t,expected:r,message:i,operator:a.name,stackStartFn:a})}if(typeof r==`function`){if(r.prototype!==void 0&&t instanceof r)return!0;if(Error.isPrototypeOf(r))return!1;if(r.call({},t)!==!0)throw new e({actual:t,expected:r,message:i,operator:a.name,stackStartFn:a});return!0}if(typeof r==`object`&&r){let o=Object.keys(r);for(let s of o){let o=r,c=t;if(typeof c[s]==`string`&&o[s]instanceof RegExp){if(!o[s].test(c[s]))throw new e({actual:t,expected:r,message:i,operator:a.name,stackStartFn:a})}else if(!n(c[s],o[s]))throw new e({actual:t,expected:r,message:i,operator:a.name,stackStartFn:a})}return!0}return!0}function throws(e,t,n){if(typeof e!=`function`)throw TypeError(`The "fn" argument must be of type function.`);let r;typeof t==`string`?(n=t,r=void 0):r=t;let i=getActual(e);typeof i==`symbol`&&innerFail({actual:void 0,expected:r,message:n||`Missing expected exception.`,operator:`throws`,stackStartFn:throws}),r!==void 0&&expectedException(i,r,n,throws)}function doesNotThrow(e,t,n){if(typeof e!=`function`)throw TypeError(`The "fn" argument must be of type function.`);let r;typeof t==`string`?(n=t,r=void 0):r=t;let i=getActual(e);if(typeof i!=`symbol`)throw r!==void 0&&typeof r==`function`&&r.prototype!==void 0&&i instanceof r&&innerFail({actual:i,expected:r,message:n||`Got unwanted exception.\n${i&&i.message?i.message:``}`,operator:`doesNotThrow`,stackStartFn:doesNotThrow}),(r===void 0||typeof r==`function`&&r.prototype!==void 0&&i instanceof r)&&innerFail({actual:i,expected:r,message:n||`Got unwanted exception.\n${i&&i.message?i.message:``}`,operator:`doesNotThrow`,stackStartFn:doesNotThrow}),i}async function rejects(e,t,n){let r;typeof t==`string`?(n=t,r=void 0):r=t;let i=await getActualAsync(e);typeof i==`symbol`&&innerFail({actual:void 0,expected:r,message:n||`Missing expected rejection.`,operator:`rejects`,stackStartFn:rejects}),r!==void 0&&expectedException(i,r,n,rejects)}async function doesNotReject(e,t,n){let r;typeof t==`string`?(n=t,r=void 0):r=t;let i=await getActualAsync(e);typeof i!=`symbol`&&innerFail({actual:i,expected:r,message:n||`Got unwanted rejection.\n${i&&i.message?i.message:``}`,operator:`doesNotReject`,stackStartFn:doesNotReject})}function fail(t,n,r,i,a){if(arguments.length===0||arguments.length===1){let n=arguments.length===0?`Failed`:typeof t==`string`?t:void 0;throw t instanceof Error?t:new e({message:n||`Failed`,operator:`fail`,stackStartFn:fail})}throw new e({actual:t,expected:n,message:r,operator:i||`fail`,stackStartFn:a||fail})}function ifError(t){if(t!=null){let n=`ifError got unwanted exception: `;typeof t==`object`&&typeof t.message==`string`?t.message.length===0&&t.constructor?n+=t.constructor.name:n+=t.message:n+=String(t);let r=new e({actual:t,expected:null,message:n,operator:`ifError`,stackStartFn:ifError}),i=t instanceof Error?t.stack:void 0;throw i&&(r.origStack=i),r}}function match(e,t,n){if(typeof e!=`string`)throw TypeError(`The "actual" argument must be of type string.`);if(!(t instanceof RegExp))throw TypeError(`The "expected" argument must be an instance of RegExp.`);t.test(e)||innerFail({actual:e,expected:t,message:n||`The input did not match the regular expression ${t}. Input:\n\n'${e}'\n`,operator:`match`,stackStartFn:match})}function doesNotMatch(e,t,n){if(typeof e!=`string`)throw TypeError(`The "actual" argument must be of type string.`);if(!(t instanceof RegExp))throw TypeError(`The "expected" argument must be an instance of RegExp.`);t.test(e)&&innerFail({actual:e,expected:t,message:n||`The input was expected to not match the regular expression ${t}. Input:\n\n'${e}'\n`,operator:`doesNotMatch`,stackStartFn:doesNotMatch})}const r=Object.assign(function strict(e,t){ok(e,t)},{AssertionError:e,ok,equal:strictEqual,notEqual:notStrictEqual,deepEqual:deepStrictEqual,notDeepEqual:notDeepStrictEqual,deepStrictEqual,notDeepStrictEqual,strictEqual,notStrictEqual,throws,doesNotThrow,rejects,doesNotReject,fail,ifError,match,doesNotMatch,strict:void 0});r.strict=r;const i=Object.assign(function assert(e,t){ok(e,t)},{AssertionError:e,ok,equal,notEqual,strictEqual,notStrictEqual,deepEqual,notDeepEqual,deepStrictEqual,notDeepStrictEqual,throws,doesNotThrow,rejects,doesNotReject,fail,ifError,match,doesNotMatch,strict:r});export{e as AssertionError,deepEqual,deepStrictEqual,i as default,doesNotMatch,doesNotReject,doesNotThrow,equal,fail,ifError,match,notDeepEqual,notDeepStrictEqual,notEqual,notStrictEqual,ok,rejects,r as strict,strictEqual,throws};
1
+ import"./_virtual/_rolldown/runtime.js";import{AssertionError as e}from"./assertion-error.js";import{isDeepEqual as t,isDeepStrictEqual as n}from"./deep-equal.js";function innerFail(t){throw t.message instanceof Error?t.message:new e({actual:t.actual,expected:t.expected,message:t.message,operator:t.operator,stackStartFn:t.stackStartFn})}function isPromiseLike(e){return typeof e==`object`&&!!e&&typeof e.then==`function`}function ok(e,t){e||innerFail({actual:e,expected:!0,message:t,operator:`==`,stackStartFn:ok})}function equal(e,t,n){e!=t&&innerFail({actual:e,expected:t,message:n,operator:`==`,stackStartFn:equal})}function notEqual(e,t,n){e==t&&innerFail({actual:e,expected:t,message:n,operator:`!=`,stackStartFn:notEqual})}function strictEqual(e,t,n){Object.is(e,t)||innerFail({actual:e,expected:t,message:n,operator:`strictEqual`,stackStartFn:strictEqual})}function notStrictEqual(e,t,n){Object.is(e,t)&&innerFail({actual:e,expected:t,message:n,operator:`notStrictEqual`,stackStartFn:notStrictEqual})}function deepEqual(e,n,r){t(e,n)||innerFail({actual:e,expected:n,message:r,operator:`deepEqual`,stackStartFn:deepEqual})}function notDeepEqual(e,n,r){t(e,n)&&innerFail({actual:e,expected:n,message:r,operator:`notDeepEqual`,stackStartFn:notDeepEqual})}function deepStrictEqual(e,t,r){n(e,t)||innerFail({actual:e,expected:t,message:r,operator:`deepStrictEqual`,stackStartFn:deepStrictEqual})}function notDeepStrictEqual(e,t,r){n(e,t)&&innerFail({actual:e,expected:t,message:r,operator:`notDeepStrictEqual`,stackStartFn:notDeepStrictEqual})}function getActual(e){let t=Symbol(`NO_EXCEPTION`);try{e()}catch(e){return e}return t}async function getActualAsync(e){let t=Symbol(`NO_EXCEPTION`);try{if(typeof e==`function`){let t=e();isPromiseLike(t)&&await t}else await e}catch(e){return e}return t}function expectedException(t,r,i,a){if(r===void 0)return!0;if(r instanceof RegExp){let n=String(t);if(r.test(n))return!0;throw new e({actual:t,expected:r,message:i,operator:a.name,stackStartFn:a})}if(typeof r==`function`){if(r.prototype!==void 0&&t instanceof r)return!0;if(Error.isPrototypeOf(r))return!1;if(r.call({},t)!==!0)throw new e({actual:t,expected:r,message:i,operator:a.name,stackStartFn:a});return!0}if(typeof r==`object`&&r){let o=Object.keys(r);for(let s of o){let o=r,c=t;if(typeof c[s]==`string`&&o[s]instanceof RegExp){if(!o[s].test(c[s]))throw new e({actual:t,expected:r,message:i,operator:a.name,stackStartFn:a})}else if(!n(c[s],o[s]))throw new e({actual:t,expected:r,message:i,operator:a.name,stackStartFn:a})}return!0}return!0}function throws(e,t,n){if(typeof e!=`function`)throw TypeError(`The "fn" argument must be of type function.`);let r;typeof t==`string`?(n=t,r=void 0):r=t;let i=getActual(e);typeof i==`symbol`&&innerFail({actual:void 0,expected:r,message:n||`Missing expected exception.`,operator:`throws`,stackStartFn:throws}),r!==void 0&&expectedException(i,r,n,throws)}function doesNotThrow(e,t,n){if(typeof e!=`function`)throw TypeError(`The "fn" argument must be of type function.`);let r;typeof t==`string`?(n=t,r=void 0):r=t;let i=getActual(e);if(typeof i!=`symbol`)throw r!==void 0&&typeof r==`function`&&r.prototype!==void 0&&i instanceof r&&innerFail({actual:i,expected:r,message:n||`Got unwanted exception.\n${i&&i.message?i.message:``}`,operator:`doesNotThrow`,stackStartFn:doesNotThrow}),(r===void 0||typeof r==`function`&&r.prototype!==void 0&&i instanceof r)&&innerFail({actual:i,expected:r,message:n||`Got unwanted exception.\n${i&&i.message?i.message:``}`,operator:`doesNotThrow`,stackStartFn:doesNotThrow}),i}async function rejects(e,t,n){let r;typeof t==`string`?(n=t,r=void 0):r=t;let i=await getActualAsync(e);typeof i==`symbol`&&innerFail({actual:void 0,expected:r,message:n||`Missing expected rejection.`,operator:`rejects`,stackStartFn:rejects}),r!==void 0&&expectedException(i,r,n,rejects)}async function doesNotReject(e,t,n){let r;typeof t==`string`?(n=t,r=void 0):r=t;let i=await getActualAsync(e);typeof i!=`symbol`&&innerFail({actual:i,expected:r,message:n||`Got unwanted rejection.\n${i&&i.message?i.message:``}`,operator:`doesNotReject`,stackStartFn:doesNotReject})}function fail(t,n,r,i,a){if(arguments.length===0||arguments.length===1){let n=arguments.length===0?`Failed`:typeof t==`string`?t:void 0;throw t instanceof Error?t:new e({message:n||`Failed`,operator:`fail`,stackStartFn:fail})}throw new e({actual:t,expected:n,message:r,operator:i||`fail`,stackStartFn:a||fail})}function ifError(t){if(t!=null){let n=`ifError got unwanted exception: `;typeof t==`object`&&typeof t.message==`string`?t.message.length===0&&t.constructor?n+=t.constructor.name:n+=t.message:n+=String(t);let r=new e({actual:t,expected:null,message:n,operator:`ifError`,stackStartFn:ifError}),i=t instanceof Error?t.stack:void 0;throw i&&(r.origStack=i),r}}function match(e,t,n){if(typeof e!=`string`)throw TypeError(`The "actual" argument must be of type string.`);if(!(t instanceof RegExp))throw TypeError(`The "expected" argument must be an instance of RegExp.`);t.test(e)||innerFail({actual:e,expected:t,message:n||`The input did not match the regular expression ${t}. Input:\n\n'${e}'\n`,operator:`match`,stackStartFn:match})}function doesNotMatch(e,t,n){if(typeof e!=`string`)throw TypeError(`The "actual" argument must be of type string.`);if(!(t instanceof RegExp))throw TypeError(`The "expected" argument must be an instance of RegExp.`);t.test(e)&&innerFail({actual:e,expected:t,message:n||`The input was expected to not match the regular expression ${t}. Input:\n\n'${e}'\n`,operator:`doesNotMatch`,stackStartFn:doesNotMatch})}const r=Object.assign(function strict(e,t){ok(e,t)},{AssertionError:e,ok,equal:strictEqual,notEqual:notStrictEqual,deepEqual:deepStrictEqual,notDeepEqual:notDeepStrictEqual,deepStrictEqual,notDeepStrictEqual,strictEqual,notStrictEqual,throws,doesNotThrow,rejects,doesNotReject,fail,ifError,match,doesNotMatch,strict:void 0});r.strict=r;const i=Object.assign(function assert(e,t){ok(e,t)},{AssertionError:e,ok,equal,notEqual,strictEqual,notStrictEqual,deepEqual,notDeepEqual,deepStrictEqual,notDeepStrictEqual,throws,doesNotThrow,rejects,doesNotReject,fail,ifError,match,doesNotMatch,strict:r});export{e as AssertionError,deepEqual,deepStrictEqual,i as default,i as"module.exports",doesNotMatch,doesNotReject,doesNotThrow,equal,fail,ifError,match,notDeepEqual,notDeepStrictEqual,notEqual,notStrictEqual,ok,rejects,r as strict,strictEqual,throws};
@@ -1 +1 @@
1
- import{AssertionError as e}from"../assertion-error.js";import{deepStrictEqual as t,doesNotMatch as n,doesNotReject as r,doesNotThrow as i,fail as a,ifError as o,match as s,notDeepStrictEqual as c,notStrictEqual as l,ok as u,rejects as d,strict as f,strictEqual as p,throws as m}from"../index.js";export{e as AssertionError,t as deepEqual,t as deepStrictEqual,f as default,n as doesNotMatch,r as doesNotReject,i as doesNotThrow,p as equal,a as fail,o as ifError,s as match,c as notDeepEqual,c as notDeepStrictEqual,l as notEqual,l as notStrictEqual,u as ok,d as rejects,f as strict,p as strictEqual,m as throws};
1
+ import{AssertionError as e}from"../assertion-error.js";import{deepStrictEqual as t,doesNotMatch as n,doesNotReject as r,doesNotThrow as i,fail as a,ifError as o,match as s,notDeepStrictEqual as c,notStrictEqual as l,ok as u,rejects as d,strict as f,strictEqual as p,throws as m}from"../index.js";export{e as AssertionError,t as deepEqual,t as deepStrictEqual,f as default,n as doesNotMatch,r as doesNotReject,i as doesNotThrow,p as equal,a as fail,o as ifError,s as match,f as"module.exports",c as notDeepEqual,c as notDeepStrictEqual,l as notEqual,l as notStrictEqual,u as ok,d as rejects,f as strict,p as strictEqual,m as throws};
@@ -43,3 +43,4 @@ declare const assert: ((value: unknown, message?: string | Error) => void) & {
43
43
  };
44
44
  export { ok, equal, notEqual, strictEqual, notStrictEqual, deepEqual, notDeepEqual, deepStrictEqual, notDeepStrictEqual, throws, doesNotThrow, rejects, doesNotReject, fail, ifError, match, doesNotMatch, strict, };
45
45
  export default assert;
46
+ export { assert as 'module.exports' };
@@ -1,2 +1,3 @@
1
1
  export { strict as default, strict } from '../index.js';
2
2
  export { AssertionError, ok, fail, ifError, match, doesNotMatch, throws, doesNotThrow, rejects, doesNotReject, strictEqual, notStrictEqual, deepStrictEqual, notDeepStrictEqual, strictEqual as equal, notStrictEqual as notEqual, deepStrictEqual as deepEqual, notDeepStrictEqual as notDeepEqual, } from '../index.js';
3
+ export { strict as 'module.exports' } from '../index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/assert",
3
- "version": "0.41.0",
3
+ "version": "0.43.0",
4
4
  "description": "Node.js assert module for Gjs",
5
5
  "type": "module",
6
6
  "module": "lib/esm/index.js",
@@ -42,8 +42,8 @@
42
42
  "assert"
43
43
  ],
44
44
  "devDependencies": {
45
- "@gjsify/cli": "^0.41.0",
46
- "@gjsify/unit": "^0.41.0",
45
+ "@gjsify/cli": "^0.43.0",
46
+ "@gjsify/unit": "^0.43.0",
47
47
  "@types/node": "^25.9.2",
48
48
  "typescript": "^6.0.3"
49
49
  },