How to use the cmd-shim.mockImplementation function in cmd-shim

To help you get started, we’ve selected a few cmd-shim 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 lerna / lerna / test / FileSystemUtilities.js View on Github external
it("creates command shim to an executable file", done => {
        const src = path.resolve("./packages/package-2/cli.js");
        const dst = path.resolve("./packages/package-1/node_modules/.bin/package-2");
        const type = "exec";

        cmdShim.mockImplementation(callsBack());

        FileSystemUtilities.symlink(src, dst, type, () => {
          try {
            expect(fs.lstat).not.toBeCalled();
            expect(cmdShim).lastCalledWith(src, dst, expect.any(Function));
            done();
          } catch (ex) {
            done.fail(ex);
          }
        });
      });

cmd-shim

Used in npm for command line application support

ISC
Latest version published 17 hours ago

Package Health Score

92 / 100
Full package analysis