Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26669] TiAPI: Create Node-compatible assert module API

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2019-03-08T20:49:20.000+0000
Affected Version/sn/a
Fix Version/sRelease 8.1.0
ComponentsTiAPI
Labelsn/a
ReporterChristopher Williams
AssigneeChristopher Williams
Created2018-12-19T19:41:40.000+0000
Updated2019-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

Comments

  1. Christopher Williams 2019-02-26

    https://github.com/appcelerator/titanium_mobile/pull/10661
  2. Samir Mohammed 2019-06-13

    *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:
       const 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);
       }
       
    Test and other information can be found at (Including unit tests): https://github.com/appcelerator/titanium_mobile/pull/10661

JSON Source