mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-31 23:27:43 +00:00
### Description <!-- Describe your changes. --> This PR tries to fix #22615. (see detailed description in the issue) A perfect solution would be too difficult to make, because there are a huge number of combinations of usage scenarios, including combinations of development framework, bundler, dev/prod mode, and so on. This PR is using the following approach: - Introduce a new type of end to end test: export test. This type of tests are complete web apps that use popular web development frameworks, and the tests are using puppeteer to run the apps and check if the apps can run without error. - added one nextjs based web app and one vite based web app. - In the test, perform the following test steps: - `npm install` for packages built locally - `npm run dev` to start dev server and use puppeteer to launch the browser to test - `npm run build && npm run start` to test prod build and use puppeteer to launch the browser to test - Make changes to ort-web, including: - special handling on Webpack's behavior of rewriting `import.meta.url` to a `file://` string - revise build definitions - fix wasm URL for proxy, if used in a bundled build
33 lines
1 KiB
JavaScript
33 lines
1 KiB
JavaScript
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
|
|
'use strict';
|
|
|
|
const { runDevTest, runProdTest } = require('./test');
|
|
const { installOrtPackages } = require('./utils');
|
|
|
|
/**
|
|
* Entry point for package exports tests.
|
|
*
|
|
* @param {string[]} packagesToInstall
|
|
*/
|
|
module.exports = async function main(PRESERVE, PACKAGES_TO_INSTALL) {
|
|
console.log('Running exports tests...');
|
|
|
|
// testcases/nextjs-default
|
|
{
|
|
await installOrtPackages('nextjs-default', PRESERVE, PACKAGES_TO_INSTALL);
|
|
|
|
await runDevTest('nextjs-default', '✓ Ready in', 3000);
|
|
await runDevTest('nextjs-default', '✓ Ready in', 3000, 'turbopack', 'npm run dev -- --turbopack');
|
|
await runProdTest('nextjs-default', '✓ Ready in', 3000);
|
|
}
|
|
|
|
// testcases/vite-default
|
|
{
|
|
await installOrtPackages('vite-default', PRESERVE, PACKAGES_TO_INSTALL);
|
|
|
|
await runDevTest('vite-default', '\x1b[32m➜\x1b[39m \x1b[1mLocal\x1b[22m:', 5173);
|
|
await runProdTest('vite-default', '\x1b[32m➜\x1b[39m \x1b[1mLocal\x1b[22m:', 4173);
|
|
}
|
|
};
|