import * as fs from "fs" ; import { NodeRuntime } from "../node-runtime" ; import { buildDefaultProjectInput , Runtime , ProjectBuild , RuntimeLogLevels , } from "@codotype/core" ; import { resolve } from "path" ; import { LocalFileSystemAdapter } from "../LocalFileSystemAdapter" ; describe ( "testing @codotype/runtime v2" , ( ) => { test ( "testing @codotype/runtime composeWith" , async ( ) => { const cwd = `${ __dirname }/__snapshots__` ; const nodeRuntime = new NodeRuntime ( { cwd , fileOverwriteBehavior : "force" , fileSystemAdapter : new LocalFileSystemAdapter ( ) , } ) ; const pluginRegistration = await nodeRuntime . registerPlugin ( { relativePath : "../mock_plugin" , } ) ; if ( pluginRegistration === null ) { return ; } const projectInput = buildDefaultProjectInput ( pluginRegistration . pluginMetadata ) ; const build = { id : "test-project" , projectInput , startTime : new Date ( ) . toISOString ( ) , endTime : new Date ( ) . toISOString ( ) , } ; await nodeRuntime . execute ( { build } ) ; const txtExists = fs . existsSync ( resolve ( cwd , ".codotype-out/test-project/project_name/Hello.txt" ) ) ; const readmeExists = fs . existsSync ( resolve ( cwd , ".codotype-out/test-project/project_name/README-TEST.md" ) ) ; const scopedFile = fs . existsSync ( resolve ( cwd , ".codotype-out/test-project/project_name/scoped-output/SCOPED-TEST.md" ) ) ; expect ( txtExists ) . toBe ( true ) ; expect ( readmeExists ) . toBe ( true ) ; expect ( scopedFile ) . toBe ( true ) ; } ) ; } ) ;