From e8247d5fa017655b7a92cff45d7a901d93541455 Mon Sep 17 00:00:00 2001 From: Yulong Wang <7679871+fs-eire@users.noreply.github.com> Date: Fri, 20 Dec 2024 14:42:24 -0800 Subject: [PATCH] fix package install --- js/web/test/e2e/exports/main.js | 8 ++++++-- js/web/test/e2e/run.js | 4 +--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/js/web/test/e2e/exports/main.js b/js/web/test/e2e/exports/main.js index ed832a1954965..2ccc6816682c0 100644 --- a/js/web/test/e2e/exports/main.js +++ b/js/web/test/e2e/exports/main.js @@ -13,14 +13,18 @@ const treeKill = require('tree-kill'); * * @param {string[]} packagesToInstall */ -module.exports = async function main(PRESERVE) { +module.exports = async function main(PRESERVE, PACKAGES_TO_INSTALL) { console.log('Running exports tests...'); // testcases/nextjs-default { const wd = path.join(__dirname, 'testcases/nextjs-default'); if (!PRESERVE) { - await runShellCmd('npm install ../../onnxruntime-common.tgz ../../onnxruntime-web.tgz', { wd }); + if (PACKAGES_TO_INSTALL.length === 0) { + await runShellCmd('npm ci', { wd }); + } else { + await runShellCmd(`npm install ${PACKAGES_TO_INSTALL.map((i) => `"${i}"`).join(' ')}`, { wd }); + } } const launchBrowserAndRunTests = async (logPrefix, port = 3000) => { diff --git a/js/web/test/e2e/run.js b/js/web/test/e2e/run.js index 47a1c7d444396..615e5b749a96f 100644 --- a/js/web/test/e2e/run.js +++ b/js/web/test/e2e/run.js @@ -79,10 +79,8 @@ async function main() { // perform exports testing { - fs.copySync(PACKAGES_TO_INSTALL[0], path.join(TEST_E2E_RUN_FOLDER, 'exports', 'onnxruntime-common.tgz')); - fs.copySync(PACKAGES_TO_INSTALL[1], path.join(TEST_E2E_RUN_FOLDER, 'exports', 'onnxruntime-web.tgz')); const testExportsMain = require(path.join(TEST_E2E_RUN_FOLDER, './exports/main')); - await testExportsMain(PRESERVE); + await testExportsMain(PRESERVE, PACKAGES_TO_INSTALL); } // prepare .wasm files for path override testing