refactor: error behaviour on limit exceeded
This commit is contained in:
parent
ef6fb52498
commit
dd8958875f
2 changed files with 6 additions and 6 deletions
|
@ -204,7 +204,9 @@ describe('Packwatch', () => {
|
|||
unpackedSize: '140B',
|
||||
})
|
||||
|
||||
await packwatch({ cwd: workspacePath })
|
||||
await expect(async () =>
|
||||
packwatch({ cwd: workspacePath }),
|
||||
).rejects.toThrow('PACKAGE_EXCEEDS_LIMIT')
|
||||
expect(mockLogger.mock.calls).toHaveLength(1)
|
||||
expect(mockLogger.mock.calls[0][0]).toEqual(
|
||||
expect.stringMatching(
|
||||
|
|
|
@ -36,11 +36,9 @@ export default async function packwatch({
|
|||
console.log(
|
||||
'❗ It looks like you ran PackWatch without a manifest. To prevent accidental passes in CI or hooks, packwatch will terminate with an error. If you are running packwatch for the first time in your project, this is expected!',
|
||||
)
|
||||
throw new Error('NO_MANIFEST_NO_UPDATE')
|
||||
}
|
||||
// If the update flag wasn't specified, exit with a non-zero code so we
|
||||
// don't "accidentally" pass CI builds if the manifest didn't exist
|
||||
if (!isUpdatingManifest) throw new Error()
|
||||
else return
|
||||
return
|
||||
}
|
||||
|
||||
const previousStats = getPreviousPackageStats(cwd)
|
||||
|
@ -79,7 +77,7 @@ export default async function packwatch({
|
|||
console.log(
|
||||
`🔥🔥📦🔥🔥 Your package exceeds the limit set in ${MANIFEST_FILENAME}! ${packageSize} > ${limit}\nEither update the limit by using the --update-manifest flag or trim down your packed files!`,
|
||||
)
|
||||
return
|
||||
throw new Error('PACKAGE_EXCEEDS_LIMIT')
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Reference in a new issue