@@ -14,14 +14,15 @@ import * as uuid from 'vs/base/common/uuid';
1414import { IConfigurationRegistry , Extensions as ConfigurationExtensions } from 'vs/platform/configuration/common/configurationRegistry' ;
1515import { testFile } from 'vs/base/test/node/utils' ;
1616import { URI } from 'vs/base/common/uri' ;
17+ import { dirname } from 'vs/base/common/resources' ;
1718
1819suite ( 'ConfigurationService - Node' , ( ) => {
1920
2021 test ( 'simple' , async ( ) => {
21- const res = await testFile ( 'config' , 'config .json' ) ;
22+ const res = await testFile ( 'config' , 'settings .json' ) ;
2223 fs . writeFileSync ( res . testFile , '{ "foo": "bar" }' ) ;
2324
24- const service = new ConfigurationService ( URI . file ( res . testFile ) ) ;
25+ const service = new ConfigurationService ( dirname ( URI . file ( res . testFile ) ) ) ;
2526 await service . initialize ( ) ;
2627 const config = service . getValue < {
2728 foo : string ;
@@ -35,11 +36,11 @@ suite('ConfigurationService - Node', () => {
3536 } ) ;
3637
3738 test ( 'config gets flattened' , async ( ) => {
38- const res = await testFile ( 'config' , 'config .json' ) ;
39+ const res = await testFile ( 'config' , 'settings .json' ) ;
3940
4041 fs . writeFileSync ( res . testFile , '{ "testworkbench.editor.tabs": true }' ) ;
4142
42- const service = new ConfigurationService ( URI . file ( res . testFile ) ) ;
43+ const service = new ConfigurationService ( dirname ( URI . file ( res . testFile ) ) ) ;
4344 await service . initialize ( ) ;
4445 const config = service . getValue < {
4546 testworkbench : {
@@ -58,11 +59,11 @@ suite('ConfigurationService - Node', () => {
5859 } ) ;
5960
6061 test ( 'error case does not explode' , async ( ) => {
61- const res = await testFile ( 'config' , 'config .json' ) ;
62+ const res = await testFile ( 'config' , 'settings .json' ) ;
6263
6364 fs . writeFileSync ( res . testFile , ',,,,' ) ;
6465
65- const service = new ConfigurationService ( URI . file ( res . testFile ) ) ;
66+ const service = new ConfigurationService ( dirname ( URI . file ( res . testFile ) ) ) ;
6667 await service . initialize ( ) ;
6768 const config = service . getValue < {
6869 foo : string ;
@@ -77,9 +78,9 @@ suite('ConfigurationService - Node', () => {
7778 const id = uuid . generateUuid ( ) ;
7879 const parentDir = path . join ( os . tmpdir ( ) , 'vsctests' , id ) ;
7980 const newDir = path . join ( parentDir , 'config' , id ) ;
80- const testFile = path . join ( newDir , 'config .json' ) ;
81+ const testFile = path . join ( newDir , 'settings .json' ) ;
8182
82- const service = new ConfigurationService ( URI . file ( testFile ) ) ;
83+ const service = new ConfigurationService ( dirname ( URI . file ( testFile ) ) ) ;
8384 await service . initialize ( ) ;
8485
8586 const config = service . getValue < { foo : string } > ( ) ;
@@ -89,9 +90,9 @@ suite('ConfigurationService - Node', () => {
8990 } ) ;
9091
9192 test ( 'trigger configuration change event' , async ( ) => {
92- const res = await testFile ( 'config' , 'config .json' ) ;
93+ const res = await testFile ( 'config' , 'settings .json' ) ;
9394
94- const service = new ConfigurationService ( URI . file ( res . testFile ) ) ;
95+ const service = new ConfigurationService ( dirname ( URI . file ( res . testFile ) ) ) ;
9596 await service . initialize ( ) ;
9697 return new Promise ( ( c , e ) => {
9798 service . onDidChangeConfiguration ( ( ) => {
@@ -105,11 +106,11 @@ suite('ConfigurationService - Node', () => {
105106 } ) ;
106107
107108 test ( 'reloadConfiguration' , async ( ) => {
108- const res = await testFile ( 'config' , 'config .json' ) ;
109+ const res = await testFile ( 'config' , 'settings .json' ) ;
109110
110111 fs . writeFileSync ( res . testFile , '{ "foo": "bar" }' ) ;
111112
112- const service = new ConfigurationService ( URI . file ( res . testFile ) ) ;
113+ const service = new ConfigurationService ( dirname ( URI . file ( res . testFile ) ) ) ;
113114 await service . initialize ( ) ;
114115 let config = service . getValue < {
115116 foo : string ;
@@ -158,17 +159,17 @@ suite('ConfigurationService - Node', () => {
158159 }
159160 } ) ;
160161
161- let serviceWithoutFile = new ConfigurationService ( URI . file ( '__testFile' ) ) ;
162+ let serviceWithoutFile = new ConfigurationService ( dirname ( URI . file ( '__testFile' ) ) ) ;
162163 await serviceWithoutFile . initialize ( ) ;
163164 let setting = serviceWithoutFile . getValue < ITestSetting > ( ) ;
164165
165166 assert . ok ( setting ) ;
166167 assert . equal ( setting . configuration . service . testSetting , 'isSet' ) ;
167168
168- return testFile ( 'config' , 'config .json' ) . then ( async res => {
169+ return testFile ( 'config' , 'settings .json' ) . then ( async res => {
169170 fs . writeFileSync ( res . testFile , '{ "testworkbench.editor.tabs": true }' ) ;
170171
171- const service = new ConfigurationService ( URI . file ( res . testFile ) ) ;
172+ const service = new ConfigurationService ( dirname ( URI . file ( res . testFile ) ) ) ;
172173
173174 let setting = service . getValue < ITestSetting > ( ) ;
174175
@@ -200,8 +201,8 @@ suite('ConfigurationService - Node', () => {
200201 }
201202 } ) ;
202203
203- const r = await testFile ( 'config' , 'config .json' ) ;
204- const service = new ConfigurationService ( URI . file ( r . testFile ) ) ;
204+ const r = await testFile ( 'config' , 'settings .json' ) ;
205+ const service = new ConfigurationService ( dirname ( URI . file ( r . testFile ) ) ) ;
205206 service . initialize ( ) ;
206207
207208 let res = service . inspect ( 'something.missing' ) ;
@@ -238,8 +239,8 @@ suite('ConfigurationService - Node', () => {
238239 }
239240 } ) ;
240241
241- const r = await testFile ( 'config' , 'config .json' ) ;
242- const service = new ConfigurationService ( URI . file ( r . testFile ) ) ;
242+ const r = await testFile ( 'config' , 'settings .json' ) ;
243+ const service = new ConfigurationService ( dirname ( URI . file ( r . testFile ) ) ) ;
243244 service . initialize ( ) ;
244245
245246 let res = service . inspect ( 'lookup.service.testNullSetting' ) ;
0 commit comments