You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by su...@apache.org on 2020/10/14 08:10:17 UTC

[incubator-echarts] 07/08: test: remove unnecessary jsdom dependency (it cause some prepublish issue). Use jest built-in jsdom.

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

sushuang pushed a commit to branch fix-ut
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git

commit 199a49e06a42dcf58cf6ed8422c132e81b86e447
Author: 100pah <su...@gmail.com>
AuthorDate: Wed Oct 14 13:51:44 2020 +0800

    test: remove unnecessary jsdom dependency (it cause some prepublish issue). Use jest built-in jsdom.
---
 package.json           |  2 --
 test/ut/core/setup.ts  | 10 +++++-----
 test/ut/jest.config.js | 19 +++++++++----------
 3 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/package.json b/package.json
index dc5d55f..9863ad8 100644
--- a/package.json
+++ b/package.json
@@ -43,7 +43,6 @@
     "@babel/types": "^7.10.5",
     "@microsoft/api-extractor": "7.7.2",
     "@types/jest": "^26.0.14",
-    "@types/jsdom": "^16.2.4",
     "@typescript-eslint/eslint-plugin": "^2.15.0",
     "@typescript-eslint/parser": "^2.18.0",
     "canvas": "^2.6.0",
@@ -58,7 +57,6 @@
     "husky": "^4.2.5",
     "jest": "^24.9.0",
     "jest-canvas-mock": "^2.2.0",
-    "jsdom": "^15.2.1",
     "jshint": "2.10.2",
     "lodash.debounce": "^4.0.8",
     "open": "6.4.0",
diff --git a/test/ut/core/setup.ts b/test/ut/core/setup.ts
index 7150e8e..479ea92 100644
--- a/test/ut/core/setup.ts
+++ b/test/ut/core/setup.ts
@@ -17,12 +17,12 @@
 * under the License.
 */
 
-import { JSDOM } from 'jsdom';
+// import { JSDOM } from 'jsdom';
 import { Image } from 'canvas';
 
-const { window } = new JSDOM();
+// const { window } = new JSDOM();
 
-(global as any).window = window;
-(global as any).navigator = window.navigator;
-(global as any).document = window.document;
+// (global as any).window = window;
+// (global as any).navigator = window.navigator;
+// (global as any).document = window.document;
 (global as any).Image = Image;
diff --git a/test/ut/jest.config.js b/test/ut/jest.config.js
index 6e22d94..a5fc425 100644
--- a/test/ut/jest.config.js
+++ b/test/ut/jest.config.js
@@ -19,7 +19,7 @@
 
 module.exports = {
     preset: 'ts-jest',
-    testEnvironment: 'node',
+    testEnvironment: 'jsdom',
     rootDir: __dirname,
     collectCoverage: true,
     setupFiles: [
@@ -33,14 +33,13 @@ module.exports = {
         '__DEV__': true
     },
     testMatch: [
-        '**/spec/api/containPixel.test.ts'
-        // '**/spec/api/*.test.ts',
-        // '**/spec/component/**/*.test.ts',
-        // '**/spec/data/*.test.ts',
-        // '**/spec/model/*.test.ts',
-        // '**/spec/scale/*.test.ts',
-        // '**/spec/util/*.test.ts',
-        // '!**/spec/api/containPixel.test.ts',
-        // '!**/spec/component/graphic/setOption.test.ts'
+        '**/spec/api/*.test.ts',
+        '**/spec/component/**/*.test.ts',
+        '**/spec/data/*.test.ts',
+        '**/spec/model/*.test.ts',
+        '**/spec/scale/*.test.ts',
+        '**/spec/util/*.test.ts',
+        '!**/spec/api/containPixel.test.ts',
+        '!**/spec/component/graphic/setOption.test.ts'
     ]
 };


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