import { Context , Test } from 'mocha' ; import * as path from 'path' ; import { ext , SnippetManager } from "../../extension.bundle" ; import { writeToLog } from './testLog' ; import { RequiresLanguageServer } from './testWithLanguageServer' ; import { ITestPreparation , ITestPreparationResult , testWithPrep } from './testWithPrep' ; export function useTestSnippets ( ) { ext . snippetManager . value = new SnippetManager ( path . join ( __dirname , '..' , '..' , '..' , 'test' , 'support' , 'TestArmSnippets.jsonc' ) , undefined ) ; writeToLog ( "Installed test snippets" ) ; } export function useRealSnippets ( ) { ext . snippetManager . value = SnippetManager . createDefault ( ) ; writeToLog ( "Installed real snippets" ) ; } export function useNoSnippets ( ) { ext . snippetManager . value = new SnippetManager ( path . join ( __dirname , '..' , '..' , '..' , 'test' , 'support' , 'EmptySnippets.jsonc' ) , undefined ) ; writeToLog ( "Installed empty snippet manager" ) ; } export class UseRealSnippets implements ITestPreparation { public static readonly instance : UseRealSnippets = new UseRealSnippets ( ) ; public pretest ( this ) { useRealSnippets ( ) ; return { postTestActions : useTestSnippets } ; } } export class UseNoSnippets implements ITestPreparation { public static readonly instance : UseNoSnippets = new UseNoSnippets ( ) ; public pretest ( this ) { useNoSnippets ( ) ; return { postTestActions : useTestSnippets } ; } } export function testWithRealSnippets ( expectation , callback ? ) { return testWithPrep ( expectation , [ UseRealSnippets . instance , RequiresLanguageServer . instance ] , callback ) ; }