Closed
Description
I writen some jest unit tests, but the first case is fine but the later cases are all failed because Cannot redefine property: wrap
:
FAIL src/tests/env.spec.ts
● Test suite failed to run
TypeError: Cannot redefine property: wrap
at Function.defineProperty (<anonymous>)
at Object.call (../../node_modules/assemblyscript/dist/webpack:/assemblyscript/std/portable/index.js:384:8)
at i (../../node_modules/assemblyscript/dist/webpack:/assemblyscript/webpack/bootstrap:19:32)
at Object.call (../../node_modules/assemblyscript/dist/webpack:/assemblyscript/src/glue/js/index.ts:6:1)
at __webpack_require__ (../../node_modules/assemblyscript/dist/webpack:/assemblyscript/webpack/bootstrap:19:32)
at ../../node_modules/assemblyscript/dist/webpack:/assemblyscript/webpack/startup:3:1
at factory (../../node_modules/assemblyscript/dist/assemblyscript.js:7:758416)
at ../../node_modules/assemblyscript/dist/webpack:/assemblyscript/webpack/universalModuleDefinition:3:20
at Object.<anonymous> (../../node_modules/assemblyscript/dist/webpack:/assemblyscript/webpack/universalModuleDefinition:1:1)
I don't know why my local code have not met such errors. But I cannot avoid this error in github CI.
Maybe we should add if
before Object.defineProperty
for portable/index.js
:
Object.defineProperty(Int16Array, "wrap", {
value: function wrap(buffer, byteOffset, length) {
return new Int16Array(buffer, byteOffset, length);
}
});