chartjs / chartjs-test-utils Goto Github PK
View Code? Open in Web Editor NEWChart.js test utilities
License: MIT License
Chart.js test utilities
License: MIT License
I found this package while looking at how the main chartjs repo does their testing, because I wanted to see if I could integrate canvas testing into a project at my org. The fact that all the hairy fuzzy matching logic is part of a package was great, but I was bummed to find that it depended on karma and jasmine. Reading through the code, it looks like there is a single dependency on jasmine and a single dependency on karma, both of which are environment-based rather than explicit imports. We don't use karma or jasmine in this project (specifically, I was hoping to adapt the matchers to cypress, whose assertion library is based on mocha) but it seems like a shame to install these dependencies just for these two references. The jasmine one can be easily removed by changing the signature to something like function addMatchers(jasmine)
- karma.__files__
I am less sure about (I couldn't even find documentation on this magic string) but if I don't use addMatchers
or specsFromFixtures
, these dependencies are totally unused.
Would it be possible to open a PR to change jasmine and karma to be peer deps instead of hard dependencies? Ideally, I would love the utils to be exported in a framework-agnostic way, and have separate layers on top for karma/jasmine and cypress/mocha (or jest/node-canvas, or whatever) but that's a much larger change and in the meantime I can write my own conversion utility to convert the matchers from jasmine -> mocha so that's not particularly a blocker. Mostly just wanted to open this and get some eyes on it to make sure I wouldn't open a PR that no one will ever look at.
I was looking into chartjs/Chart.js#8311 (comment) and why no test updates were needed. It seems that the context never tracked setting the font
property, so we should add that.
Could not find a declaration file for module 'chartjs-test-utils'. 'C:/Users/Sehreen Khan/Desktop/Comparison of analytics libraries/AnalyticsComparison/analytics/node_modules/chartjs-test-utils/dist/chartjs-test-utils.js' implicitly has an 'any' type.
Try npm i --save-dev @types/chartjs-test-utils
if it exists or add a new declaration (.d.ts) file containing declare module 'chartjs-test-utils';
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.