Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Can't assign to readonly property. #5032

Closed
ejholmes opened this issue Nov 19, 2013 · 4 comments
Closed

Can't assign to readonly property. #5032

ejholmes opened this issue Nov 19, 2013 · 4 comments

Comments

@ejholmes
Copy link

When running unit tests using karma and PhantomJS 1.9.2, if an exception is raised, I get the following:

PhantomJS 1.9.2 (Mac OS X) app.api
        TypeError: Attempted to assign to readonly property.
            at workFn (/Users/project/app/bower_components/angular-mocks/angular-mocks.js:2122)
            at /Users/project/node_modules/mocha/mocha.js:4263
            at /Users/project/node_modules/mocha/mocha.js:4635
            at /Users/project/node_modules/mocha/mocha.js:4694
            at next (/Users/project/node_modules/mocha/mocha.js:4561)
            at /Users/project/node_modules/mocha/mocha.js:4570
            at next (/Users/project/node_modules/mocha/mocha.js:4514)
            at /Users/project/node_modules/mocha/mocha.js:4538
            at timeslice (/Users/project/node_modules/mocha/mocha.js:5531)

Looks like e.stack shouldn't be written to.

@wilsonjackson
Copy link

I'll add that this only started happening when "use strict" was added in this commit.

And by chance I ran across this bit of code elsewhere in the codebase earlier today, which seems to be about this same problem. Not sure if it's applicable to the mocks problem.

@DanielSchaffer
Copy link

I'm seeing this as well. It's a bit of a hack, but wrapping the bit that writes to e.stack in try/catch keeps the functionality in browsers that support it (it works fine in Chrome, for example), while avoiding breaking things in PhantomJS

@chrisirhc
Copy link
Contributor

Duplicate of #5047

@ghost ghost assigned btford Jan 3, 2014
@btford
Copy link
Contributor

btford commented Jan 3, 2014

Thanks @chrisirhc. Closing this issue in favor of #5047.

@btford btford closed this as completed Jan 3, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants