Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't find variable: Proxy #186

Closed
Mario-Eis opened this issue Feb 9, 2017 · 3 comments
Closed

Can't find variable: Proxy #186

Mario-Eis opened this issue Feb 9, 2017 · 3 comments

Comments

@Mario-Eis
Copy link

I tried to evaluate testdouble.js for our project. Unfortunately, as soon as i call object(), an error occurs.
The code is copied from the docs, so its should work.

let parrot = object('Parrot');
leads to:

 × encountered a declaration exception
      PhantomJS 2.1.1 (Windows 8 0.0.0)
    ReferenceError: Can't find variable: Proxy in spec-bundle.ts (line 57722)
    createTestDoubleViaProxy@spec-bundle.ts:57722:29
    createTestDoubleObject@spec-bundle.ts:57683:38
    exports@spec-bundle.ts:57668:40
    spec-bundle.ts:76031:37
    invoke@spec-bundle.ts:59199:31
    run@spec-bundle.ts:59070:49
    spec-bundle.ts:58555:32
    spec-bundle.ts:58532:42
    spec-bundle.ts:76029:9
    __webpack_require__@spec-bundle.ts:20:34
    webpackContext@spec-bundle.ts:57837:28
    map@[native code]
    requireAll@spec-bundle.ts:86923:37
    spec-bundle.ts:86926:11
    __webpack_require__@spec-bundle.ts:20:34
    spec-bundle.ts:66:37
    global code@spec-bundle.ts:67:12
@searls
Copy link
Member

searls commented Feb 9, 2017

I presume that this means PhantomJS doesn't support Proxy objects.

td.js has a nice error about this, but it looks like your issue is that typescript blows up before you'd see it. If you know anything about TypeScript and can help sort that out,t hat'd be great

@searls searls closed this as completed Feb 9, 2017
@Mario-Eis
Copy link
Author

TypeScript can't be the issue here.
I figured it out: PhantomJS has no support for Proxy. Unfortunately that's a no-go for our CI build environment, as tests need to run headless there.

There is a polyfill here: https://github.com/GoogleChrome/proxy-polyfill
Including it fixes the issue in the case described above. But I don't know if it supports everything needed by testdouble in every case. Can you comment on that? If there is anything unclear, sadly testdouble can't be a candidate for our production environment. And I would personally prefer it.

@searls
Copy link
Member

searls commented Feb 9, 2017

I don't know if the polyfill would work. You'd have to try it and report back

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants