Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F7542060
test_cjs_exports_prototype.cjs
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
722 B
Referenced Files
None
Subscribers
None
test_cjs_exports_prototype.cjs
View Options
function fail(message) {
console.log(`FAIL: ${message}`);
process.exit(1);
}
if (typeof exports.__defineGetter__ !== 'function') {
fail('CommonJS exports should inherit legacy accessors from Object.prototype');
}
if (typeof module.__defineGetter__ !== 'function') {
fail('CommonJS module should inherit legacy accessors from Object.prototype');
}
exports.__defineGetter__('answer', function () {
return 42;
});
if (exports.answer !== 42) {
fail('getter installed on exports should resolve');
}
module.__defineGetter__('loadedFlag', function () {
return typeof this.exports === 'object';
});
if (module.loadedFlag !== true) {
fail('getter installed on module should resolve');
}
console.log('PASS');
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Wed, Jun 17, 2:38 PM (14 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
575425
Default Alt Text
test_cjs_exports_prototype.cjs (722 B)
Attached To
Mode
rANT Ant
Attached
Detach File
Event Timeline
Log In to Comment