fix: do not run node-gyp rebuild if preinstall lifecycle script is present (#7206)
This commit is contained in:
1 parent
4246f41bed
commit
84f81c9ae3
5 files changed
+39
-3
No files matched your search
@@ -84,3 +84,18 @@ test('runLifecycleHook() should throw an error while missing script start or fil
|
||||
})
|
||||
).rejects.toThrow(new PnpmError('NO_SCRIPT_OR_SERVER', 'Missing script start or file server.js'))
|
||||
})
|
||||
|
||||
test('preinstall script does not trigger node-gyp rebuild', async () => {
|
||||
const pkgRoot = f.find('gyp-with-preinstall')
|
||||
await rimraf(path.join(pkgRoot, 'output.json'))
|
||||
await runPostinstallHooks({
|
||||
depPath: '/gyp-with-preinstall/1.0.0',
|
||||
optional: false,
|
||||
pkgRoot,
|
||||
rawConfig: {},
|
||||
rootModulesDir,
|
||||
unsafePerm: true,
|
||||
})
|
||||
|
||||
expect(loadJsonFile.sync(path.join(pkgRoot, 'output.json'))).toStrictEqual(['preinstall'])
|
||||
})
|
||||
Reference in new issue
Block a user