Skip to content

fix: Add unit test for flattenFrameworkFiles to remove stale files#14

Merged
roble merged 1 commit into
mainfrom
dev
Jun 4, 2026
Merged

fix: Add unit test for flattenFrameworkFiles to remove stale files#14
roble merged 1 commit into
mainfrom
dev

Conversation

@roble

@roble roble commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

This pull request improves the handling of framework-specific files during the flattening process and adds a new test to ensure stale files from other frameworks are properly removed. The main changes focus on making sure that when copying files for a selected framework, any obsolete files from other frameworks are cleaned up from the root directory.

Framework file flattening and cleanup:

  • Updated flattenFrameworkFiles in Installer.php to track and remove stale files from the root directory that belong to other frameworks, ensuring only the current framework's files remain after flattening.

Testing improvements:

  • Added a new test test_flatten_framework_files_removes_stale_root_file_from_other_framework in ModuleInstallerTest.php to verify that stale root files from other frameworks are deleted and only the selected framework's files persist.

Copilot AI review requested due to automatic review settings June 4, 2026 20:33
@roble roble merged commit 3f009d8 into main Jun 4, 2026
3 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request tightens the framework file “flattening” behavior so that when one framework’s files are copied into resources/js/, leftover root-level files originating from other frameworks are removed, preventing stale cross-framework artifacts.

Changes:

  • Updated flattenFrameworkFiles() to detect root-level files that correspond to non-selected frameworks and remove them after flattening.
  • Added a unit test to confirm that a stale root file from another framework is deleted when flattening for the selected framework.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Installer.php Tracks non-selected framework file paths and removes any corresponding stale root-level files after flattening.
tests/ModuleInstallerTest.php Adds coverage to ensure stale root files from other frameworks are removed when flattening for the selected framework.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1049 to +1058
$installer = new TestableInstaller($this->createStub(IOInterface::class), null);
$installer->callFlattenFrameworkFiles($jsRoot, 'react');

$this->assertFileExists($jsRoot.'/app.tsx');
$this->assertFileDoesNotExist($jsRoot.'/app.ts');
$this->assertDirectoryDoesNotExist($jsRoot.'/vue');
$this->assertDirectoryDoesNotExist($jsRoot.'/react');

(new Filesystem)->remove($jsRoot);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants