const assert = require('node:assert/strict'); const { execFileSync } = require('node:child_process'); const path = require('node:path'); const test = require('node:test'); const cwd = path.resolve(__dirname, '../..'); const config = (...profiles) => JSON.parse(execFileSync('docker', [ 'compose', '-f', 'docker-compose.local.yml', ...profiles, 'config', '--format', 'json', ], { cwd, encoding: 'utf8' })); const normal = config(); const development = config('--profile', 'dev'); test('normal startup leaves the frontend watcher disabled', () => { assert.ok(normal.services.app); assert.ok(normal.services.mysql); assert.equal(normal.services.frontend, undefined); }); test('frontend uses native watching on Linux files and shared build output', () => { const frontend = development.services.frontend; assert.deepEqual(frontend.command, ['npm', 'run', 'watch']); assert.equal(frontend.restart, 'no'); assert.ok(frontend.volumes.every(volume => volume.type !== 'bind')); const publicVolume = service => service.volumes.find(volume => volume.target === '/var/www/html/public').source; assert.equal(publicVolume(frontend), publicVolume(development.services.app)); assert.deepEqual(frontend.develop.watch.map(rule => rule.path.split(/[\\/]/).slice(-2).join('/')).sort(), [ 'resources/assets', 'resources/lang', 'resources/views', ]); assert.ok(frontend.develop.watch.every(rule => rule.action === 'sync' && rule.initial_sync === true)); });