-
Notifications
You must be signed in to change notification settings - Fork 29
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
Cannot read property 'name' of undefined testing serialize #100
Comments
Hi, let me check. |
I tested with a little sample and your Could you test with the following package.json {
"name": "test",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"test": "jest"
},
"dependencies": {
"@types/jest": "^26.0.14",
"@types/node": "^14.11.2",
"jest": "^26.4.2",
"jest-junit": "^11.1.0",
"ts-jest": "^26.4.0",
"ts-node": "^9.0.0",
"typescript": "^4.0.3",
"typescript-json-serializer": "^2.4.0"
}
} jest.config.js module.exports = {
coverageReporters: ["text", "lcov"],
reporters: ["default", "jest-junit"],
roots: ["spec"],
transform: {
"^.+\\.tsx?$": "ts-jest",
},
}; PS: my test file is in a spec folder and call |
SerializeTest.zip |
Ok, I'll test soon. |
Hi, sorry to be late. I tested your code and it seems that ReflectMetadata package I used in my lib is not able to find the type/prototype of any value 😕 I think is due to the project technology, I can't do anything for you... |
Got the same issue with Solved it using following
Setting in
And adding tl;dr: altering babel settings using 3rdparty plugin is required, by default it does not persist metadata. |
I've solved the problem inserting in the package.json this
I think that also and at the top of setup-jest.ts Thank you @bakatrouble for your suggestion |
It's great that you can continue to use my lib! |
When I try to test a component that use serialize, I found this error
Cannot read property 'name' of undefined
Using the application it's work.
I use Jest, here the test(simplified, without component)
the tsconfig.json
The text was updated successfully, but these errors were encountered: