test/spec/env/pkgs-spec.js
/**
 * Verify that a package has only required files
 * @param pkg
 */
Verify that a package has only required files
@param pkg
Verify that a package has only required files @param pkg
function verifyPackageConsistency(pkg) {
  const packedFiles = getPackedFiles(pkg);
  const actualFiles = fs.readdirSync(`${pkgPath}/${pkg.name}`).filter(f => !f.endsWith('.tgz') && !f.startsWith('src/'));
  const pkgVersion = getVersion(pkg);
  describe(pkg.name, () => {
    it('Folder should contain required files', () => {
      getArrayDiff(pkg.files, actualFiles).forEach(file => {
        fail(file);
      });
    });
    it('Folder should not contain redundant files', () => {
      getArrayDiff(actualFiles, pkg.files).forEach(file => {
        fail(file);
      });
    });
    it('Pack file should contain required files', () => {
      getArrayDiff(pkg.files, packedFiles).forEach(file => {
        fail(file);
      });
    });
    it('Pack file should not contain redundant files', () => {
      getArrayDiff(packedFiles, pkg.files).forEach(file => {
        fail(file);
      });
    });
    it(`Package version should be same as cloudinary_js: ${version}`, () => {
      expect(pkgVersion).toEqual(version);
    });
    it(`Package files should equal files in dist folder`, () => {
      expect(getUnequalBuildFiles(pkg, actualFiles)).toEqual([]);
    });
  });
}
function verifyPackageConsistency ( pkg ) { const packedFiles = getPackedFiles ( pkg ) ; const actualFiles = fs . readdirSync ( ` ${ pkgPath } ${ pkg . name } ` ) . filter ( f => ! f . endsWith ( '.tgz' ) && ! f . startsWith ( 'src/' ) ) ; const pkgVersion = getVersion ( pkg ) ; describe ( pkg . name , ( ) => { it ( 'Folder should contain required files' , ( ) => { getArrayDiff ( pkg . files , actualFiles ) . forEach ( file => { fail ( file ) ; } ) ; } ) ; it ( 'Folder should not contain redundant files' , ( ) => { getArrayDiff ( actualFiles , pkg . files ) . forEach ( file => { fail ( file ) ; } ) ; } ) ; it ( 'Pack file should contain required files' , ( ) => { getArrayDiff ( pkg . files , packedFiles ) . forEach ( file => { fail ( file ) ; } ) ; } ) ; it ( 'Pack file should not contain redundant files' , ( ) => { getArrayDiff ( packedFiles , pkg . files ) . forEach ( file => { fail ( file ) ; } ) ; } ) ; it ( ` ${ version } ` , ( ) => { expect ( pkgVersion ) . toEqual ( version ) ; } ) ; it ( ` ` , ( ) => { expect ( getUnequalBuildFiles ( pkg , actualFiles ) ) . toEqual ( [ ] ) ; } ) ; } ) ; }
Verify that a package has only required files
 @param pkg
Verify that a package has only required files @param pkg