Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23875] Windows: Incorrect __filename value

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionFixed
Resolution Date2016-09-09T21:43:44.000+0000
Affected Version/sRelease 6.0.0
Fix Version/sRelease 6.0.0
ComponentsWindows
Labelsqe-6.0.0, regression
ReporterEwan Harris
AssigneeKota Iguchi
Created2016-09-07T15:34:01.000+0000
Updated2016-09-12T11:08:49.000+0000

Description

Description

When using the code below the logged value is set incorrectly to '/sub.js', it should be /'index.js'. In 5.4.0.GA the code returned the value 'index', although this value is different to the expected value, because it no longer refers to the correct file I am labeling this a *regression* Removing require('./sub.js') makes the issue disappear so the error is probably caused by that require. This can also be confirmed by doing var filename = __filename before the require and then setting the filename property to this variable.

var test = require('./index');
console.log(test.filename);
var sub = require('./sub');
module.exports = {
    filename: __filename,
    name: 'index.js',
    sub: sub.name
};
module.exports = {
    name: 'sub.js',
};

Steps to reproduce

Actual result

Logging is '/sub.js'

Expected result

The logging should be '/index.js'

Comments

  1. Kota Iguchi 2016-09-09

    https://github.com/appcelerator/titanium_mobile_windows/pull/864
  2. Ewan Harris 2016-09-12

    Verified using: OS: Microsoft Windows 10 Pro 10.0.14393 Appc core: 6.0.0-42 Appc NPM: 4.2.8-6 Ti SDK: 6.0.0.v20160909225457 __filename now returns correct value Closing ticket

JSON Source