@@ -19,8 +19,6 @@ beforeAll(async () => {
19
19
templateRoot = path . join ( templatesRoot , 'default' ) ;
20
20
// 创建测试模板文件
21
21
fse . outputFileSync ( path . join ( templateRoot , 'file1.txt.ejs' ) , 'Hello <%= ctx.projectName %>' ) ;
22
- fse . outputFileSync ( path . join ( templateRoot , '__file2.txt.ejs' ) , 'Hello <%= ctx.projectName %>' ) ;
23
- fse . outputFileSync ( path . join ( templateRoot , '_file3.txt.ejs' ) , 'Hello <%= ctx.projectName %>' ) ;
24
22
fse . outputFileSync ( path . join ( templateRoot , 'path/to/file4.txt' ) , 'Hello <%= ctx.projectName %>' ) ;
25
23
} ) ;
26
24
@@ -195,43 +193,6 @@ it('应该支持自定义扩展数据', async () => {
195
193
) ;
196
194
} ) ;
197
195
198
- it ( '应该正确处理下划线前缀文件' , async ( ) => {
199
- await runTest ( async ( { cwd } ) => {
200
- const creator = new Creator ( {
201
- cwd,
202
- templatesRoot,
203
- } ) ;
204
-
205
- await expectExit ( creator . create ( ) , 0 ) ;
206
-
207
- expect ( isFile ( path . join ( cwd , '__file2.txt.ejs' ) ) ) . toBe ( false ) ;
208
- expect ( isFile ( path . join ( cwd , '__file2.txt' ) ) ) . toBe ( false ) ;
209
- expect ( isFile ( path . join ( cwd , '_file2.txt' ) ) ) . toBe ( true ) ;
210
- expect ( isFile ( path . join ( cwd , '.file2.txt' ) ) ) . toBe ( false ) ;
211
-
212
- expect ( isFile ( path . join ( cwd , '_file3.txt.ejs' ) ) ) . toBe ( false ) ;
213
- expect ( isFile ( path . join ( cwd , '_file3.txt' ) ) ) . toBe ( false ) ;
214
- expect ( isFile ( path . join ( cwd , '.file3.txt' ) ) ) . toBe ( true ) ;
215
- } ) ;
216
- } ) ;
217
-
218
- it ( '应该正确处理点前缀文件' , async ( ) => {
219
- const fileName = `${ Math . random ( ) . toString ( 36 ) . slice ( 2 ) } .xx` ;
220
- await runTest ( async ( { cwd } ) => {
221
- fs . writeFileSync ( path . join ( templateRoot , `_${ fileName } ` ) , 'test content' ) ;
222
-
223
- const creator = new Creator ( {
224
- cwd,
225
- templatesRoot,
226
- } ) ;
227
-
228
- await expectExit ( creator . create ( ) , 0 ) ;
229
-
230
- expect ( fs . existsSync ( path . join ( cwd , `.${ fileName } ` ) ) ) . toBe ( true ) ;
231
- expect ( fs . existsSync ( path . join ( cwd , `_${ fileName } ` ) ) ) . toBe ( false ) ;
232
- } ) ;
233
- } ) ;
234
-
235
196
it ( '写入文件前拦截 disableRenderEjs' , async ( ) => {
236
197
await runTest ( async ( { cwd } ) => {
237
198
const creator = new Creator ( {
@@ -297,15 +258,10 @@ it('写入文件前拦截 targetFileName', async () => {
297
258
expect ( isFile ( path . join ( cwd , 'file1.txt.ejs' ) ) ) . toBe ( true ) ;
298
259
expect ( isFile ( path . join ( cwd , 'file1.txt' ) ) ) . toBe ( false ) ;
299
260
300
- expect ( isFile ( path . join ( cwd , '__file2.txt.ejs' ) ) ) . toBe ( true ) ;
301
- expect ( isFile ( path . join ( cwd , '_file3.txt.ejs' ) ) ) . toBe ( true ) ;
302
-
303
261
expect ( isFile ( path . join ( cwd , 'path/to/file4.txt' ) ) ) . toBe ( false ) ;
304
262
expect ( isFile ( path . join ( cwd , 'path/to/file4.txt.ok' ) ) ) . toBe ( true ) ;
305
263
306
264
expect ( fs . readFileSync ( path . join ( cwd , 'file1.txt.ejs' ) , 'utf8' ) ) . not . toMatch ( '<%=' ) ;
307
- expect ( fs . readFileSync ( path . join ( cwd , '__file2.txt.ejs' ) , 'utf8' ) ) . not . toMatch ( '<%=' ) ;
308
- expect ( fs . readFileSync ( path . join ( cwd , '_file3.txt.ejs' ) , 'utf8' ) ) . not . toMatch ( '<%=' ) ;
309
265
expect ( fs . readFileSync ( path . join ( cwd , 'path/to/file4.txt.ok' ) , 'utf8' ) ) . toMatch ( '<%=' ) ;
310
266
} ) ;
311
267
} ) ;
0 commit comments