Velocious Full-Stack Framework
Velocious is a comprehensive full-stack JavaScript/TypeScript framework providing a concurrent multi-threaded web server, a database framework with MVC concepts, and shared database models for both frontend and backend development. It includes features like database migrations, declarative state machines for models, and Rails-style nested-attribute writes. The current stable version is 1.0.336, suggesting a fairly active development cycle with frequent updates. Key differentiators include its unified model approach across frontend and backend, advanced testing capabilities like parallel test splitting and browser system tests, and integrated tooling for configuration and project initialization. It aims to provide a robust environment for building modern web applications with a focus on developer experience and performance.
Common errors
-
Error: Cannot find module 'velocious' or Cannot find module 'velocious/build/src/testing/test.js'
cause Incorrect import path or the package was not installed correctly.fixEnsure `npm install velocious` has completed successfully. Verify the import paths are exact, especially for internal modules like `velocious/build/src/testing/test.js`. -
No tests found for the given criteria
cause Incorrect test file naming convention, tag filtering, or test path specification.fixBrowser tests must be `*.browser-test.js` or `*.browser-spec.js`. Check `npx velocious test --tag` and `npx velocious test --exclude-tag` arguments, and ensure the file path is correct. Use `--groups` and `--group-number` carefully for parallel runs. -
ReferenceError: configuration is not defined
cause The application's configuration object was not properly imported or initialized using `configuration.setCurrent()` early enough in the application startup.fixMake sure `src/config/configuration.js` exists and exports a default configuration, or explicitly import your configuration file and call `configuration.setCurrent(yourConfigObject)` at the very beginning of your application.
Warnings
- gotcha Velocious uses specific internal paths for importing testing utilities like `configureTests` and `testEvents`. Importing these directly from the root 'velocious' package will fail or result in undefined behavior.
- gotcha Application configuration is expected in `src/config/configuration.js` by default. If placed elsewhere, it must be explicitly imported and set via `configuration.setCurrent()` early in the application bootstrap process.
- gotcha When running tests, Velocious captures console output during failures. These logs are saved to `tmp/screenshots` alongside other failure artifacts. Developers might overlook checking this directory for detailed debugging information.
Install
-
npm install velocious -
yarn add velocious -
pnpm add velocious
Imports
- configureTesting
import { configureTests } from 'velocious'import { configureTests } from 'velocious/build/src/testing/test.js' - testEvents
import { testEvents } from 'velocious'import { testEvents } from 'velocious/build/src/testing/test.js' - configuration
import { configuration } from 'velocious'import configuration from 'src/config/configuration.js'
Quickstart
import { configureTests } from 'velocious/build/src/testing/test.js';
import { testEvents } from 'velocious/build/src/testing/test.js';
// Initialize a new Velocious project
// This creates basic project structure and config files.
// npx velocious init
// Example test configuration
export default async function configureTesting() {
configureTests({ excludeTags: ["mssql"] });
}
// Example of test suite setup with tagging and retries
describe("User Management", {tags: ["api", "db"]}, () => {
beforeAll(async () => {
// Setup database or other services before all tests in this suite
console.log("Setting up user management suite...");
});
it("creates a new user successfully", {tags: ["fast", "write"]}, async () => {
// Simulate user creation logic
await new Promise(resolve => setTimeout(resolve, 50));
expect(true).toBe(true);
});
it("handles duplicate username registration", {retry: 1}, async () => {
// Simulate error handling for duplicates
await new Promise(resolve => setTimeout(resolve, 30));
expect(false).toBe(false);
});
afterAll(async () => {
// Teardown services after all tests
console.log("Tearing down user management suite.");
});
});
// Listen for test retry events
testEvents.on("testRetrying", ({ testDescription, nextAttempt }) => {
console.log(`Retrying "${testDescription}" (attempt ${nextAttempt})`);
});
testEvents.on("testRetried", ({ testDescription, attemptNumber }) => {
console.log(`Retry attempt finished for "${testDescription}" (attempt ${attemptNumber})`);
});
// To run these tests: npx velocious test spec/path/to/your-test-spec.js