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/09/16 06:47:47 UTC

[echarts-examples] branch dev updated: fix e2e test

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

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


The following commit(s) were added to refs/heads/dev by this push:
     new 22d1806  fix e2e test
22d1806 is described below

commit 22d1806d308136f13f1bd97b925ec1d0792ea6cc
Author: pissang <bm...@gmail.com>
AuthorDate: Thu Sep 16 14:46:46 2021 +0800

    fix e2e test
---
 e2e/main.js  | 11 ++++++-----
 package.json |  2 +-
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/e2e/main.js b/e2e/main.js
index acc8517..fa3d674 100644
--- a/e2e/main.js
+++ b/e2e/main.js
@@ -45,7 +45,8 @@ parser.addArgument(['-t', '--tests'], {
 });
 const args = parser.parseArgs();
 
-const EXAMPLE_DIR = nodePath.resolve(`${__dirname}/../public`);
+const PUBLIC_DIR = nodePath.resolve(`${__dirname}/../public`);
+const EXAMPLE_DIR = nodePath.resolve(`${PUBLIC_DIR}/examples`);
 const TMP_DIR = `${__dirname}/tmp`;
 const RUN_CODE_DIR = `${TMP_DIR}/tests`;
 const BUNDLE_DIR = `${TMP_DIR}/bundles`;
@@ -233,8 +234,8 @@ async function installPackages(config) {
 
 async function buildRunCode() {
   const files = await globby([
-    `${EXAMPLE_DIR}/data/option/*.json`,
-    `${EXAMPLE_DIR}/data-gl/option/*.json`
+    `${PUBLIC_DIR}/data/option/*.json`,
+    `${PUBLIC_DIR}/data-gl/option/*.json`
   ]);
 
   if (!files.length) {
@@ -318,7 +319,7 @@ async function buildRunCode() {
   const builtinTestCases = await runTasks(
     files,
     async (fileName) => {
-      const isGL = fileName.startsWith(`${EXAMPLE_DIR}/data-gl`);
+      const isGL = fileName.startsWith(`${PUBLIC_DIR}/data-gl`);
       const testName = nodePath.basename(fileName, '.json');
 
       if (
@@ -339,7 +340,7 @@ async function buildRunCode() {
         throw err;
       }
       const testCode = await fse.readFile(
-        nodePath.join(EXAMPLE_DIR, isGL ? 'data-gl' : 'data', testName + '.js'),
+        nodePath.join(EXAMPLE_DIR, 'js', isGL ? 'gl' : '', testName + '.js'),
         'utf-8'
       );
 
diff --git a/package.json b/package.json
index e21ff0c..9203772 100644
--- a/package.json
+++ b/package.json
@@ -8,7 +8,7 @@
     "localsite": "npm run compile:example || npm run build && node build/copyResource.js --env localsite",
     "release": "npm run compile:example || npm run build && node build/copyResource.js --env asf",
     "dev": "npx concurrently --kill-others \"npm:watch\" \"npm:server\"",
-    "build:example": "npm run compile:example || node tool/build-example.js && node tool/build-example.js --gl",
+    "build:example": "npm run compile:example && node tool/build-example.js && node tool/build-example.js --gl",
     "compile:example": "node tool/compile-example.js",
     "test:e2e": "node e2e/main.js --bundler webpack -m",
     "test:e2e:local": "node e2e/main.js --bundler webpack -m --local",

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