Product
Socket Now Supports uv.lock Files
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
@travetto/test
Advanced tools
Declarative test framework that provides hooks for high levels of integration with the travetto framework and test plugin
This module provides unit testing functionality that integrates with the framework. It is a declarative framework, using decorators to define tests and suites. The test produces results in the TAP 13
format.
The test-plugin
directly integrates with the module to provide real-time feedback on unit tests.
A test suite is a collection of individual tests. All test suites are classes with the @Suite
decorator. Tests are defined as methods on the suite class, using the @Test
decorator. All tests intrinsically support async/await.
Additionally, the the suite classes support Dependency Injection
.
A simple example would be:
import * as assert from 'assert';
@Suite()
class SimpleTest {
private complexService: ComplexService;
@Test()
async test1() {
let val = await this.complexService.doLongOp();
assert(val === 5);
}
@Test()
test2() {
assert(/abc/.test(text));
}
}
A common aspect of the tests themselves are the assertions that are made. Node
provides a built-in assert
library. The framework uses AST transformations to modify the assertions to provide integration with the test module, and to provide a much higher level of detail in the failed assertions.
For example:
assert({size: 20, address: { state: 'VA' }} === {});
would generate the error:
AssertionError(
message="{size: 20, address: {state: 'VA' }} should deeply strictly equal {}"
)
travetto-test
is packaged as a included script to execute tests from the command line. The script can be invoked as
./node_modules/.bin/travetto-test test/.*
All tests should be under the test/.*
folders. The pattern for tests is defined as a regex and not standard globbing.
FAQs
Declarative test framework
The npm package @travetto/test receives a total of 482 weekly downloads. As such, @travetto/test popularity was classified as not popular.
We found that @travetto/test demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.