Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: merge Polymer and Lit test files into a single file (CP: 24.6) #8604

Merged
merged 3 commits into from
Jan 31, 2025

Conversation

vursen
Copy link
Contributor

@vursen vursen commented Jan 31, 2025

The PR merges [name]-polymer.test.js and [name]-lit.test.js into a single [name].test.js file with Polymer imports to allow a Lit version to be generated automatically.

The following AI-generated script was used to automate this process:

#!/bin/bash

base_dir=.

# Rename [name].common.js to [name].test.js
find "$base_dir/packages" -type f -name "*.common.js" | while read -r common_file; do
  test_file="${common_file%.common.js}.test.js"
  mv "$common_file" "$test_file"
done

# Merge [name]-polymer.test.js into [name].test.js and delete [name]-lit.test.js
find "$base_dir/packages" -type f -name "*-polymer.test.js" | while read -r polymer_file; do
  base_name="${polymer_file%-polymer.test.js}"
  test_file="$base_name.test.js"
  lit_file="$base_name-lit.test.js"

  # Merge polymer test into the test file
  cat "$test_file" >> "$polymer_file"
  mv "$polymer_file" "$test_file"

  # Delete the polymer and lit test files
  rm "$lit_file"
done

# Remove old JS imports of *.common.js from the final [name].test.js
find "$base_dir/packages" -type f -name "*.test.js" | while read -r test_file; do
  sed -i '' '/import .*\.common\.js/d' "$test_file"
done

echo "Renaming, merging, and linting completed."

Depends on

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
5 Security Hotspots

See analysis details on SonarQube Cloud

@vursen vursen merged commit f4c390a into 24.6 Jan 31, 2025
8 of 9 checks passed
@vursen vursen deleted the 24.6-merge-polymer-and-lit-tests branch January 31, 2025 11:17
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