@@ -8,15 +8,14 @@ import CSharpDefinitionProvider from "../../src/features/definitionProvider";
88import * as path from "path" ;
99import testAssetWorkspace from "./testAssets/testAssetWorkspace" ;
1010import { expect } from "chai" ;
11- import { activateCSharpExtension , isRazorWorkspace , isSlnWithCsproj , restartOmniSharpServer } from './integrationHelpers' ;
12- import { assertWithPoll } from "./poll" ;
11+ import { activateCSharpExtension , isRazorWorkspace , isSlnWithGenerator , restartOmniSharpServer } from './integrationHelpers' ;
1312
1413suite ( `${ CSharpDefinitionProvider . name } : ${ testAssetWorkspace . description } ` , ( ) => {
1514 let fileUri : vscode . Uri ;
1615
1716 suiteSetup ( async function ( ) {
1817 // These tests don't run on the BasicRazorApp2_1 solution
19- if ( isRazorWorkspace ( vscode . workspace ) ) {
18+ if ( isRazorWorkspace ( vscode . workspace ) || isSlnWithGenerator ( vscode . workspace ) ) {
2019 this . skip ( ) ;
2120 }
2221
@@ -60,48 +59,6 @@ suite(`${CSharpDefinitionProvider.name}: ${testAssetWorkspace.description}`, ()
6059 expect ( definitionList [ 1 ] . uri . path ) . to . contain ( "definition.cs" ) ;
6160 } ) ;
6261
63- test ( "Generated file returns definitions and adds source" , async ( ) => {
64- if ( ! isSlnWithCsproj ( vscode . workspace ) ) {
65- return ;
66- }
67-
68- const projectDirectory = testAssetWorkspace . projects [ 0 ] . projectDirectoryPath ;
69- const generatorTriggerUri = vscode . Uri . file ( path . join ( projectDirectory , 'GeneratorTrigger.cs' ) ) ;
70- const textStart = new vscode . Position ( 11 , 41 ) ;
71- await vscode . commands . executeCommand ( 'vscode.open' , generatorTriggerUri ) ;
72-
73- // // We need to do a full build in order to get the source generator built and ready to run, or tests will fail
74- // await vscode.commands.executeCommand("dotnet.generateAssets", 0);
75- // await sleep(100);
76- // const tasks = await vscode.tasks.fetchTasks();
77- // const task = (tasks).filter(task => task.name === 'build')[0];
78- // expect(task).to.not.be.undefined;
79- // await vscode.tasks.executeTask(task);
80- // await restartOmniSharpServer();
81-
82- const definitionList = < vscode . Location [ ] > ( await vscode . commands . executeCommand ( "vscode.executeDefinitionProvider" , generatorTriggerUri , textStart ) ) ;
83- expect ( definitionList . length ) . to . be . equal ( 1 ) ;
84- expect ( definitionList [ 0 ] ) . to . exist ;
85- expect ( definitionList [ 0 ] . uri . path ) . to . contain ( "GeneratedCode.cs" ) ;
86-
87- const generatedCodeUri = definitionList [ 0 ] . uri ;
88- let generatedCodeDocument = await vscode . workspace . openTextDocument ( generatedCodeUri ) ;
89- expect ( generatedCodeDocument . getText ( ) ) . contains ( "Hello world!" ) ;
90- expect ( generatedCodeDocument . getText ( ) ) . does . not . contain ( "Goodbye" ) ;
91-
92- await vscode . commands . executeCommand ( 'vscode.open' , generatorTriggerUri ) ;
93- const textEdit = new vscode . WorkspaceEdit ( ) ;
94- textEdit . replace ( generatorTriggerUri , new vscode . Range ( new vscode . Position ( 9 , 27 ) , new vscode . Position ( 9 , 38 ) ) , "Goodbye" ) ;
95- expect ( await vscode . workspace . applyEdit ( textEdit ) ) . to . be . true ;
96-
97- await vscode . commands . executeCommand ( 'vscode.open' , generatedCodeUri ) ;
98- await assertWithPoll ( ( ) => { } , 15 * 1000 , 500 , _ => {
99- const documentText = vscode . window . activeTextEditor . document . getText ( ) ;
100- expect ( documentText ) . does . not . contain ( "Hello world!" ) ;
101- expect ( documentText ) . contains ( "Goodbye" ) ;
102- } ) ;
103- } ) ;
104-
10562 suiteTeardown ( async ( ) => {
10663 await testAssetWorkspace . cleanupWorkspace ( ) ;
10764 } ) ;
0 commit comments