From aa8659dde4c4a1dd3a578becfd8a95b62bfae0e0 Mon Sep 17 00:00:00 2001 From: Quentin Goinaud Date: Mon, 28 Oct 2024 11:42:13 +0100 Subject: [PATCH] fix tests --- src/main/presets/test-c3-unzip.ts | 2 +- tests/e2e/tests/basic.spec.ts | 28 +++++++++++++++++++--------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/main/presets/test-c3-unzip.ts b/src/main/presets/test-c3-unzip.ts index 98c3d49..cad561f 100644 --- a/src/main/presets/test-c3-unzip.ts +++ b/src/main/presets/test-c3-unzip.ts @@ -50,7 +50,7 @@ export const testC3Unzip: PresetFn = async () => { }, headless: { editor: 'editor', - value: true + value: false } } }, diff --git a/tests/e2e/tests/basic.spec.ts b/tests/e2e/tests/basic.spec.ts index 538f72f..cfbd936 100644 --- a/tests/e2e/tests/basic.spec.ts +++ b/tests/e2e/tests/basic.spec.ts @@ -1,9 +1,9 @@ import { it, expect, describe, vi } from 'vitest' import { execa } from 'execa' -import { join } from 'path' +import { dirname, join } from 'path' import { tmpdir } from 'os' import { nanoid } from 'nanoid' -import { readFile, writeFile } from 'fs/promises' +import { mkdir, readFile, writeFile } from 'fs/promises' import { getBinName, name, outFolderName } from '../../../src/constants' import { platform, arch } from 'process' @@ -69,16 +69,26 @@ describe('basic', () => { it( 'export c3', async () => { - const { testC3Unzip: project } = await import('../../../src/main/presets/test-c3-unzip') - // const jsonProject = join(fixtures, 'c3-export.json') - const jsonProjectData = JSON.stringify(project) - console.log('jsonProjectData', jsonProjectData) + // const { testC3Unzip } = await import('../../../src/main/presets/test-c3-unzip') - const jsonProject = join(tmpdir(), nanoid(), 'c3-export.json') + // const project = await testC3Unzip() - console.log('jsonProject', jsonProject) + // console.log('project', project) + // // const jsonProject = join(fixtures, 'c3-export.json') + // const jsonProjectData = JSON.stringify(project.data) + // console.log('jsonProjectData', jsonProjectData) + + // const jsonProject = join(tmpdir(), nanoid(), 'c3-export.json') + + // await mkdir(dirname(jsonProject), { + // recursive: true, + // }) + + // console.log('jsonProject', jsonProject) + + // await writeFile(jsonProject, jsonProjectData) - await writeFile(jsonProject, jsonProjectData) + const jsonProject = join(fixtures, 'c3-export.json') try { const { exitCode, stdout, stderr } = await execa(