[TIMOB-26669] TiAPI: Create Node-compatible assert module API
| GitHub Issue | n/a |
|---|---|
| Type | New Feature |
| Priority | Medium |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2019-03-08T20:49:20.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Release 8.1.0 |
| Components | TiAPI |
| Labels | n/a |
| Reporter | Christopher Williams |
| Assignee | Christopher Williams |
| Created | 2018-12-19T19:41:40.000+0000 |
| Updated | 2019-07-29T14:41:11.000+0000 |
Description
It'd be useful to create equivalents of some of the core Node modules in Titanium so that users could port/re-use node codebases on mobile devices. Some of the more common modules could map relatively easily to devices, and would be worth investigating.
https://nodejs.org/api/assert.html
https://github.com/appcelerator/titanium_mobile/pull/10661
*Closing ticket*, featured verified in SDK version
8.2.0.v20190612155743,8.1.0.v20190612160220. Tested using examples from https://nodejs.org/api/assert.html e.g:Test and other information can be found at (Including unit tests): https://github.com/appcelerator/titanium_mobile/pull/10661const assert = require('assert'); // Generate an AssertionError to compare the error message later: const { message } = new assert.AssertionError({ actual: 1, expected: 2, operator: 'strictEqual' }); // Verify error output: try { assert.strictEqual(1, 2); } catch (err) { assert(err instanceof assert.AssertionError); assert.strictEqual(err.message, message); assert.strictEqual(err.name, 'AssertionError'); assert.strictEqual(err.actual, 1); assert.strictEqual(err.expected, 2); assert.strictEqual(err.code, 'ERR_ASSERTION'); assert.strictEqual(err.operator, 'strictEqual'); assert.strictEqual(err.generatedMessage, true); }