Skip to content

Commit bad02d7

Browse files
committed
test: disable invalid test cases for Windows
1 parent 115568c commit bad02d7

File tree

1 file changed

+32
-30
lines changed

1 file changed

+32
-30
lines changed

test/rules/no-unresolved.spec.ts

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -262,12 +262,6 @@ function runResolverTests(resolver: 'node' | 'webpack') {
262262
})
263263

264264
if (!CASE_SENSITIVE_FS) {
265-
const relativePath = './test/fixtures/jsx/MyUnCoolComponent.jsx'
266-
const cwd = process.cwd()
267-
const mismatchedPath = path
268-
.join(cwd.toUpperCase(), relativePath)
269-
.replaceAll('\\', '/')
270-
271265
ruleTester.run('case sensitivity', rule, {
272266
valid: [
273267
tValid({
@@ -296,31 +290,39 @@ function runResolverTests(resolver: 'node' | 'webpack') {
296290
],
297291
})
298292

299-
ruleTester.run('case sensitivity strict', rule, {
300-
valid: [
301-
// #1259 issue
302-
tValid({
303-
// caseSensitiveStrict is disabled by default
304-
code: `import foo from "${mismatchedPath}"`,
305-
}),
306-
],
293+
// Windows plain absolute path is not supported by Node.js
294+
// TODO: add `file:` protocol support
295+
if (process.platform !== 'win32') {
296+
const relativePath = './test/fixtures/jsx/MyUnCoolComponent.jsx'
297+
const cwd = process.cwd()
298+
const mismatchedPath = path.join(cwd.toUpperCase(), relativePath)
299+
300+
ruleTester.run('case sensitivity strict', rule, {
301+
valid: [
302+
// #1259 issue
303+
tValid({
304+
// caseSensitiveStrict is disabled by default
305+
code: `import foo from "${mismatchedPath}"`,
306+
}),
307+
],
307308

308-
invalid: [
309-
// #1259 issue
310-
tInvalid({
311-
// test with enabled caseSensitiveStrict option
312-
code: `import foo from "${mismatchedPath}"`,
313-
options: [{ caseSensitiveStrict: true }],
314-
errors: [createError('casingMismatch', mismatchedPath)],
315-
}),
316-
tInvalid({
317-
// test with enabled caseSensitiveStrict option and disabled caseSensitive
318-
code: `import foo from "${mismatchedPath}"`,
319-
options: [{ caseSensitiveStrict: true, caseSensitive: false }],
320-
errors: [createError('casingMismatch', mismatchedPath)],
321-
}),
322-
],
323-
})
309+
invalid: [
310+
// #1259 issue
311+
tInvalid({
312+
// test with enabled caseSensitiveStrict option
313+
code: `import foo from "${mismatchedPath}"`,
314+
options: [{ caseSensitiveStrict: true }],
315+
errors: [createError('casingMismatch', mismatchedPath)],
316+
}),
317+
tInvalid({
318+
// test with enabled caseSensitiveStrict option and disabled caseSensitive
319+
code: `import foo from "${mismatchedPath}"`,
320+
options: [{ caseSensitiveStrict: true, caseSensitive: false }],
321+
errors: [createError('casingMismatch', mismatchedPath)],
322+
}),
323+
],
324+
})
325+
}
324326
}
325327
}
326328

0 commit comments

Comments
 (0)