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.

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
@imagekitioimagekitio changed the title Base64 fixBase64 fix and test cases refactor to use real browserJun 1, 2026

CopilotAI 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
FileDescription
test/url-generation/overlay.jsRemoved legacy mocha/chai overlay URL-generation tests (migrated to Playwright).
test/url-generation/buildtransformationString.jsRemoved legacy mocha/chai transformation-string unit tests (migrated to Playwright).
test/upload.jsRemoved legacy sinon fake-XHR upload tests (migrated to Playwright network interception).
test/setup.jsRemoved Node polyfill-based test setup no longer used after Playwright migration.
test/responsive.jsRemoved legacy responsive attributes tests (migrated to Playwright).
test-app/tests/upload.spec.tsNew Playwright upload suite using real Chromium + route interception and multipart parsing.
test-app/tests/responsive.spec.tsNew Playwright suite for getResponsiveImageAttributes running against the built bundle.
test-app/tests/overlay.spec.tsNew Playwright suite covering overlay URL generation and encoding (incl. Unicode/base64 cases).
test-app/tests/fixtures.tsShared Playwright fixture that loads /test-app/index.html and waits for SDK globals.
test-app/tests/buildTransformationString.spec.tsNew Playwright tests for buildTransformationString.
test-app/tests/basic.spec.tsConverted basic URL-generation tests from mocha/chai to Playwright.
test-app/server.mjsAdded a minimal static server for Playwright’s webServer to serve repo root/test app.
test-app/playwright.config.tsAdded Playwright configuration (Chromium project + webServer).
test-app/package.jsonAdded isolated test-app package to run Playwright tests and host the server.
test-app/package-lock.jsonLockfile for test-app Playwright dependencies.
test-app/index.htmlBrowser harness that imports the built ESM bundle and exposes SDK functions on window.
test-app/.gitignoreIgnores test-app node_modules and Playwright artifacts.
src/utils/transformation.tsUpdated safeBtoa to be UTF-8 safe in browsers and prefer Buffer when available.
src/url.tsTreat ff like di for slash-to-@@ conversion (font family paths in overlays).
samples/sample-app/views/index.pugRemoved legacy sample app view.
samples/sample-app/server/server.jsRemoved legacy sample app server.
samples/sample-app/sample.envRemoved sample env template.
samples/sample-app/package.jsonRemoved sample app package manifest.
samples/sample-app/index.jsRemoved sample app entry point.
release-please-config.jsonAdded release-please configuration.
README.mdRemoved Codecov badge (but other badges now need updating to match new CI/license).
package.jsonRemoved mocha/nyc/chai tooling, switched tests to Playwright, updated license metadata.
LICENSEAdded Apache-2.0 license text (license change).
babel-register.jsRemoved Babel register helper no longer needed after mocha removal.
.release-please-manifest.jsonAdded release-please manifest pinning current version.
.nycrc.jsonRemoved nyc config (nyc no longer used).
.mocharc.jsonRemoved mocha config (mocha no longer used).
.gitignoreSimplified node_modules ignore patterns.
.github/workflows/sync-release-as.ymlAdded workflow to sync Release-As based on release PR title edits.
.github/workflows/release-please.ymlAdded workflow to run release-please on pushes to master.
.github/workflows/publish-npm.ymlUpdated npm publish workflow (OIDC provenance publish, modern actions versions).
.github/workflows/nodejs.ymlRemoved old Node CI workflow.
.github/workflows/ci.ymlAdded 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 threadREADME.md
Comment threadtest-app/server.mjs
@imagekitio
imagekitio merged commit ce4fc3c into masterJun 1, 2026
1 check passed
Sign up for freeto 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.

3 participants

@imagekitio@manu4543