|
1 | 1 | import { loadNodeRuntime } from '..';
|
2 |
| -import { |
3 |
| - __private__dont__use, |
4 |
| - FSHelpers, |
5 |
| - PHP, |
6 |
| - setPhpIniEntries, |
7 |
| -} from '@php-wasm/universal'; |
| 2 | +import { PHP, setPhpIniEntries } from '@php-wasm/universal'; |
8 | 3 | import fs from 'fs';
|
9 | 4 | import path from 'path';
|
10 | 5 | import { createNodeFsMountHandler } from '../lib/node-fs-mount';
|
@@ -65,6 +60,7 @@ testSymlinks.forEach(({ name, sourcePath, symlinkPath }) => {
|
65 | 60 | );
|
66 | 61 | }
|
67 | 62 |
|
| 63 | + await php.mkdir('/folder-with-symlinks'); |
68 | 64 | await php.mount(
|
69 | 65 | '/folder-with-symlinks',
|
70 | 66 | createNodeFsMountHandler(
|
@@ -354,65 +350,5 @@ testSymlinks.forEach(({ name, sourcePath, symlinkPath }) => {
|
354 | 350 | }
|
355 | 351 | });
|
356 | 352 | });
|
357 |
| - |
358 |
| - describe('Test symlink file system operations', () => { |
359 |
| - const symlinkPath = path.join( |
360 |
| - __dirname, |
361 |
| - 'test-data', |
362 |
| - 'symlink.txt' |
363 |
| - ); |
364 |
| - const symlinkTarget = path.join( |
365 |
| - __dirname, |
366 |
| - 'test-data', |
367 |
| - 'long-post-body.txt' |
368 |
| - ); |
369 |
| - const vfsMountPoint = '/symlink.txt'; |
370 |
| - beforeEach(async () => { |
371 |
| - fs.symlinkSync(symlinkTarget, symlinkPath, 'file'); |
372 |
| - |
373 |
| - await php.mount( |
374 |
| - vfsMountPoint, |
375 |
| - createNodeFsMountHandler(symlinkPath) |
376 |
| - ); |
377 |
| - }); |
378 |
| - afterEach(async () => { |
379 |
| - fs.unlinkSync(symlinkPath); |
380 |
| - }); |
381 |
| - |
382 |
| - it('Should mount a symlink', async () => { |
383 |
| - expect(php.isFile(vfsMountPoint)).toBe(true); |
384 |
| - expect(php.readFileAsText(vfsMountPoint)).toEqual( |
385 |
| - fs.readFileSync(symlinkTarget, 'utf8') |
386 |
| - ); |
387 |
| - }); |
388 |
| - it('Should be recognized as a symlink', async () => { |
389 |
| - expect(php.fileExists(vfsMountPoint)).toBe(true); |
390 |
| - expect(php.isSymlink(vfsMountPoint)).toBe(true); |
391 |
| - }); |
392 |
| - it('Should copy a symlink', async () => { |
393 |
| - const newVfsMountPoint = '/symlink-copy.txt'; |
394 |
| - FSHelpers.copyRecursive( |
395 |
| - php[__private__dont__use].FS, |
396 |
| - vfsMountPoint, |
397 |
| - newVfsMountPoint |
398 |
| - ); |
399 |
| - expect(php.fileExists(vfsMountPoint)).toBe(true); |
400 |
| - expect(php.isSymlink(vfsMountPoint)).toBe(true); |
401 |
| - expect(php.fileExists(newVfsMountPoint)).toBe(true); |
402 |
| - expect(php.isSymlink(newVfsMountPoint)).toBe(true); |
403 |
| - expect(php.readlink(newVfsMountPoint)).toBe( |
404 |
| - php.readlink(vfsMountPoint) |
405 |
| - ); |
406 |
| - }); |
407 |
| - |
408 |
| - it.skip('Should move a symlink', async () => { |
409 |
| - // Symlinks can't be moved because of a Resource busy error. |
410 |
| - // TODO: Compare POSIX and Emscripten behavior. |
411 |
| - const newVfsMountPoint = '/symlink-moved.txt'; |
412 |
| - php.mv(vfsMountPoint, newVfsMountPoint); |
413 |
| - expect(php.fileExists(vfsMountPoint)).toBe(false); |
414 |
| - expect(php.fileExists(newVfsMountPoint)).toBe(true); |
415 |
| - }); |
416 |
| - }); |
417 | 353 | });
|
418 | 354 | });
|
0 commit comments