33 * Licensed under the MIT License. See License.txt in the project root for license information.
44 *--------------------------------------------------------------------------------------------*/
55
6- import { should , expect } from 'chai ' ;
6+ import { describe , test , expect , beforeEach } from '@jest/globals ' ;
77import { getNullChannel } from '../../../test/unitTests/fakes' ;
88import { CsharpLoggerObserver } from '../../../src/shared/observers/csharpLoggerObserver' ;
99import { PlatformInformation } from '../../../src/shared/platform' ;
1010import * as Event from '../../../src/omnisharp/loggingEvents' ;
1111import { PackageError } from '../../../src/packageManager/packageError' ;
1212import { Package } from '../../../src/packageManager/package' ;
1313
14- suite ( 'CsharpLoggerObserver' , ( ) => {
15- suiteSetup ( ( ) => should ( ) ) ;
16-
14+ describe ( 'CsharpLoggerObserver' , ( ) => {
1715 let logOutput = '' ;
1816 const observer = new CsharpLoggerObserver ( {
1917 ...getNullChannel ( ) ,
@@ -29,30 +27,30 @@ suite('CsharpLoggerObserver', () => {
2927 architectures : [ ] ,
3028 } ;
3129
32- setup ( ( ) => {
30+ beforeEach ( ( ) => {
3331 logOutput = '' ;
3432 } ) ;
3533
3634 test ( 'PlatformInfo: Logs contain the Platform and Architecture' , ( ) => {
3735 const event = new Event . LogPlatformInfo ( new PlatformInformation ( 'linux' , 'MyArchitecture' ) ) ;
3836 observer . post ( event ) ;
39- expect ( logOutput ) . to . contain ( 'linux' ) ;
40- expect ( logOutput ) . to . contain ( 'MyArchitecture' ) ;
37+ expect ( logOutput ) . toContain ( 'linux' ) ;
38+ expect ( logOutput ) . toContain ( 'MyArchitecture' ) ;
4139 } ) ;
4240
43- suite ( 'InstallationFailure' , ( ) => {
41+ describe ( 'InstallationFailure' , ( ) => {
4442 test ( 'Stage and Error is logged if not a PackageError' , ( ) => {
4543 const event = new Event . InstallationFailure ( 'someStage' , new Error ( 'someError' ) ) ;
4644 observer . post ( event ) ;
47- expect ( logOutput ) . to . contain ( event . stage ) ;
48- expect ( logOutput ) . to . contain ( event . error . toString ( ) ) ;
45+ expect ( logOutput ) . toContain ( event . stage ) ;
46+ expect ( logOutput ) . toContain ( event . error . toString ( ) ) ;
4947 } ) ;
5048
5149 test ( 'Stage and Error is logged if a PackageError without inner error' , ( ) => {
5250 const event = new Event . InstallationFailure ( 'someStage' , new PackageError ( 'someError' , pkg , undefined ) ) ;
5351 observer . post ( event ) ;
54- expect ( logOutput ) . to . contain ( event . stage ) ;
55- expect ( logOutput ) . to . contain ( event . error . message ) ;
52+ expect ( logOutput ) . toContain ( event . stage ) ;
53+ expect ( logOutput ) . toContain ( event . error . message ) ;
5654 } ) ;
5755
5856 test ( 'Stage and Inner error is logged if a PackageError without inner error' , ( ) => {
@@ -61,12 +59,12 @@ suite('CsharpLoggerObserver', () => {
6159 new PackageError ( 'someError' , pkg , new Error ( 'innerError' ) )
6260 ) ;
6361 observer . post ( event ) ;
64- expect ( logOutput ) . to . contain ( event . stage ) ;
65- expect ( logOutput ) . to . contain ( event . error . innerError . toString ( ) ) ;
62+ expect ( logOutput ) . toContain ( event . stage ) ;
63+ expect ( logOutput ) . toContain ( event . error . innerError . toString ( ) ) ;
6664 } ) ;
6765 } ) ;
6866
69- suite ( 'Download' , ( ) => {
67+ describe ( 'Download' , ( ) => {
7068 const packageName = 'somePackage' ;
7169 [
7270 {
@@ -155,7 +153,7 @@ suite('CsharpLoggerObserver', () => {
155153 } ) ;
156154
157155 element . events . forEach ( ( message : Event . BaseEvent ) => observer . post ( message ) ) ;
158- expect ( logOutput ) . to . be . equal ( element . expected ) ;
156+ expect ( logOutput ) . toEqual ( element . expected ) ;
159157 } ) ;
160158 } ) ;
161159 } ) ;
@@ -172,66 +170,66 @@ suite('CsharpLoggerObserver', () => {
172170 ] . forEach ( ( element ) =>
173171 test ( `${ element . message . constructor . name } is shown` , ( ) => {
174172 observer . post ( element . message ) ;
175- expect ( logOutput ) . to . contain ( element . expected ) ;
173+ expect ( logOutput ) . toContain ( element . expected ) ;
176174 } )
177175 ) ;
178176
179177 test ( `ActivationFailure: Some message is logged` , ( ) => {
180178 const event = new Event . ActivationFailure ( ) ;
181179 observer . post ( event ) ;
182- expect ( logOutput ) . to . not . be . empty ;
180+ expect ( logOutput ) . toBeTruthy ( ) ;
183181 } ) ;
184182
185183 test ( `ProjectJsonDeprecatedWarning: Some message is logged` , ( ) => {
186184 const event = new Event . ProjectJsonDeprecatedWarning ( ) ;
187185 observer . post ( event ) ;
188- expect ( logOutput ) . to . not . be . empty ;
186+ expect ( logOutput ) . toBeTruthy ( ) ;
189187 } ) ;
190188
191189 test ( `InstallationSuccess: Some message is logged` , ( ) => {
192190 const event = new Event . InstallationSuccess ( ) ;
193191 observer . post ( event ) ;
194- expect ( logOutput ) . to . not . be . empty ;
192+ expect ( logOutput ) . toBeTruthy ( ) ;
195193 } ) ;
196194
197195 test ( `InstallationProgress: Progress message is logged` , ( ) => {
198196 const event = new Event . InstallationStart ( 'somPackage' ) ;
199197 observer . post ( event ) ;
200- expect ( logOutput ) . to . contain ( event . packageDescription ) ;
198+ expect ( logOutput ) . toContain ( event . packageDescription ) ;
201199 } ) ;
202200
203201 test ( 'PackageInstallation: Package name is logged' , ( ) => {
204202 const event = new Event . PackageInstallation ( 'somePackage' ) ;
205203 observer . post ( event ) ;
206- expect ( logOutput ) . to . contain ( event . packageInfo ) ;
204+ expect ( logOutput ) . toContain ( event . packageInfo ) ;
207205 } ) ;
208206
209207 test ( 'DownloadFallBack: The fallbackurl is logged' , ( ) => {
210208 const event = new Event . DownloadFallBack ( 'somrurl' ) ;
211209 observer . post ( event ) ;
212- expect ( logOutput ) . to . contain ( event . fallbackUrl ) ;
210+ expect ( logOutput ) . toContain ( event . fallbackUrl ) ;
213211 } ) ;
214212
215213 test ( `${ Event . IntegrityCheckFailure . name } : Package Description is logged when we are retrying` , ( ) => {
216214 const description = 'someDescription' ;
217215 const url = 'someUrl' ;
218216 const event = new Event . IntegrityCheckFailure ( description , url , true ) ;
219217 observer . post ( event ) ;
220- expect ( logOutput ) . to . contain ( description ) ;
218+ expect ( logOutput ) . toContain ( description ) ;
221219 } ) ;
222220
223221 test ( `${ Event . IntegrityCheckFailure . name } : Package Description and url are logged when we are not retrying` , ( ) => {
224222 const description = 'someDescription' ;
225223 const url = 'someUrl' ;
226224 const event = new Event . IntegrityCheckFailure ( description , url , false ) ;
227225 observer . post ( event ) ;
228- expect ( logOutput ) . to . contain ( description ) ;
229- expect ( logOutput ) . to . contain ( url ) ;
226+ expect ( logOutput ) . toContain ( description ) ;
227+ expect ( logOutput ) . toContain ( url ) ;
230228 } ) ;
231229
232230 test ( `${ Event . IntegrityCheckSuccess . name } : Some message is logged` , ( ) => {
233231 const event = new Event . IntegrityCheckSuccess ( ) ;
234232 observer . post ( event ) ;
235- expect ( logOutput ) . to . not . be . empty ;
233+ expect ( logOutput ) . toBeTruthy ( ) ;
236234 } ) ;
237235} ) ;
0 commit comments