Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Ignore test files when determining if Swift podpsec entries are required
  • Loading branch information
stuartmorgan-g committed May 22, 2024
commit dc799d7af7026596fd5ad1a8a57e7eddd0a82203
6 changes: 6 additions & 0 deletions script/tool/lib/src/podspec_check_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,12 @@ class PodspecCheckCommand extends PackageLoopingCommand {
if (relativePath.startsWith('example/')) {
return false;
}
// Ignore test code.
if (relativePath.contains('/Tests/') ||
relativePath.contains('/RunnerTests/') ||
relativePath.contains('/RunnerUITests/')) {
return false;
}
final String filePath = entity.path;
return filePath != iosSwiftPackageManifestPath &&
filePath != darwinSwiftPackageManifestPath &&
Expand Down
25 changes: 25 additions & 0 deletions script/tool/test/podspec_check_command_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,31 @@ void main() {
));
});

test('does not require the search paths workaround for Swift tests',
() async {
final RepositoryPackage plugin = createFakePlugin(
'plugin1',
packagesDir,
extraFiles: <String>[
'darwin/Tests/SharedTest.swift',
'example/ios/RunnerTests/UnitTest.swift',
'example/ios/RunnerUITests/UITest.swift',
],
);
_writeFakePodspec(plugin, 'ios');

final List<String> output =
await runCapturingPrint(runner, <String>['podspec-check']);

expect(
output,
containsAllInOrder(
<Matcher>[
contains('Ran for 1 package(s)'),
],
));
});

test(
'does not require the search paths workaround for darwin Package.swift',
() async {
Expand Down