Skip to content

Base64 fix and test cases refactor to use real browser - #116

Merged
imagekitio merged 9 commits into
masterfrom
base64-fix
Jun 1, 2026
Merged

Base64 fix and test cases refactor to use real browser#116
imagekitio merged 9 commits into
masterfrom
base64-fix

Conversation

@imagekitio

Copy link
Copy Markdown
Collaborator

No description provided.

manu4543 added 2 commits June 1, 2026 08:53
Rewrite safeBtoa to prefer Buffer when available and fall back to a
chunked btoa with a manual UTF-8 encoder, throwing a clear error when
neither is available. Removes reliance on a Node-only code path.

- test: migrate suite from mocha/sinon/nyc to Playwright (test-app)
- ci: replace nodejs.yml with ci.yml; rename npmpublish.yml to publish-npm.yml
- chore: drop mocha/chai/sinon/nyc/codecov and related devDependencies
- docs: remove Codecov badge from README
- chore: add LICENSE and set license to Apache-2.0
@imagekitio imagekitio changed the title Base64 fix Jun 1, 2026

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 PR fixes Unicode-safe Base64 encoding used in transformation overlays and refactors the test suite to run against the real built SDK in Chromium via Playwright (instead of Node + sinon/mocha). It also introduces release-please automation and updates CI/publishing workflows, alongside removing legacy tests and the old sample app.

Changes:

  • Fix safeBtoa to correctly Base64-encode UTF-8 strings in browser environments (e.g., Hindi text overlays).
  • Migrate URL-generation, responsive attributes, and upload tests from Node/mocha to Playwright using a browser-hosted test app.
  • Add release automation (release-please) and update GitHub Actions workflows; remove legacy CI/test tooling and sample app.

Reviewed changes

Copilot reviewed 36 out of 40 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/url-generation/overlay.js Removed legacy mocha/chai overlay URL-generation tests (migrated to Playwright).
test/url-generation/buildtransformationString.js Removed legacy mocha/chai transformation-string unit tests (migrated to Playwright).
test/upload.js Removed legacy sinon fake-XHR upload tests (migrated to Playwright network interception).
test/setup.js Removed Node polyfill-based test setup no longer used after Playwright migration.
test/responsive.js Removed legacy responsive attributes tests (migrated to Playwright).
test-app/tests/upload.spec.ts New Playwright upload suite using real Chromium + route interception and multipart parsing.
test-app/tests/responsive.spec.ts New Playwright suite for getResponsiveImageAttributes running against the built bundle.
test-app/tests/overlay.spec.ts New Playwright suite covering overlay URL generation and encoding (incl. Unicode/base64 cases).
test-app/tests/fixtures.ts Shared Playwright fixture that loads /test-app/index.html and waits for SDK globals.
test-app/tests/buildTransformationString.spec.ts New Playwright tests for buildTransformationString.
test-app/tests/basic.spec.ts Converted basic URL-generation tests from mocha/chai to Playwright.
test-app/server.mjs Added a minimal static server for Playwright’s webServer to serve repo root/test app.
test-app/playwright.config.ts Added Playwright configuration (Chromium project + webServer).
test-app/package.json Added isolated test-app package to run Playwright tests and host the server.
test-app/package-lock.json Lockfile for test-app Playwright dependencies.
test-app/index.html Browser harness that imports the built ESM bundle and exposes SDK functions on window.
test-app/.gitignore Ignores test-app node_modules and Playwright artifacts.
src/utils/transformation.ts Updated safeBtoa to be UTF-8 safe in browsers and prefer Buffer when available.
src/url.ts Treat ff like di for slash-to-@@ conversion (font family paths in overlays).
samples/sample-app/views/index.pug Removed legacy sample app view.
samples/sample-app/server/server.js Removed legacy sample app server.
samples/sample-app/sample.env Removed sample env template.
samples/sample-app/package.json Removed sample app package manifest.
samples/sample-app/index.js Removed sample app entry point.
release-please-config.json Added release-please configuration.
README.md Removed Codecov badge (but other badges now need updating to match new CI/license).
package.json Removed mocha/nyc/chai tooling, switched tests to Playwright, updated license metadata.
LICENSE Added Apache-2.0 license text (license change).
babel-register.js Removed Babel register helper no longer needed after mocha removal.
.release-please-manifest.json Added release-please manifest pinning current version.
.nycrc.json Removed nyc config (nyc no longer used).
.mocharc.json Removed mocha config (mocha no longer used).
.gitignore Simplified node_modules ignore patterns.
.github/workflows/sync-release-as.yml Added workflow to sync Release-As based on release PR title edits.
.github/workflows/release-please.yml Added workflow to run release-please on pushes to master.
.github/workflows/publish-npm.yml Updated npm publish workflow (OIDC provenance publish, modern actions versions).
.github/workflows/nodejs.yml Removed old Node CI workflow.
.github/workflows/ci.yml Added new CI workflow building SDK and running Playwright tests.
Files not reviewed (1)
  • test-app/package-lock.json: Language not supported

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

Comment thread .github/workflows/sync-release-as.yml
Comment thread README.md
Comment thread test-app/server.mjs
@imagekitio
imagekitio merged commit ce4fc3c into master Jun 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants