You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by sh...@apache.org on 2021/04/20 12:24:59 UTC

[echarts] 02/05: test: fix ts-jest don't work on zrender. remove canvas dependency

This is an automated email from the ASF dual-hosted git repository.

shenyi pushed a commit to branch enhance-workflow
in repository https://gitbox.apache.org/repos/asf/echarts.git

commit fa9ece7792b4da573da73c71e887986b3fd5b2b2
Author: pissang <bm...@gmail.com>
AuthorDate: Tue Apr 20 20:12:12 2021 +0800

    test: fix ts-jest don't work on zrender. remove canvas dependency
---
 package.json                     |  1 -
 src/chart/helper/EffectSymbol.ts |  1 -
 test/ut/core/setup.ts            | 10 +---------
 test/ut/index.d.ts               |  3 +++
 test/ut/jest.config.js           |  4 ++++
 test/ut/tsconfig.json            | 12 ++----------
 6 files changed, 10 insertions(+), 21 deletions(-)

diff --git a/package.json b/package.json
index 1fc1c5b..35ff260 100644
--- a/package.json
+++ b/package.json
@@ -80,7 +80,6 @@
     "@types/jest": "^26.0.14",
     "@typescript-eslint/eslint-plugin": "^4.9.1",
     "@typescript-eslint/parser": "^4.9.1",
-    "canvas": "^2.6.0",
     "chalk": "^3.0.0",
     "commander": "2.11.0",
     "dtslint": "^4.0.5",
diff --git a/src/chart/helper/EffectSymbol.ts b/src/chart/helper/EffectSymbol.ts
index 34f0a02..31c6179 100644
--- a/src/chart/helper/EffectSymbol.ts
+++ b/src/chart/helper/EffectSymbol.ts
@@ -250,6 +250,5 @@ class EffectSymbol extends Group {
     };
 
 }
-zrUtil.inherits(EffectSymbol, Group);
 
 export default EffectSymbol;
diff --git a/test/ut/core/setup.ts b/test/ut/core/setup.ts
index 479ea92..eadc8aa 100644
--- a/test/ut/core/setup.ts
+++ b/test/ut/core/setup.ts
@@ -17,12 +17,4 @@
 * under the License.
 */
 
-// import { JSDOM } from 'jsdom';
-import { Image } from 'canvas';
-
-// const { window } = new JSDOM();
-
-// (global as any).window = window;
-// (global as any).navigator = window.navigator;
-// (global as any).document = window.document;
-(global as any).Image = Image;
+export {};
\ No newline at end of file
diff --git a/test/ut/index.d.ts b/test/ut/index.d.ts
index b1eb5a9..c486c8e 100644
--- a/test/ut/index.d.ts
+++ b/test/ut/index.d.ts
@@ -20,6 +20,9 @@
 
 export {};
 declare global {
+
+  const __DEV__: boolean;
+
   namespace jest {
     interface Matchers<R> {
         toBeFinite(): R
diff --git a/test/ut/jest.config.js b/test/ut/jest.config.js
index bc09902..9946de2 100644
--- a/test/ut/jest.config.js
+++ b/test/ut/jest.config.js
@@ -32,6 +32,10 @@ module.exports = {
     globals: {
         '__DEV__': true
     },
+    // Not exclude node_modules because zrender also needs to be transformed.
+    transformIgnorePatterns: [
+        "node_modules/(?!zrender/)"
+    ],
     testMatch: [
         '**/spec/api/*.test.ts',
         '**/spec/component/**/*.test.ts',
diff --git a/test/ut/tsconfig.json b/test/ut/tsconfig.json
index ff8304b..0cdbc3d 100644
--- a/test/ut/tsconfig.json
+++ b/test/ut/tsconfig.json
@@ -1,22 +1,14 @@
 {
     "compilerOptions": {
-        "target": "ES3",
+        "target": "ES6",
 
         "noImplicitAny": true,
         "noImplicitThis": true,
         "strictBindCallApply": true,
-        "removeComments": true,
-        "sourceMap": true,
 
-        // https://github.com/ezolenko/rollup-plugin-typescript2/issues/12#issuecomment-536173372
-        "moduleResolution": "node",
-
-        "importHelpers": true,
-
-        "pretty": true
+        "esModuleInterop": true
     },
     "include": [
-        "../../src/global.d.ts",
         "**/*.ts"
     ],
     "exclude": [

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org