ARTICLE AD BOX
As my comment suggested, you do need async/await to get the test to run as you expect. Here is the updated code:
suite( 'Extension Test Suite', () => { test( 'Smoke test', async () => { let editor = vscode.window.activeTextEditor; if ( editor !== undefined ) { let testText = `failed`; let expectedResult = `passed`; await editor.edit( editBuilder => { editBuilder.replace( editor.selection.active, testText ); } ).then( ( result ) => { assert.strictEqual( result, true ); // stops here first } ); // stop here second assert.strictEqual( editor.document.getText(), expectedResult, "Text should match" ); } else throw new Error( "Editor is undefined" ); } ); } );Now the assert.strictEqual( editor.document.getText(), expectedResult, "Text should match" ); line is hit after the edit replace is completed. I do see failed in the file at that point.
The thing I don't understand is that you insert testText ("failed") into the file and then assert that "failed" will equal "passed" ??
193k32 gold badges564 silver badges580 bronze badges
Explore related questions
See similar questions with these tags.
