diff --git a/internals/upscaler-cli/src/lib/package-scripts/utils/browserStack.ts b/internals/upscaler-cli/src/lib/package-scripts/utils/browserStack.ts index e5662c41a..0f7a06a6d 100644 --- a/internals/upscaler-cli/src/lib/package-scripts/utils/browserStack.ts +++ b/internals/upscaler-cli/src/lib/package-scripts/utils/browserStack.ts @@ -1,5 +1,4 @@ import path from 'path'; -import browserstack from 'browserstack-local'; import webdriver, { WebDriver, ThenableWebDriver, Builder, logging } from 'selenium-webdriver'; import * as dotenv from 'dotenv'; import { ROOT_DIR } from './constants'; @@ -8,8 +7,6 @@ import { existsSync, readFileSync, writeFileSync } from 'fs-extra'; /**** * Types */ -export type Browserstack = browserstack.Local; - export interface BrowserOption { os?: string; os_version: string; @@ -84,49 +81,6 @@ function shouldPrintLogs (entry: logging.Entry, capabilities: BrowserOption) { */ export const getBrowserstackAccessKey = () => getEnv().BROWSERSTACK_ACCESS_KEY; -export const startBrowserstack = ({ - key, - bs, - verbose = true, -}: { - key?: string; - bs?: browserstack.Local; - verbose?: boolean; -}): Promise => new Promise((resolve, reject) => { - if (!key) { - throw new Error('A key must be passed to start up the local browserstack service'); - } - if (!bs) { - if (verbose) { - console.log('Start browserstack with a brand new object') - } - bs = new browserstack.Local(); - } else { - if (verbose) { - console.log('Start browserstack with an existing object') - } - } - bs.start({ - key, - force: true, - onlyAutomate: true, - forceLocal: true, - }, (error) => { - if (error) { - return reject(error); - } - if (bs?.isRunning() !== true) { - throw new Error('Browserstack failed to start'); - } - if (verbose) { - console.log('Browserstack started'); - } - return resolve(bs); - }); -}); - -export const stopBrowserstack = (bs: Browserstack): Promise => new Promise(resolve => bs.stop(() => resolve())); - export const getBrowserOptions = (filter?: FilterBrowserOption): Array => browserOptions.filter(filter || Boolean); export const getMobileBrowserOptions = (filter?: FilterBrowserOption): Array => mobileBrowserOptions.filter(filter || Boolean); diff --git a/package.json b/package.json index 3f93dc02f..088ec0560 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,6 @@ "@typescript-eslint/eslint-plugin": "6.4.0", "@typescript-eslint/parser": "6.4.0", "babel-plugin-add-module-exports": "1.0.4", - "browserstack-local": "1.5.4", "chai": "4.3.7", "chai-as-promised": "7.1.1", "chokidar": "3.5.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8f2dc52db..9aee739c7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -125,9 +125,6 @@ importers: babel-plugin-add-module-exports: specifier: 1.0.4 version: 1.0.4 - browserstack-local: - specifier: 1.5.4 - version: 1.5.4 chai: specifier: 4.3.7 version: 4.3.7 @@ -6885,18 +6882,6 @@ packages: node-releases: 2.0.13 update-browserslist-db: 1.0.11(browserslist@4.21.9) - /browserstack-local@1.5.4: - resolution: {integrity: sha512-OueHCaQQutO+Fezg+ZTieRn+gdV+JocLjiAQ8nYecu08GhIt3ms79cDHfpoZmECAdoQ6OLdm7ODd+DtQzl4lrA==} - dependencies: - agent-base: 6.0.2 - https-proxy-agent: 5.0.1 - is-running: 2.1.0 - ps-tree: 1.2.0 - temp-fs: 0.9.9 - transitivePeerDependencies: - - supports-color - dev: true - /bs-logger@0.2.6: resolution: {integrity: sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==} engines: {node: '>= 6'} @@ -9123,18 +9108,6 @@ packages: '@types/node': 20.5.1 require-like: 0.1.2 - /event-stream@3.3.4: - resolution: {integrity: sha512-QHpkERcGsR0T7Qm3HNJSyXKEEj8AHNxkY3PK8TS2KJvQ7NiSHe3DDpwVKKtoYprL/AreyzFBeIkBIWChAqn60g==} - dependencies: - duplexer: 0.1.2 - from: 0.1.7 - map-stream: 0.1.0 - pause-stream: 0.0.11 - split: 0.3.3 - stream-combiner: 0.0.4 - through: 2.3.8 - dev: true - /eventemitter3@4.0.7: resolution: {integrity: sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==} @@ -9627,10 +9600,6 @@ packages: resolution: {integrity: sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==} engines: {node: '>= 0.6'} - /from@0.1.7: - resolution: {integrity: sha512-twe20eF1OxVxp/ML/kq2p1uc6KvFK/+vs8WjEbeKmV2He22MKm7YF2ANIt+EOqhJ5L3K/SuuPhk0hWQDjOM23g==} - dev: true - /front-matter@4.0.2: resolution: {integrity: sha512-I8ZuJ/qG92NWX8i5x1Y8qyj3vizhXS31OxjKDu3LKP+7/qBgfIKValiZIEwoVoJKUHlhWtYrktkxV1XsX+pPlg==} dependencies: @@ -10928,10 +10897,6 @@ packages: resolution: {integrity: sha512-AGOriNp96vNBd3HtU+RzFEc75FfR5ymiYv8E553I71SCeXBiMsVDUtdio1OEFvrPyLIQ9tVR5RxXIFe5PUFjMg==} engines: {node: '>=6'} - /is-running@2.1.0: - resolution: {integrity: sha512-mjJd3PujZMl7j+D395WTIO5tU5RIDBfVSRtRR4VOJou3H66E38UjbjvDGh3slJzPuolsb+yQFqwHNNdyp5jg3w==} - dev: true - /is-set@2.0.2: resolution: {integrity: sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g==} @@ -12038,10 +12003,6 @@ packages: tmpl: 1.0.5 dev: true - /map-stream@0.1.0: - resolution: {integrity: sha512-CkYQrPYZfWnu/DAmVCpTSX/xHpKZ80eKh2lAkyA6AJTef6bW+6JpbQZN5rofum7da+SyN1bi5ctTm+lTfcCW3g==} - dev: true - /markdown-escapes@1.0.4: resolution: {integrity: sha512-8z4efJYk43E0upd0NbVXwgSTQs6cT3T06etieCMEg7dRbzCbxUCK/GHlX8mhHRDcp+OLlHkPKsvqQTCvsRl2cg==} @@ -13419,12 +13380,6 @@ packages: resolution: {integrity: sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==} dev: true - /pause-stream@0.0.11: - resolution: {integrity: sha512-e3FBlXLmN/D1S+zHzanP4E/4Z60oFAa3O051qt1pxa7DEJWKAyil6upYVXCWadEnuoqa4Pkc9oUx9zsxYeRv8A==} - dependencies: - through: 2.3.8 - dev: true - /pbkdf2@3.1.2: resolution: {integrity: sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==} engines: {node: '>=0.12'} @@ -14133,14 +14088,6 @@ packages: /proxy-from-env@1.1.0: resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} - /ps-tree@1.2.0: - resolution: {integrity: sha512-0VnamPPYHl4uaU/nSFeZZpR21QAWRz+sRv4iW9+v/GS/J5U5iZB5BNN6J0RMoOvdx2gWM2+ZFMIm58q24e4UYA==} - engines: {node: '>= 0.10'} - hasBin: true - dependencies: - event-stream: 3.3.4 - dev: true - /psl@1.8.0: resolution: {integrity: sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==} dev: true @@ -14881,13 +14828,6 @@ packages: resolution: {integrity: sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==} dev: true - /rimraf@2.5.4: - resolution: {integrity: sha512-Lw7SHMjssciQb/rRz7JyPIy9+bbUshEucPoLRvWqy09vC5zQixl8Uet+Zl+SROBB/JMWHJRdCk1qdxNWHNMvlQ==} - hasBin: true - dependencies: - glob: 7.2.3 - dev: true - /rimraf@2.7.1: resolution: {integrity: sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==} hasBin: true @@ -15648,12 +15588,6 @@ packages: transitivePeerDependencies: - supports-color - /split@0.3.3: - resolution: {integrity: sha512-wD2AeVmxXRBoX44wAycgjVpMhvbwdI2aZjCkvfNcH1YqHQvJVa1duWc73OyVGJUc05fhFaTZeQ/PYsrmyH0JVA==} - dependencies: - through: 2.3.8 - dev: true - /sprintf-js@1.0.3: resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} @@ -15755,12 +15689,6 @@ packages: inherits: 2.0.4 readable-stream: 3.6.0 - /stream-combiner@0.0.4: - resolution: {integrity: sha512-rT00SPnTVyRsaSz5zgSPma/aHSOic5U1prhYdRy5HS2kTZviFpmDgzilbtsJsxiroqACmayynDN/9VzIbX5DOw==} - dependencies: - duplexer: 0.1.2 - dev: true - /streamsearch@1.1.0: resolution: {integrity: sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==} engines: {node: '>=10.0.0'} @@ -16078,13 +16006,6 @@ packages: engines: {node: '>=14.16'} dev: true - /temp-fs@0.9.9: - resolution: {integrity: sha512-WfecDCR1xC9b0nsrzSaxPf3ZuWeWLUWblW4vlDQAa1biQaKHiImHnJfeQocQe/hXKMcolRzgkcVX/7kK4zoWbw==} - engines: {node: '>=0.8.0'} - dependencies: - rimraf: 2.5.4 - dev: true - /tempy@3.1.0: resolution: {integrity: sha512-7jDLIdD2Zp0bDe5r3D2qtkd1QOCacylBuL7oa4udvN6v2pqr4+LcCr67C8DR1zkpaZ8XosF5m1yQSabKAW6f2g==} engines: {node: '>=14.16'} diff --git a/scripts/package-scripts/utils/browserStack.ts b/scripts/package-scripts/utils/browserStack.ts index 299a217e0..1a97e643e 100644 --- a/scripts/package-scripts/utils/browserStack.ts +++ b/scripts/package-scripts/utils/browserStack.ts @@ -1,5 +1,4 @@ import path from 'path'; -import browserstack from 'browserstack-local'; import webdriver, { WebDriver, ThenableWebDriver, Builder, logging } from 'selenium-webdriver'; import * as dotenv from 'dotenv'; import { ROOT_DIR } from './constants'; @@ -8,8 +7,6 @@ import { existsSync, readFileSync, writeFileSync } from 'fs-extra'; /**** * Types */ -export type Browserstack = browserstack.Local; - export interface BrowserOption { os?: string; os_version: string; @@ -88,49 +85,6 @@ function shouldPrintLogs (entry: logging.Entry, capabilities: BrowserOption) { */ export const getBrowserstackAccessKey = () => getEnv().BROWSERSTACK_ACCESS_KEY; -export const startBrowserstack = async ({ - key, - bs, - verbose = true, -}: { - key?: string; - bs?: browserstack.Local; - verbose?: boolean; -}): Promise => new Promise((resolve, reject) => { - if (!key) { - throw new Error('A key must be passed to start up the local browserstack service'); - } - if (!bs) { - if (verbose) { - console.log('Start browserstack with a brand new object') - } - bs = new browserstack.Local(); - } else { - if (verbose) { - console.log('Start browserstack with an existing object') - } - } - bs.start({ - key, - force: true, - onlyAutomate: true, - forceLocal: true, - }, (error) => { - if (error) { - return reject(error); - } - if (bs?.isRunning() !== true) { - throw new Error('Browserstack failed to start'); - } - if (verbose) { - console.log('Browserstack started'); - } - resolve(bs); - }); -}); - -export const stopBrowserstack = (bs: Browserstack): Promise => new Promise(resolve => bs.stop(() => resolve())); - export const getBrowserOptions = (filter?: FilterBrowserOption): Array => browserOptions.filter(filter || Boolean); export const getMobileBrowserOptions = (filter?: FilterBrowserOption): Array => mobileBrowserOptions.filter(filter || Boolean); diff --git a/scripts/test.ts b/scripts/test.ts index 524391ea7..2f3403633 100644 --- a/scripts/test.ts +++ b/scripts/test.ts @@ -6,11 +6,8 @@ import path from 'path'; import { spawn } from 'child_process'; import yargs from 'yargs'; import { sync } from 'glob'; -import { getAllAvailableModelPackages } from './package-scripts/utils/getAllAvailableModels'; import { OutputFormat } from './package-scripts/prompt/types'; import { ifDefined as _ifDefined } from './package-scripts/prompt/ifDefined'; -import { runPNPMScript } from '@internals/common'; -import { Browserstack, getBrowserstackAccessKey, startBrowserstack, stopBrowserstack } from './package-scripts/utils/browserStack'; import { DEFAULT_OUTPUT_FORMATS } from './package-scripts/prompt/getOutputFormats'; import { ROOT_DIR, TEST_DIR } from './package-scripts/utils/constants'; import { Bundle } from '../test/integration/utils/NodeTestRunner'; @@ -138,14 +135,12 @@ const getPlatformsToBuild = (platform: Platform | Platform[]): TargetPlatform[] * Main function */ const test = async (platform: Platform | Platform[], runner: Runner, kind: Kind, positionalArgs: (string | number)[], { - browserstackAccessKey, verbose, skipBundle, skipTest, useGPU, watch, }: { - browserstackAccessKey?: string; verbose?: boolean; skipBundle?: boolean; skipTest?: boolean; @@ -172,35 +167,8 @@ const test = async (platform: Platform | Platform[], runner: Runner, kind: Kind, } if (skipTest !== true) { - let bsLocal: undefined | Browserstack = undefined; - if (runner === 'browserstack') { - bsLocal = await startBrowserstack({ - key: browserstackAccessKey, - verbose, - }); - console.log('verbose', verbose); - if (verbose) { - console.log('bsLocal.isRunning(): ', bsLocal?.isRunning()); - } - process.on('exit', async () => { - if (bsLocal !== undefined && bsLocal.isRunning()) { - if (verbose) { - console.log('Stopping browserstack'); - } - await stopBrowserstack(bsLocal); - if (verbose) { - console.log('Stopped browserstack'); - } - } - }); - } else { - if (verbose) { - console.log('no browserstack'); - } - } - const jestConfigPath = getJestConfigPath(platform, runner, kind); - const args = bsLocal ? ['pnpm', 'vitest', '-c', path.resolve(ROOT_DIR, './test/integration/browserstack/vite.config.mts')] : [ + const args = runner === 'browserstack' ? ['pnpm', 'vitest', '-c', path.resolve(ROOT_DIR, './test/integration/browserstack/vite.config.mts')] : [ 'pnpm', 'jest', '--config', @@ -212,28 +180,9 @@ const test = async (platform: Platform | Platform[], runner: Runner, kind: Kind, if (verbose) { console.log(args.join(' ')); - if (bsLocal) { - console.log('bsLocal.isRunning(): ', bsLocal?.isRunning()); - } } const code = await runTTYProcess(args[0], args.slice(1), { verbose, platform, useGPU }); - if (runner === 'browserstack') { - if (!bsLocal) { - throw new Error('bsLocal was never initialized even though runner is browserstack') - } - if (bsLocal.isRunning() === false) { - console.log('bsLocal is already stopped.') - } else { - if (verbose) { - console.log('Stopping browserstack', bsLocal.isRunning()); - } - await stopBrowserstack(bsLocal); - if (verbose) { - console.log('Stopped browserstack') - } - } - } if (code !== null) { process.exit(code); } @@ -249,7 +198,6 @@ interface Args { skipBundle?: boolean; runner: Runner; positionalArgs: (string | number)[]; - browserstackAccessKey?: string; verbose?: boolean; kind: Kind; useGPU?: boolean; @@ -303,8 +251,6 @@ const getRunner = (runner?: string): Runner => { } const getArgs = async (): Promise => { - const BROWSERSTACK_ACCESS_KEY = getBrowserstackAccessKey(); - const argv = await yargs(process.argv.slice(2)).options({ watch: { type: 'boolean' }, platform: { type: 'string' }, @@ -327,7 +273,6 @@ const getArgs = async (): Promise => { return { ...argv, - browserstackAccessKey: BROWSERSTACK_ACCESS_KEY, platform, runner, kind,