@@ -61,16 +61,17 @@ runTest("normalizeString", normalizeString, {
61
61
// './foobar./../a/./': 'a',
62
62
63
63
// Windows
64
- [ normalizeWindowsPath ( " C:\\ temp\\.." ) ] : "C:" ,
65
- [ normalizeWindowsPath ( " C:\\ temp\\ ..\\.\\ Users" ) ] : "C:/Users" ,
66
- [ normalizeWindowsPath ( " C:\\ temp\\ ..\\ .well-known\\ Users" ) ] :
64
+ [ normalizeWindowsPath ( String . raw ` C:\temp\..` ) ] : "C:" ,
65
+ [ normalizeWindowsPath ( String . raw ` C:\temp\..\.\ Users` ) ] : "C:/Users" ,
66
+ [ normalizeWindowsPath ( String . raw ` C:\temp\..\.well-known\Users` ) ] :
67
67
"C:/.well-known/Users" ,
68
- [ normalizeWindowsPath ( " C:\\ temp\\ ..\\ ..well-known\\ Users" ) ] :
68
+ [ normalizeWindowsPath ( String . raw ` C:\temp\..\..well-known\Users` ) ] :
69
69
"C:/..well-known/Users" ,
70
70
[ normalizeWindowsPath ( "C:\\a\\..\\" ) ] : "C:" ,
71
- [ normalizeWindowsPath ( "C:\\temp\\myfile.html" ) ] : "C:/temp/myfile.html" ,
72
- [ normalizeWindowsPath ( "\\temp\\myfile.html" ) ] : "temp/myfile.html" ,
73
- [ normalizeWindowsPath ( ".\\myfile.html" ) ] : "myfile.html" ,
71
+ [ normalizeWindowsPath ( String . raw `C:\temp\myfile.html` ) ] :
72
+ "C:/temp/myfile.html" ,
73
+ [ normalizeWindowsPath ( String . raw `\temp\myfile.html` ) ] : "temp/myfile.html" ,
74
+ [ normalizeWindowsPath ( String . raw `.\myfile.html` ) ] : "myfile.html" ,
74
75
} ) ;
75
76
76
77
runTest ( "basename" , basename , [
@@ -81,11 +82,11 @@ runTest("basename", basename, [
81
82
[ "./undefined" , undefined , "undefined" ] ,
82
83
83
84
// Windows
84
- [ " C:\\ temp\\ myfile.html" , "myfile.html" ] ,
85
- [ "\\ temp\\ myfile.html" , "myfile.html" ] ,
86
- [ ".\\ myfile.html" , "myfile.html" ] ,
87
- [ ".\\ myfile.html" , ".html" , "myfile" ] ,
88
- [ ".\\ undefined" , undefined , "undefined" ] ,
85
+ [ String . raw ` C:\temp\myfile.html` , "myfile.html" ] ,
86
+ [ String . raw `\ temp\myfile.html` , "myfile.html" ] ,
87
+ [ String . raw `.\ myfile.html` , "myfile.html" ] ,
88
+ [ String . raw `.\ myfile.html` , ".html" , "myfile" ] ,
89
+ [ String . raw `.\ undefined ` , undefined , "undefined" ] ,
89
90
] ) ;
90
91
91
92
runTest ( "dirname" , dirname , {
@@ -135,7 +136,7 @@ runTest("format", format, [
135
136
136
137
// Windows
137
138
[ { name : "file" , base : "file.txt" } , "file.txt" ] ,
138
- [ { dir : " C:\\ path\\ dir" , base : "file.txt" } , "C:/path/dir/file.txt" ] ,
139
+ [ { dir : String . raw ` C:\path\dir` , base : "file.txt" } , "C:/path/dir/file.txt" ] ,
139
140
] ) ;
140
141
141
142
runTest ( "join" , join , [
@@ -145,18 +146,29 @@ runTest("join", join, [
145
146
[ "/test//" , "//path" , "/test/path" ] ,
146
147
[ "some/nodejs/deep" , "../path" , "some/nodejs/path" ] ,
147
148
[ "./some/local/unix/" , "../path" , "some/local/path" ] ,
148
- [ "./some\\current\\mixed" , "..\\path" , "some/current/path" ] ,
149
- [ "../some/relative/destination" , "..\\path" , "../some/relative/path" ] ,
149
+ [ String . raw `./some\current\mixed` , String . raw `..\path` , "some/current/path" ] ,
150
+ [
151
+ "../some/relative/destination" ,
152
+ String . raw `..\path` ,
153
+ "../some/relative/path" ,
154
+ ] ,
150
155
[ "some/nodejs/deep" , "../path" , "some/nodejs/path" ] ,
151
156
[ "/foo" , "bar" , "baz/asdf" , "quux" , ".." , "/foo/bar/baz/asdf" ] ,
152
157
153
- [ "C:\\foo" , "bar" , "baz\\asdf" , "quux" , ".." , "C:/foo/bar/baz/asdf" ] ,
154
- [ "some/nodejs\\windows" , "../path" , "some/nodejs/path" ] ,
155
- [ "some\\windows\\only" , "..\\path" , "some/windows/path" ] ,
158
+ [
159
+ String . raw `C:\foo` ,
160
+ "bar" ,
161
+ String . raw `baz\asdf` ,
162
+ "quux" ,
163
+ ".." ,
164
+ "C:/foo/bar/baz/asdf" ,
165
+ ] ,
166
+ [ String . raw `some/nodejs\windows` , "../path" , "some/nodejs/path" ] ,
167
+ [ String . raw `some\windows\only` , String . raw `..\path` , "some/windows/path" ] ,
156
168
// UNC paths
157
- [ "\\\\ server\\ share\\ file" , "..\\ path" , "//server/share/path" ] ,
158
- [ "\\\\.\\ c:\\ temp\\ file" , "..\\ path" , "//./c:/temp/path" ] ,
159
- [ "\\\\ server/share/file" , "../path" , "//server/share/path" ] ,
169
+ [ String . raw `\\ server\share\file` , String . raw `..\ path` , "//server/share/path" ] ,
170
+ [ String . raw `\\.\ c:\temp\file` , String . raw `..\ path` , "//./c:/temp/path" ] ,
171
+ [ String . raw `\\ server/share/file` , "../path" , "//server/share/path" ] ,
160
172
] ) ;
161
173
162
174
runTest ( "normalize" , normalize , {
@@ -216,14 +228,14 @@ it("parse", () => {
216
228
} ) ;
217
229
218
230
// Windows
219
- expect ( parse ( " C:\\ path\\ dir\\ file.txt" ) ) . to . deep . equal ( {
231
+ expect ( parse ( String . raw ` C:\path\dir\file.txt` ) ) . to . deep . equal ( {
220
232
root : "C:" ,
221
233
dir : "C:/path/dir" ,
222
234
base : "file.txt" ,
223
235
ext : ".txt" ,
224
236
name : "file" ,
225
237
} ) ;
226
- expect ( parse ( ".\\ dir\\ file" ) ) . to . deep . equal ( {
238
+ expect ( parse ( String . raw `.\ dir\file` ) ) . to . deep . equal ( {
227
239
root : "." ,
228
240
dir : "./dir" ,
229
241
base : "file" ,
@@ -244,11 +256,19 @@ runTest("relative", relative, [
244
256
] ,
245
257
246
258
// Windows
247
- [ "C:\\orandea\\test\\aaa" , "C:\\orandea\\impl\\bbb" , "../../impl/bbb" ] ,
248
- [ "C:\\orandea\\test\\aaa" , "c:\\orandea\\impl\\bbb" , "../../impl/bbb" ] ,
249
- [ "C:\\" , "C:\\foo\\bar" , "foo/bar" ] ,
250
- [ "C:\\foo" , "C:\\" , ".." ] ,
251
- [ "C:\\foo" , "d:\\bar" , "D:/bar" ] ,
259
+ [
260
+ String . raw `C:\orandea\test\aaa` ,
261
+ String . raw `C:\orandea\impl\bbb` ,
262
+ "../../impl/bbb" ,
263
+ ] ,
264
+ [
265
+ String . raw `C:\orandea\test\aaa` ,
266
+ String . raw `c:\orandea\impl\bbb` ,
267
+ "../../impl/bbb" ,
268
+ ] ,
269
+ [ "C:\\" , String . raw `C:\foo\bar` , "foo/bar" ] ,
270
+ [ String . raw `C:\foo` , "C:\\" , ".." ] ,
271
+ [ String . raw `C:\foo` , String . raw `d:\bar` , "D:/bar" ] ,
252
272
[
253
273
( ) => process . cwd ( ) . replace ( / \\ / g, "/" ) ,
254
274
"./dist/client/b-scroll.d.ts" ,
@@ -278,13 +298,13 @@ runTest("resolve", resolve, [
278
298
] ,
279
299
280
300
// Windows
281
- [ " C:\\ foo\\ bar" , ".\\ baz" , "C:/foo/bar/baz" ] ,
282
- [ "\\ foo\\ bar" , ".\\ baz" , "/foo/bar/baz" ] ,
283
- [ "\\ foo\\ bar" , ".." , "." , ".\\ baz" , "/foo/baz" ] ,
284
- [ "\\ foo\\ bar" , "\\tmp\\file\\" , "/tmp/file" ] ,
285
- [ "\\ foo\\ bar" , undefined , null , "" , "\\tmp\\file\\" , "/tmp/file" ] ,
301
+ [ String . raw ` C:\foo\bar` , String . raw `.\ baz` , "C:/foo/bar/baz" ] ,
302
+ [ String . raw `\ foo\bar` , String . raw `.\ baz` , "/foo/bar/baz" ] ,
303
+ [ String . raw `\ foo\bar` , ".." , "." , String . raw `.\ baz` , "/foo/baz" ] ,
304
+ [ String . raw `\ foo\bar` , "\\tmp\\file\\" , "/tmp/file" ] ,
305
+ [ String . raw `\ foo\bar` , undefined , null , "" , "\\tmp\\file\\" , "/tmp/file" ] ,
286
306
[
287
- "\\ foo\\ bar" ,
307
+ String . raw `\ foo\bar` ,
288
308
undefined ,
289
309
null ,
290
310
"" ,
@@ -297,15 +317,15 @@ runTest("resolve", resolve, [
297
317
[
298
318
"wwwroot" ,
299
319
"static_files\\png\\" ,
300
- "..\\ gif\\ image.gif" ,
320
+ String . raw `..\ gif\image.gif` ,
301
321
( ) =>
302
322
`${ process . cwd ( ) . replace ( / \\ / g, "/" ) } /wwwroot/static_files/gif/image.gif` ,
303
323
] ,
304
- [ " C:\\ Windows\\ path\\ only" , "../../reports" , "C:/Windows/reports" ] ,
324
+ [ String . raw ` C:\Windows\path\only` , "../../reports" , "C:/Windows/reports" ] ,
305
325
[
306
- " C:\\ Windows\\ long\\ path\\ mixed/with/unix" ,
326
+ String . raw ` C:\Windows\long\path\mixed/with/unix` ,
307
327
"../.." ,
308
- "..\\ ../reports" ,
328
+ String . raw `..\ ../reports` ,
309
329
"C:/Windows/long/reports" ,
310
330
] ,
311
331
] ) ;
@@ -367,7 +387,7 @@ export function runTest(name, function_, items) {
367
387
expected ,
368
388
) } on Windows`, ( ) => {
369
389
cwd = process . cwd ;
370
- process . cwd = vi . fn ( ( ) => " C:\\ Windows\\ path\\ only" ) ;
390
+ process . cwd = vi . fn ( ( ) => String . raw ` C:\Windows\path\only` ) ;
371
391
expect ( function_ ( ...arguments_ . map ( ( i ) => _r ( i ) ) ) ) . to . equal (
372
392
_r ( expected ) ,
373
393
) ;
0 commit comments