Skip to content

Commit

Permalink
test(vitest): Migrate karma to vitest
Browse files Browse the repository at this point in the history
Migrate all tests to be ran on vitest

Ref naver#3681
  • Loading branch information
netil authored and netil committed Aug 8, 2024
1 parent 0cd83af commit 4967179
Show file tree
Hide file tree
Showing 89 changed files with 4,661 additions and 3,503 deletions.
158 changes: 0 additions & 158 deletions karma.conf.cjs

This file was deleted.

34 changes: 10 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@
"lint": "eslint",
"format": "dprint fmt",
"loc": "cloc --by-file src",
"test": "node --max-old-space-size=3072 ./node_modules/karma/bin/karma start ./karma.conf.cjs",
"test:chrome": "cross-env TEST_TYPE=chrome npm test",
"coverage": "cross-env TEST_TYPE=coverage npm test",
"test": "vitest",
"coverage": "vitest run",
"coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
"jsdoc": "node ./config/jsdoc.js",
"jsdoc:cmd": "jsdoc -c jsdoc.json",
Expand Down Expand Up @@ -114,12 +113,14 @@
"@semantic-release/git": "^10.0.1",
"@semantic-release/npm": "^12.0.1",
"@semantic-release/release-notes-generator": "^14.0.1",
"@types/chai": "^4.3.16",
"@testing-library/dom": "^10.4.0",
"@testing-library/react": "^16.0.0",
"@types/d3": "^7.4.3",
"@types/mocha": "^10.0.7",
"@types/sinon": "^17.0.3",
"@vitest/browser": "^2.0.5",
"@vitest/coverage-istanbul": "^2.0.5",
"@vitest/ui": "^2.0.5",
"better-docs": "^2.7.3",
"chai": "^4.3.10",
"clean-webpack-plugin": "^4.0.0",
"cloc": "^2.11.0",
"core-js": "^3.37.1",
Expand All @@ -134,43 +135,28 @@
"dprint": "^0.47.2",
"esbuild-loader": "^4.2.2",
"eslint": "^9.8.0",
"eslint-config-naver": "^2.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsdoc": "^48.9.2",
"exports-loader": "^5.0.0",
"hammer-simulator": "0.0.1",
"husky": "^9.1.4",
"istanbul-instrumenter-loader": "^3.0.1",
"istanbul-lib-instrument": "^6.0.3",
"jsdoc": "^4.0.3",
"karma": "^6.4.4",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^3.2.0",
"karma-coverage-istanbul-reporter": "^3.0.3",
"karma-mocha": "^2.0.1",
"karma-mocha-reporter": "^2.2.3",
"karma-scss-preprocessor": "^4.0.0",
"karma-sinon": "^1.0.5",
"karma-sourcemap-loader": "^0.4.0",
"karma-webpack": "^5.0.1",
"lint-staged": "^15.2.7",
"lite-fixture": "^1.0.2",
"mini-css-extract-plugin": "^2.9.0",
"mocha": "^10.7.0",
"node-sass": "^9.0.0",
"regenerator-runtime": "^0.14.1",
"rollup": "^4.19.1",
"rollup-plugin-delete": "^2.0.0",
"sass": "^1.77.8",
"sass-loader": "^16.0.0",
"semantic-release": "^24.0.0",
"simulant": "^0.2.2",
"sinon": "^18.0.0",
"string-replace-loader": "^3.1.0",
"style-loader": "^4.0.0",
"taffydb": "^2.7.3",
"tslib": "^2.6.3",
"typescript": "5.5.4",
"typescript-eslint": "^7.18.0",
"vitest": "^2.0.5",
"webdriverio": "^8.39.1",
"webpack": "^5.93.0",
"webpack-bundle-analyzer": "^4.10.2",
"webpack-clean": "^1.2.5",
Expand Down
2 changes: 1 addition & 1 deletion src/ChartInternal/internals/scale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import type {IDataRow, IGridData} from "../data/IData";
* @returns {d3.scaleLinear|d3.scaleTime} scale
* @private
*/
export function getScale(type = "linear", min, max): any {
export function getScale<T = IDataRow["x"]>(type = "linear", min?: T, max?: T): any {
const scale = ({
linear: d3ScaleLinear,
log: d3ScaleSymlog,
Expand Down
2 changes: 1 addition & 1 deletion src/module/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function getGlobal() {
* @returns {Array} fallback object array
* @private
*/
function getFallback(w) {
export function getFallback(w?) {
const hasRAF = typeof w?.requestAnimationFrame === "function" &&
typeof w?.cancelAnimationFrame === "function";
const hasRIC = typeof w?.requestIdleCallback === "function" &&
Expand Down
4 changes: 2 additions & 2 deletions src/module/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,8 @@ function getCssRules(styleSheets: any[]) {
*/
function getScrollPosition(node: HTMLElement) {
return {
x: (window.pageXOffset ?? window.scrollX ?? 0) + node.scrollLeft ?? 0,
y: (window.pageYOffset ?? window.scrollY ?? 0) + node.scrollTop ?? 0
x: (window.pageXOffset ?? window.scrollX ?? 0) + (node.scrollLeft ?? 0),
y: (window.pageYOffset ?? window.scrollY ?? 0) + (node.scrollTop ?? 0)
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/module/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function getObjectURL(fn: Function, depsFn?: Function[]): string {
* @returns {object} WebWorker instance
* @private
*/
function getWorker(src) {
export function getWorker(src) {
const worker = new window.Worker(src);

// handle error
Expand Down
Loading

0 comments on commit 4967179

Please sign in to comment.