fix: Windows compat for contains/containsSync and toLiquidAsync arg order

Made-with: Cursor
This commit is contained in:
Yang Jun
2026-04-06 14:30:41 +08:00
parent b181b08543
commit 3538864119
8 changed files with 25 additions and 20 deletions
+2 -1
View File
@@ -60,7 +60,8 @@ describe('.parseAndRender()', function () {
const html = await engine.parseAndRender(src)
expect(html).toBe('true')
})
describe('symlink outside root', function () {
const canSymlink = process.platform !== 'win32'
;(canSymlink ? describe : describe.skip)('symlink outside root', function () {
let root: string, secret: string
beforeAll(function () {
root = mkdtempSync(join(tmpdir(), 'liquid-e2e-root-'))
+3 -3
View File
@@ -1,6 +1,6 @@
import { isString, forOwn } from '../../src/util/underscore'
import * as fs from '../../src/fs/fs-impl'
import { resolve } from 'path'
import { resolve, sep } from 'path'
interface FileDescriptor {
mode: string;
@@ -33,12 +33,12 @@ export function mock (options: { [path: string]: (string | FileDescriptor) }) {
};
(fs as any).contains = async (root: string, file: string) => {
root = resolve(root)
if (!root.endsWith('/')) root += '/'
if (!root.endsWith(sep)) root += sep
return file.startsWith(root)
};
(fs as any).containsSync = (root: string, file: string) => {
root = resolve(root)
if (!root.endsWith('/')) root += '/'
if (!root.endsWith(sep)) root += sep
return file.startsWith(root)
}
}