Skip to content

Commit 3a932b8

Browse files
committedFeb 21, 2024·
chore: lint
1 parent bfa2bbe commit 3a932b8

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed
 

‎test/utils.test.ts

+21-17
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, it, expect } from "vitest";
2-
import { isWindows } from 'std-env'
2+
import { isWindows } from "std-env";
33
import {
44
isNodeBuiltin,
55
sanitizeFilePath,
@@ -159,15 +159,17 @@ describe("lookupNodeModuleSubpath", () => {
159159
});
160160

161161
describe("fileURLToPath", () => {
162-
const tests = isWindows ? [
163-
["file:///C:/path/", "C:/path/"],
164-
["file://nas/foo.txt", "//nas/foo.txt"],
165-
["file://C:/你好.txt", "C:/你好.txt"],
166-
["file://C:/hello world", "C:/hello world"],
167-
] as const : [
168-
["file:///你好.txt", "/你好.txt"],
169-
["file:///hello world", "/hello world"],
170-
] as const;
162+
const tests = isWindows
163+
? ([
164+
["file:///C:/path/", "C:/path/"],
165+
["file://nas/foo.txt", "//nas/foo.txt"],
166+
["file://C:/你好.txt", "C:/你好.txt"],
167+
["file://C:/hello world", "C:/hello world"],
168+
] as const)
169+
: ([
170+
["file:///你好.txt", "/你好.txt"],
171+
["file:///hello world", "/hello world"],
172+
] as const);
171173
for (const [input, output] of tests) {
172174
it(`${input} should resolve to ${output}`, () => {
173175
expect(fileURLToPath(input)).toBe(output);
@@ -176,13 +178,15 @@ describe("fileURLToPath", () => {
176178
});
177179

178180
describe("pathToFileURL", () => {
179-
const tests = isWindows ? [
180-
["/foo#1", /file:\/\/\/\w:\/foo%231/ ],
181-
["/some/path%.c", /file:\/\/\/\w:\/some\/path%25.c/],
182-
] as const :[
183-
["/foo#1", "file:///foo%231"],
184-
["/some/path%.c", "file:///some/path%25.c"],
185-
] as const;
181+
const tests = isWindows
182+
? ([
183+
["/foo#1", /file:\/\/\/\w:\/foo%231/],
184+
["/some/path%.c", /file:\/{3}\w:\/some\/path%25.c/],
185+
] as const)
186+
: ([
187+
["/foo#1", "file:///foo%231"],
188+
["/some/path%.c", "file:///some/path%25.c"],
189+
] as const);
186190
for (const [input, output] of tests) {
187191
it(`${input} should resolve to ${output}`, () => {
188192
expect(pathToFileURL(input)).toMatch(output);

0 commit comments

Comments
 (0)
Please sign in to comment.