mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-27 18:46:18 -04:00
Add n/prefer-node-protocol rule and autofix all bare builtin imports to use the node: prefix. Simplify the simple-import-sort builtins pattern to just ^node: since all imports now use the prefix.
22 lines
666 B
TypeScript
22 lines
666 B
TypeScript
import fs from 'node:fs'
|
|
import path from 'node:path'
|
|
|
|
import { temporaryDirectory } from 'tempy'
|
|
|
|
import { createCafs } from '../src/index.js'
|
|
|
|
test('addFilesFromDir does not loop infinitely on recursive symlinks', () => {
|
|
const storeDir = temporaryDirectory()
|
|
const srcDir = temporaryDirectory()
|
|
|
|
fs.writeFileSync(path.join(srcDir, 'file.txt'), 'content')
|
|
// Create a symlink pointing to the current directory
|
|
fs.symlinkSync('.', path.join(srcDir, 'self'))
|
|
|
|
const cafs = createCafs(storeDir)
|
|
const { filesIndex } = cafs.addFilesFromDir(srcDir)
|
|
|
|
expect(filesIndex.has('file.txt')).toBe(true)
|
|
expect(filesIndex.has('self/file.txt')).toBe(false)
|
|
})
|