MCPcopy Create free account
hub / github.com/decaporg/decap-cms / testPackagePack

Function testPackagePack

scripts/test-package-integrity.mjs:86–106  ·  view source on GitHub ↗

* Test that a package can be packed without errors

(packageName)

Source from the content-addressed store, hash-verified

84 * Test that a package can be packed without errors
85 */
86function testPackagePack(packageName) {
87 const packageDir = join(ROOT_DIR, 'packages', packageName);
88
89 log(`Testing npm pack for ${packageName}...`);
90
91 const result = spawnSync('npm', ['pack', '--dry-run'], {
92 cwd: packageDir,
93 encoding: 'utf8',
94 stdio: 'pipe',
95 shell: true,
96 });
97
98 if (result.status !== 0) {
99 error(`npm pack failed for ${packageName}`);
100 error(result.stderr);
101 return false;
102 }
103
104 log(` npm pack OK for ${packageName}`);
105 return true;
106}
107
108/**
109 * Test that a package doesn't have browser-incompatible code

Callers 1

mainFunction · 0.85

Calls 2

logFunction · 0.85
errorFunction · 0.85

Tested by

no test coverage detected