Coralite v0.41.0 Released

Coralite v0.41.0 has been released. This update introduces a first-class, zero-config testing mode optimized for end-to-end and integration testing. In addition, this release refines component attribute handling with support for shorthand attribute type schemas, native HTML boolean attribute toggling, and comprehensive testing infrastructure updates.

First-Class Testing Mode #

To simplify integration and end-to-end testing, Coralite v0.41.0 introduces a dedicated testing environment mode. When running under mode: 'testing', Coralite acts as a static build target and injects a suite of diagnostic, mocking, and telemetry features without production overhead:

javascript
Code copied!
  // coralite.config.js
  import { defineConfig } from 'coralite';
  
  export default defineConfig({
    mode: 'testing',
    testing: {
      mocks: {
        // Mock server-side component data fetching
        'user-profile': {
          server: () => ({ name: 'Test User', role: 'Tester' })
        }
      }
    }
  });

Shorthand Attribute Type Definitions #

Defining component attributes is now cleaner. CoraliteElement has been updated to support shorthand constructors in attribute schemas. You can now specify constructors like Number, Boolean, or String directly instead of wrapping them in a { type: Type } schema configuration object.

javascript
Code copied!
  import { CoraliteElement } from 'coralite';
  
  class UserProfile extends CoraliteElement {
    static attributes = {
      // New shorthand schema definition
      active: Boolean,
      userId: Number,
      role: String,
      
      // Longhand configuration is still supported
      theme: { type: String, default: 'light' }
    };
  }

Native Boolean Attribute Toggling #

Template interpolation now handles native HTML boolean attributes (such as disabled, checked, and readonly) intelligently. When binding state to these attributes, Coralite automatically adds or removes the attribute from the DOM element based on truthiness, matching native HTML behavior. Custom attributes continue to render their bound values as standard string representations.

Optimized E2E Testing Strategy #

Under the hood, the test suites have been restructured into tests/e2e/core (for framework validation in dev/prod) and tests/e2e/testing-mode (for application features). Playwright configuration now includes separate projects for core development, production, and testing mode, providing cleaner execution and better test isolation.

How to Upgrade #

To upgrade to the latest version, update your project dependencies:

bash
Code copied!
  npm install coralite@0.41.0
bash
Code copied!
  npm install coralite-scripts@0.41.0

Related posts

More blog posts

Start Building with Coralite!

Use the scaffolding script to get jump started into your next project with Coralite

Copied commandline!