power-assert-js/power-assert

ReferenceError when assert object extended Map

popomore opened this issue · 3 comments

test/a.js

'use strict';

const assert = require('assert');

class AMap extends Map {
  get(name) {
    console.log(name);
    return super.get(name);
  }
}
const map = new AMap();
map.set('a', true);
assert(map.has('a'));

index.js

'use strict';

require('intelli-espower-loader');
require('./test/a.js');

When I run node index.js, catch an error.

test/a.js:13
assert(map.has('a'));
       ^
ReferenceError: _rec1 is not defined
    at Object.<anonymous> (test/b.js:13:8)
    at Module._compile (module.js:570:32)
    at Object.extensions..js (/Users/popomore/code/tmp/b/node_modules/.1.2.0@espower-loader/index.js:46:25)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/popomore/code/tmp/b/index.js:4:1)
    at Module._compile (module.js:570:32)
twada commented

@popomore Thank you for reporting and creating minimal reproduction case!
This is a bug in power-assert transpiler and I'm fixing it now. So please stay tuned.

twada commented

Just released espower v2.0.3 as a bugfix release for this issue. Would you reinstall intelli-espower-loader and give a try again?

Yes, it has been fixed.