pumuki 6.3.159 → 6.3.161

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -564,11 +564,34 @@ import Testing
564
564
  struct LoginModernTests {
565
565
  @Test func login() async {}
566
566
  }
567
+ `;
568
+ const mixedWithReexportedTesting = `
569
+ import XCTest
570
+
571
+ final class LoginTests: XCTestCase {
572
+ func testLegacyLogin() {}
573
+ }
574
+
575
+ struct LoginModernTests {
576
+ @Test func login() async {}
577
+ }
578
+ `;
579
+ const ignoredCommentsAndStrings = `
580
+ import XCTest
581
+
582
+ final class LoginTests: XCTestCase {
583
+ func testLegacyLogin() {
584
+ let text = "@Test func login() async {}"
585
+ // @Suite
586
+ }
587
+ }
567
588
  `;
568
589
 
569
590
  assert.equal(hasSwiftMixedTestingFrameworksUsage(mixedSuite), true);
591
+ assert.equal(hasSwiftMixedTestingFrameworksUsage(mixedWithReexportedTesting), true);
570
592
  assert.equal(hasSwiftMixedTestingFrameworksUsage(legacyOnly), false);
571
593
  assert.equal(hasSwiftMixedTestingFrameworksUsage(modernOnly), false);
594
+ assert.equal(hasSwiftMixedTestingFrameworksUsage(ignoredCommentsAndStrings), false);
572
595
  });
573
596
 
574
597
  test('hasSwiftXCTestAssertionUsage detecta XCTAssert y XCTFail reales', () => {
@@ -684,26 +707,45 @@ await fulfillment(of: [expectation], timeout: 1)
684
707
  assert.equal(hasSwiftWaitForExpectationsUsage(modernWait), false);
685
708
  });
686
709
 
687
- test('hasSwiftLegacyExpectationDescriptionUsage detecta expectation(description:) sin flujo moderno', () => {
688
- const legacyExpectation = `
710
+ test('hasSwiftLegacyExpectationDescriptionUsage detecta expectation(description:) en tests async sin flujo moderno', () => {
711
+ const legacyAsyncExpectation = `
712
+ func testLegacyAsync() async {
689
713
  let expectation = expectation(description: "Done")
690
714
  doWork { expectation.fulfill() }
691
- waitForExpectations(timeout: 1)
715
+ }
692
716
  `;
693
- const modernExpectation = `
717
+ const legacySyncExpectation = `
718
+ func testLegacySync() {
719
+ let expectation = expectation(description: "Done")
720
+ doWork { expectation.fulfill() }
721
+ }
722
+ `;
723
+ const modernAsyncExpectation = `
724
+ func testModernAsync() async {
694
725
  let expectation = expectation(description: "Done")
695
726
  doWork { expectation.fulfill() }
696
727
  await fulfillment(of: [expectation], timeout: 1)
728
+ }
697
729
  `;
698
- const confirmationOnly = `
730
+ const confirmationFlow = `
731
+ func testConfirmation() async {
699
732
  await confirmation("Done") { confirm in
700
733
  await doWork { confirm() }
701
734
  }
735
+ }
736
+ `;
737
+ const commentedExpectation = `
738
+ func testModernAsync() async {
739
+ // let expectation = expectation(description: "Done")
740
+ await confirmation("Done") { confirm in confirm() }
741
+ }
702
742
  `;
703
743
 
704
- assert.equal(hasSwiftLegacyExpectationDescriptionUsage(legacyExpectation), true);
705
- assert.equal(hasSwiftLegacyExpectationDescriptionUsage(modernExpectation), false);
706
- assert.equal(hasSwiftLegacyExpectationDescriptionUsage(confirmationOnly), false);
744
+ assert.equal(hasSwiftLegacyExpectationDescriptionUsage(legacyAsyncExpectation), true);
745
+ assert.equal(hasSwiftLegacyExpectationDescriptionUsage(legacySyncExpectation), false);
746
+ assert.equal(hasSwiftLegacyExpectationDescriptionUsage(modernAsyncExpectation), false);
747
+ assert.equal(hasSwiftLegacyExpectationDescriptionUsage(confirmationFlow), false);
748
+ assert.equal(hasSwiftLegacyExpectationDescriptionUsage(commentedExpectation), false);
707
749
  });
708
750
 
709
751
  test('hasSwiftNSManagedObjectBoundaryUsage detecta boundaries con NSManagedObject y excluye IDs o subclases', () => {
@@ -788,6 +788,10 @@ const hasSwiftTestingSuiteAttributeUsage = (source: string): boolean => {
788
788
  return hasSwiftSanitizedRegexMatch(source, /\B@(?:Test|Suite)\b/);
789
789
  };
790
790
 
791
+ const hasSwiftTestingFrameworkMarkerUsage = (source: string): boolean => {
792
+ return hasSwiftTestingImportUsage(source) || hasSwiftTestingSuiteAttributeUsage(source);
793
+ };
794
+
791
795
  const hasSwiftXCTestCaseSubclassUsage = (source: string): boolean => {
792
796
  return hasSwiftSanitizedRegexMatch(
793
797
  source,
@@ -869,11 +873,7 @@ export const hasSwiftModernizableXCTestSuiteUsage = (source: string): boolean =>
869
873
  };
870
874
 
871
875
  export const hasSwiftMixedTestingFrameworksUsage = (source: string): boolean => {
872
- if (!hasSwiftXCTestImportUsage(source) || !hasSwiftXCTestCaseSubclassUsage(source)) {
873
- return false;
874
- }
875
-
876
- return hasSwiftTestingImportUsage(source) || hasSwiftTestingSuiteAttributeUsage(source);
876
+ return hasSwiftXCTestCaseSubclassUsage(source) && hasSwiftTestingFrameworkMarkerUsage(source);
877
877
  };
878
878
 
879
879
  export const hasSwiftXCTestAssertionUsage = (source: string): boolean => {
@@ -923,20 +923,15 @@ export const hasSwiftWaitForExpectationsUsage = (source: string): boolean => {
923
923
  };
924
924
 
925
925
  export const hasSwiftLegacyExpectationDescriptionUsage = (source: string): boolean => {
926
- const hasLegacyExpectation = collectSwiftRegexLines(
927
- source,
928
- /\bexpectation\s*\(\s*description\s*:/
929
- ).length > 0;
930
-
931
- if (!hasLegacyExpectation) {
932
- return false;
933
- }
934
-
935
- if (hasSwiftAwaitFulfillmentUsage(source) || hasSwiftConfirmationUsage(source)) {
936
- return false;
937
- }
938
-
939
- return true;
926
+ return collectSwiftFunctionDeclarations(source).some((declaration) => {
927
+ if (!/\basync\b/.test(declaration.signature)) {
928
+ return false;
929
+ }
930
+ if (!hasSwiftSanitizedRegexMatch(declaration.body, /\bexpectation\s*\(\s*description\s*:/)) {
931
+ return false;
932
+ }
933
+ return !hasSwiftAwaitFulfillmentUsage(declaration.body) && !hasSwiftConfirmationUsage(declaration.body);
934
+ });
940
935
  };
941
936
 
942
937
  export const hasSwiftNSManagedObjectBoundaryUsage = (source: string): boolean => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pumuki",
3
- "version": "6.3.159",
3
+ "version": "6.3.161",
4
4
  "description": "Enterprise-grade AST Intelligence System with multi-platform support (iOS, Android, Backend, Frontend) and Feature-First + DDD + Clean Architecture enforcement. Includes dynamic violations API for intelligent querying.",
5
5
  "main": "index.js",
6
6
  "bin": {