From b35c5ea5e21f02e486c500b69156559853e5ebcc Mon Sep 17 00:00:00 2001 From: Timeless0911 <1604889533@qq.com> Date: Wed, 31 Jul 2024 15:02:39 +0800 Subject: [PATCH] chore: update test --- e2e/cases/dts/index.test.ts | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/e2e/cases/dts/index.test.ts b/e2e/cases/dts/index.test.ts index 3a7f5c3a..70934e86 100644 --- a/e2e/cases/dts/index.test.ts +++ b/e2e/cases/dts/index.test.ts @@ -1,10 +1,18 @@ +import { execSync } from 'node:child_process'; import { join } from 'node:path'; import { expect, test } from 'vitest'; -import { buildAndGetResults } from '#shared'; +import { getResults } from '#shared'; +import { loadConfig } from '../../../packages/core/src/config'; test('dts when bundle: false', async () => { const fixturePath = join(__dirname, 'bundle-false'); - const { files } = await buildAndGetResults(fixturePath, 'dts'); + const rslibConfig = await loadConfig(join(fixturePath, 'rslib.config.ts')); + + execSync('npx rslib build', { + cwd: fixturePath, + }); + + const { files } = await getResults(rslibConfig, 'dts'); expect(files.esm?.length).toBe(4); expect(files.esm?.[0]!.endsWith('.d.ts')).toEqual(true); @@ -12,7 +20,13 @@ test('dts when bundle: false', async () => { test('dts when bundle: true', async () => { const fixturePath = join(__dirname, 'bundle'); - const { entryFiles } = await buildAndGetResults(fixturePath, 'dts'); + const rslibConfig = await loadConfig(join(fixturePath, 'rslib.config.ts')); + + execSync('npx rslib build', { + cwd: fixturePath, + }); + + const { entryFiles } = await getResults(rslibConfig, 'dts'); expect(entryFiles.esm!.endsWith('index.d.ts')).toEqual(true); });