kurkle / chartjs-plugin-gradient

Easy gradients for Chart.js
MIT License
33 stars 6 forks source link

Add KARMA test suite to enable testing #22

Closed stockiNail closed 2 years ago

stockiNail commented 2 years ago

This PR is adding test suite in order to enable the tests.

The source was chartjs-plugin-annotation and maybe something is not "perfect".

What cannot do is to register the plugin globally (try in several ways without any success) therefore in this PR the plugin has been adding in the first test case.

EDIT: the global registration was fixed putting it in beforeAll hook. Thanks @kurkle

stockiNail commented 2 years ago

What cannot do is to register the plugin globally (try in several ways without any success) therefore in this PR the plugin has been adding in the first test case.

I had a look to chartjs-plugin-datalabels which, like this plugin, doesn't have the auto registration. Nevertheless I wasn't able to enable it globally. :(

kurkle commented 2 years ago

Oh, how nice! Than you!

kurkle commented 2 years ago

What cannot do is to register the plugin globally (try in several ways without any success) therefore in this PR the plugin has been adding in the first test case.

I had a look to chartjs-plugin-datalabels which, like this plugin, doesn't have the auto registration. Nevertheless I wasn't able to enable it globally. :(

Did you try adding a beforeAll handler in test/index.js?

stockiNail commented 2 years ago

Oh, how nice! Than you!

ur welcome! I wanted to understand how it works ;)

stockiNail commented 2 years ago

Did you try adding a beforeAll handler in test/index.js?

No... only in beforeEach. Let me try

stockiNail commented 2 years ago

Did you try adding a beforeAll handler in test/index.js?

And as usual you are right! ;) Fixed!

sonarcloud[bot] commented 2 years ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

stockiNail commented 2 years ago

@kurkle I'm going to add some test cases because I'll have a couple of PR and I want to make sure do not destroy anything!

kurkle commented 2 years ago

@kurkle I'm going to add some test cases because I'll have a couple of PR and I want to make sure do not destroy anything!

I tweaked the CI to do coverage analysis on sonar cloud too (and removed windows runner, because I don't know how to do coverage on multiple osses and its slow etc)

So, the quality gate is failing currently because test coverage is too low.. looking forward on your new test cases to fix that! :)

stockiNail commented 2 years ago

I'm doing... I have added chartjs-adapter-luxon and luxon as dependencies in order to test also the time axis