How to use the minimist.__setReturnValue function in minimist

To help you get started, we’ve selected a few minimist 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 vutran / wonders / __tests__ / nodes / command.js View on Github external
it('should render based on the `onAction` prop.', () => {
        const minimist = require('minimist');
        minimist.__setReturnValue({
            _: [
                'foo',
            ],
        });
        const foo = jest.fn(() => 'hi foo');
        const bar = jest.fn(() => 'hi bar');
        const node = (
            
                
                
            
        );
        const output = renderTree(node);
        expect(foo).toHaveBeenCalled();
        expect(bar).not.toHaveBeenCalled();
        expect(output).toBe('hi foo');
github vutran / wonders / __tests__ / render.js View on Github external
it('should run the num command.', async () => {
        minimist.__setReturnValue({
            _: [
                'num',
            ],
        });

        const s = new Writable();
        s.write = jest.fn();

        await Wonders.render(, s);
        expect(s.write).toHaveBeenCalledWith('1');
    });