Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
roots: ['<rootDir>/tests'],
testMatch: [
'<rootDir>/tests/**/*.test.(ts|tsx)'
],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
setupFilesAfterEnv: ['<rootDir>/tests/setup.ts'],
};
11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@
"scripts": {
"build": "npm run clean && sh ./wasm_setup.sh && THORVG_VERSION=$(npm run version --silent) rollup -c --bundleConfigAsCjs && npm run clean:post",
"build:watch": "npm run clean && sh ./wasm_setup.sh && THORVG_VERSION=$(npm run version --silent) rollup -c --bundleConfigAsCjs --watch",
"build:node": "NODE_ENV=node npm run build",
"clean": "rm -rf dist && mkdir dist && touch dist/index.js",
"clean:post": "find ./dist -name 'thorvg.js' -type f -delete",
"test": "echo \"Error: no test specified\" && exit 1",
"test": "node --experimental-vm-modules node_modules/.bin/jest",
"test:watch": "node --experimental-vm-modules node_modules/.bin/jest --watch",
"lint": "eslint ./src --ext .ts,.tsx,.js",
"lint:fix": "eslint ./src --ext .ts,.tsx,.js --fix",
"version": "sed -n -e 4p ./thorvg/meson.build | sed 's/..$//' | sed -r 's/.{19}//'"
Expand All @@ -65,19 +67,24 @@
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^6.0.2",
"@swc/core": "^1.3.99",
"@types/jest": "^30.0.0",
"@typescript-eslint/eslint-plugin": "^6.4.0",
"canvas": "^3.1.2",
"eslint": "^8.0.1",
"eslint-config-standard-with-typescript": "^40.0.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-n": "^15.0.0 || ^16.0.0 ",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-wc": "^2.0.4",
"jest": "^30.0.5",
"jest-environment-jsdom": "^30.0.5",
"rollup": "^4.46.2",
"rollup-plugin-dts": "^6.1.0",
"rollup-plugin-polyfill-node": "^0.13.0",
"rollup-plugin-swc3": "^0.10.4",
"rollup-plugin-terser": "^7.0.2",
"typescript": "*"
"ts-jest": "^29.4.1",
Copy link

Copilot AI Sep 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ts-jest dependency appears unused since the Jest configuration uses native Node.js ESM modules with --experimental-vm-modules flag instead of ts-jest transformation. Consider removing this dependency if it's not being used elsewhere.

Suggested change
"ts-jest": "^29.4.1",

Copilot uses AI. Check for mistakes.

"typescript": "^5.9.2"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to change existing dependency.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, this is my mistake. I'll fix it.

},
"dependencies": {
"lit": "^3.1.0",
Expand Down
4 changes: 3 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import alias from '@rollup/plugin-alias';
import pkg from './package.json';
import path from 'path';

const isNode = process.env.NODE_ENV === 'node';

const name = 'lottie-player';
const globals = {
url: "url",
Expand Down Expand Up @@ -125,7 +127,7 @@ const createLottieConfig = (preset) => {
'__RENDERER__': presetMap[preset].renderer,
},
}),
nodePolyfills(),
...(isNode ? [] : [nodePolyfills()]),
commonjs({
include: /node_modules/
}),
Expand Down
11 changes: 11 additions & 0 deletions tests/fixtures/base-template.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>ThorVG Lottie Player</title>
<meta name="description" content="A web lottie player using ThorVG as a renderer" />
</head>
<body>
<div class="lottie"></div>
</body>
</html>
Loading