How to use leche - 7 common examples

To help you get started, we’ve selected a few leche examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eslint / espree / tests / lib / ecma-version.js View on Github external
describe("Scripts", () => {

        leche.withData(scriptOnlyTestFiles, filename => {

            const version = filename.slice(0, filename.indexOf("/"));

            // Uncomment and fill in filename to focus on a single file
            // var filename = "newTarget/simple-new-target";
            const code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.js`);

            it("should parse correctly when sourceType is script", () => {
                config.ecmaVersion = Number(version);
                const expected = require(`${path.resolve(__dirname, "../../", FIXTURES_DIR, filename)}.result.js`);

                tester.assertMatches(code, config, expected);
            });

        });
github eslint / espree / tests / lib / ecma-features.js View on Github external
describe("ecmaFeatures", () => {

    let config;

    beforeEach(() => {
        config = {
            loc: true,
            range: true,
            tokens: true,
            ecmaVersion: 6,
            ecmaFeatures: {}
        };
    });

    leche.withData(testFiles, filename => {

        // Uncomment and fill in filename to focus on a single file
        // var filename = "jsx/invalid-matching-placeholder-in-closing-tag";
        const feature = path.dirname(filename),
            isPermissive = !shouldThrowInTestsWhenEnabled(feature),
            code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.js`);

        it(`should parse correctly when ${feature} is ${isPermissive}`, () => {
            config.ecmaFeatures[feature] = isPermissive;
            const expected = require(`${path.resolve(__dirname, "../../", FIXTURES_DIR, filename)}.result.js`);

            tester.assertMatches(code, config, expected);
        });

        it(`should throw an error when ${feature} is ${!isPermissive}`, () => {
            config.ecmaFeatures[feature] = !isPermissive;
github eslint / espree / tests / lib / libraries.js View on Github external
describe("Libraries", () => {

    leche.withData(testFiles, filename => {

        // var filename = "angular-1.2.5.js";

        it("should produce correct AST when parsed", function() {

            this.timeout(10000); // eslint-disable-line no-invalid-this

            const output = shelljs.cat(path.resolve(__dirname, "../../", `${filename}.result.json`));
            const input = shelljs.cat(filename);

            const result = JSON.stringify(tester.getRaw(espree.parse(input, {
                loc: true,
                range: true,
                tokens: true
            })));
github Encapsule-Annex / onm / test / subtests / named-object-resolver / test-use-case-named-object-resolver-create.js View on Github external
describe("Each pending namespace descriptor should be valid.", function() {
                var testVectors = {};
                resolveResults.pendingResolutionStack.forEach( function(options_) {
                    testVectors[options_.targetNamespaceDescriptor.jsonTag] = [ options_ ];
                });
                withData(testVectors, function(options_) {
                    var optionsValid = false;
                    it("Attempt to validate the pending namespace descriptor should not throw.", function() {
                        var functionUnderTest = function() {
                            optionsValid = namedObjectContext.checkValidContextInput(options_);
                        };
                        assert.doesNotThrow(functionUnderTest);
                    });
                    it("The pending namespace descriptor resolve options object should be valid.", function() {
                        assert.isTrue(optionsValid);
                    });
                });
                it("Execute the test suite.", function() {
                    assert.isTrue(true);
                });
            });
        });
github eslint / espree / tests / lib / attach-comments.js View on Github external
describe("attachComment: true", () => {

    leche.withData(testFiles, filename => {
        it("should produce correct AST when parsed with attachComments", () => {
            const output = require(path.resolve(__dirname, "../../", `${filename}.result.js`));
            const input = shelljs.cat(`${filename}.src.js`);
            let result;

            if (output.sourceType === "script") {
                result = espree.parse(input, {
                    loc: true,
                    range: true,
                    tokens: true,
                    attachComment: true
                });
            } else {
                result = espree.parse(input, {
                    loc: true,
                    range: true,
github Encapsule-Annex / onm / test / test-onm.Model-intrinsic-semantic-bindings.js View on Github external
module.exports = describe("onm.Model intrinsic semantic bindings white box tests", function() {
    withData(testInputDataVector, function (testDescriptor_) {
        var model = null;
        var address = null;
        var store = null;
        var namespace = null;

        before(function(done_) {
            if (testDescriptor_.validConfig) {
                assert.doesNotThrow(function() {
                    model = new onm.Model(testDescriptor_.dataModelDeclaration);
                    assert.isNotNull(model);
                    assert.instanceOf(model, onm.Model);
                });
                assert.doesNotThrow(function() {
                    store = new onm.Store(model);
                    assert.isNotNull(store);
                    assert.instanceOf(store, onm.Store);
github axa-group / Parsr / test / json-export-import.spec.ts View on Github external
describe('JSON export and import', () => {
	withData(
		{
			'one line': 'line-merge.pdf',
			'big text': 'text-order-detection.pdf',
		},
		pdfName => {
			let pdfBefore: Document;
			let pdfAfter: Document;

			function clean(pdf: Document): Promise {
				Element.resetGlobalId();
				return runModules(pdf, [
					new ReadingOrderDetectionModule(),
					new WordsToLineModule(),
					new LinesToParagraphModule(),
					new HierarchyDetectionModule(),
				]);

leche

A JavaScript testing utility designed to work with Mocha and Sinon

Apache-2.0
Latest version published 5 years ago

Package Health Score

49 / 100
Full package analysis

Popular leche functions