@buxlabs/jasmine-converter
v0.3.3
Published
A convestion utility for jasmine
Downloads
10
Readme
jasmine-converter
Installation
npm install -g @buxlabs/jasmine-converter
What does it do?
The library was created to convert jasmine specs from the following format:
describe("Test", function () {
var a;
beforeEach(function () {
a = 5;
});
it("works", function () {
expect(a).toBe(5);
});
});
to:
describe("Test", function () {
beforeEach(function () {
this.a = 5;
});
it("works", function () {
expect(this.a).toBe(5);
});
});
The difference between formats is that the first one causes memory leaks due to the internal design of the library, the second one is the suggested solution to the problem.
Usage
cli
Convert a single file with:
jasmineconverter app.spec.js > app.spec.js
Convert multiple files in given dir recursively and replace them with:
jasmineconverter --src=src --glob=**/*.spec.js --replace
Options
Usage: jasmineconverter [options]
Options:
-s, --src <dirname> Directory of the source files
-g, --glob [glob] Glob pattern for the src to match for input files
-r, --recursive Set glob pattern to **/*.js with no hassle
--replace Replace the input files with results