After the failure with running unit tests via phantomjs, I've decided to give electron a shot, and things worked ok, but not really inspiring, and buggy w.r.t. code coverage. As a result, I'm trying to switch to jest.
Once again, a "TypeError" occurs as it did on phantomjs, but it comes with some more detailed information that are pointing directly to its cause (test-project can still be found here:
yarn test:ci v0.27.5
$ node scripts/test.js --no-cache --coverage
FAIL src/inputTest/inputTest.spec.ts
● Test suite failed to run
TypeError: 'caller' and 'arguments' are restricted function properties and cannot be accessed in this context.
at decorate (node_modules/av-ts/dist/index.js:237:22)
at Component (node_modules/av-ts/dist/index.js:245:28)
at Object.__decorate (node_modules/tslib/tslib.js:79:99)
at src/inputTest/inputTest.vue:11:29
at src/inputTest/inputTest.vue:15:6
at Object.<anonymous> (src/inputTest/inputTest.vue:18:3)
at Object.<anonymous> (src/inputTest/inputTest.spec.ts:2:17)
at process._tickCallback (internal/process/next_tick.js:109:7)
I've figured out that this behavior is standard-conforming (see article about strict mode on MDN).
The published build contains a use strict; directive. From the standard's perspective, this error should occur in almost every setup using an environment that respects this directive. It's easy to illustrate this on the browser console (chromium in my case):
"use strict";
var a = function(){};
a.arguments = ["a", 5];
> Uncaught TypeError: 'caller' and 'arguments' are restricted function properties and cannot be accessed in this context.
at <anonymous>:3:13
It should be fine to put caller in the BUILTIN list to be skipped while iterating the static fields, since it should not be used in production anyway.
arguments however seems to be a more complicated issue to be solved ...
This is a follow-up of https://github.com/HerringtonDarkholme/av-ts/issues/64.
After the failure with running unit tests via phantomjs, I've decided to give electron a shot, and things worked ok, but not really inspiring, and buggy w.r.t. code coverage. As a result, I'm trying to switch to jest.
Once again, a "TypeError" occurs as it did on phantomjs, but it comes with some more detailed information that are pointing directly to its cause (test-project can still be found here:
Which originates here: https://github.com/HerringtonDarkholme/av-ts/blob/master/src/core.ts#L159
I've figured out that this behavior is standard-conforming (see article about strict mode on MDN).
The published build contains a
use strict;
directive. From the standard's perspective, this error should occur in almost every setup using an environment that respects this directive. It's easy to illustrate this on the browser console (chromium in my case):It should be fine to put
caller
in theBUILTIN
list to be skipped while iterating the static fields, since it should not be used in production anyway.arguments
however seems to be a more complicated issue to be solved ...