From 6f33f913b412d5c43e5c4d6b66b79ff60c68e6d6 Mon Sep 17 00:00:00 2001 From: Kevin Scott <151596+thekevinscott@users.noreply.github.com> Date: Sat, 14 Oct 2023 07:12:41 -0400 Subject: [PATCH] Call memory test directly (#1221) --- .github/workflows/tests.yml | 10 +++++----- internals/common/src/npm.ts | 1 + package.json | 2 +- .../tests/{test.browser.mts => test-memory-leaks.mts} | 8 +++----- 4 files changed, 10 insertions(+), 11 deletions(-) rename test/integration/memory/tests/{test.browser.mts => test-memory-leaks.mts} (98%) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 97bc0906c..cde3d8e1d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -218,10 +218,10 @@ jobs: with: node-version: 16 - - name: Setup tmate session - uses: mxschmitt/action-tmate@v3 - with: - detached: true + # - name: Setup tmate session + # uses: mxschmitt/action-tmate@v3 + # with: + # detached: true - name: 'Integration Tests' run: pnpm test:integration:serverside -- --ci --verbose @@ -289,7 +289,7 @@ jobs: node-version: 16 - name: 'Memory Leak Tests' - run: pnpm test:integration:memory-leaks -- --ci --verbose + run: pnpm test:integration:memory-leaks build-docs: name: 'Build Documentation' diff --git a/internals/common/src/npm.ts b/internals/common/src/npm.ts index 86873a2a9..9a3b8449e 100644 --- a/internals/common/src/npm.ts +++ b/internals/common/src/npm.ts @@ -61,6 +61,7 @@ export const pnpmInstall = async (cwd: string, _opts = {}) => { 'pnpm', 'install', '--ignore-scripts', + '--fix-lockfile' // isSilent ? '--silent' : '', // '--no-fund', // '--no-audit', diff --git a/package.json b/package.json index 21b18e9a7..48f8943a2 100644 --- a/package.json +++ b/package.json @@ -331,7 +331,7 @@ ] }, "test:integration:memory-leaks": { - "command": "pnpm --filter @upscalerjs/scripts test:integration:memory-leaks", + "command": "ESBUILD_DIST_FOLDER=./tmp/bundlers/esbuild/dist vitest -c ./test/integration/memory/vite.config.mts", "dependencies": [ "./internals/common:build", "./internals/http-server:build", diff --git a/test/integration/memory/tests/test.browser.mts b/test/integration/memory/tests/test-memory-leaks.mts similarity index 98% rename from test/integration/memory/tests/test.browser.mts rename to test/integration/memory/tests/test-memory-leaks.mts index 29caf5ef8..47a8e6a0c 100644 --- a/test/integration/memory/tests/test.browser.mts +++ b/test/integration/memory/tests/test-memory-leaks.mts @@ -2,17 +2,15 @@ import { JSHandle, Page } from 'puppeteer'; import { describe, it, expect, } from 'vitest'; import Upscaler, { ModelDefinition } from 'upscaler'; import * as tf from '@tensorflow/tfjs'; -import path from 'path'; import { ClientsideTestRunner } from '@internals/test-runner/clientside'; const EXPECTED_LAYER_MODELS = 2; // I don't know why, but we start with layer model references in memory. const EXPECTED_UPSCALERS = 0; -const ROOT_BUNDLER_OUTPUT_DIR = process.env.ROOT_BUNDLER_OUTPUT_DIR; -if (typeof ROOT_BUNDLER_OUTPUT_DIR !== 'string') { - throw new Error('ROOT_BUNDLER_OUTPUT_DIR not defined in env'); +const ESBUILD_DIST_FOLDER = process.env.ESBUILD_DIST_FOLDER; +if (typeof ESBUILD_DIST_FOLDER !== 'string') { + throw new Error('ESBUILD_DIST_FOLDER not defined in env'); } -const ESBUILD_DIST_FOLDER = path.resolve(ROOT_BUNDLER_OUTPUT_DIR, 'esbuild/dist') // https://puppeteer.github.io/puppeteer/docs/10.0.0/puppeteer.page.queryobjects/#example const countObjects = async (page: Page, prototype: JSHandle): Promise => {