0.0.1 • Published 4 months ago
jasmine-jsdom-runner v0.0.1
Jasmine JSDom Runner
A zero-configuration test runner for Jasmine with JSDom environment.
Features
- Zero configuration needed - works right out of the box
- Automatically finds and runs
*spec.js
files - Pre-configured JSDom environment for browser testing
- Supports custom Jasmine configuration
Installation
Global Installation
npm install -g jasmine-jsdom-runner
NPX Usage
npx jasmine-jsdom-runner
How It Works
- Creates a JSDom environment with all necessary browser globals
- Automatically searches for
*spec.js
files in your project - Configures and runs Jasmine with these spec files
- Displays results in a formatted console output
Configuration (Optional)
By default, no configuration is required. The tool will:
- Search for
*spec.js
files in your project - Set up a basic JSDom environment
- Run tests with default Jasmine settings
If you want custom configuration, you can add a jasmine.json
file to your project root:
{
"spec_dir": ".",
"spec_files": ["**/*spec.js"],
"helpers": ["helpers/**/*.js"],
"stopSpecOnExpectationFailure": false,
"random": false
}
Example Usage
- Create test files with the naming pattern
*spec.js
- Write your Jasmine tests as usual
- Run
npx jasmine-jsdom-runner
Sample Test
// hello.spec.js
describe("Hello", function () {
it("should say hello", function () {
expect("Hello World").toContain("Hello");
});
it("should work with DOM", function () {
document.body.innerHTML = '<div id="test">Test Element</div>';
expect(document.getElementById("test").textContent).toBe("Test Element");
});
});
License
MIT
0.0.1
4 months ago