How to use the dir-compare.fileCompareHandlers function in dir-compare

To help you get started, we’ve selected a few dir-compare 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 bencoveney / barrelsby / test / src.ts View on Github external
Barrelsby(args as any);
          console.log(`Running integration test in directory ${directory}`);
          const outputDirectory = join(directory, "output");
          const expectedDirectory = join(directory, "expected");
          console.log("Output directory:", outputDirectory);
          console.log("Expected directory:", expectedDirectory);
          const comparison = dirCompare.compareSync(
            outputDirectory,
            expectedDirectory,
            {
              compareContent: true,
              compareFileAsync:
                dirCompare.fileCompareHandlers.lineBasedFileCompare
                  .compareAsync,
              compareFileSync:
                dirCompare.fileCompareHandlers.lineBasedFileCompare.compareSync,
              ignoreLineEnding: true
            }
          );
          if (comparison.differences && comparison.diffSet) {
            comparison.diffSet
              .filter(diff => diff.state !== "equal")
              .map(diff => {
                const state = ({
                  distinct: "<>",
                  equal: "==",
                  left: "->",
                  right: "<-"
                } as any)[diff.state];
                const name1 = diff.name1 ? diff.name1 : "";
                const name2 = diff.name2 ? diff.name2 : "";
                console.error(
github bencoveney / barrelsby / test / src.ts View on Github external
() => {
          Barrelsby(args as any);
          console.log(`Running integration test in directory ${directory}`);
          const outputDirectory = join(directory, "output");
          const expectedDirectory = join(directory, "expected");
          console.log("Output directory:", outputDirectory);
          console.log("Expected directory:", expectedDirectory);
          const comparison = dirCompare.compareSync(
            outputDirectory,
            expectedDirectory,
            {
              compareContent: true,
              compareFileAsync:
                dirCompare.fileCompareHandlers.lineBasedFileCompare
                  .compareAsync,
              compareFileSync:
                dirCompare.fileCompareHandlers.lineBasedFileCompare.compareSync,
              ignoreLineEnding: true
            }
          );
          if (comparison.differences && comparison.diffSet) {
            comparison.diffSet
              .filter(diff => diff.state !== "equal")
              .map(diff => {
                const state = ({
                  distinct: "<>",
                  equal: "==",
                  left: "->",
                  right: "<-"
                } as any)[diff.state];

dir-compare

Node JS directory compare

MIT
Latest version published 7 months ago

Package Health Score

70 / 100
Full package analysis