-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
251 additions
and
235 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,6 +90,54 @@ packages: | |
fspReadFileMock.mock.mockImplementationOnce(() => | ||
Promise.reject(new Error()) | ||
); | ||
const lockFileContents = | ||
await pnpmLockFileReader.getLockFileContentsFromCwd(); | ||
assert.deepEqual(lockFileContents, undefined); | ||
}); | ||
|
||
void it('returns empty dependency array when pnpm-lock.yaml does not have dependencies', async () => { | ||
mock.method( | ||
fsp, | ||
'readFile', | ||
() => `lockfileVersion: '9.0' | ||
settings: | ||
autoInstallPeers: true | ||
excludeLinksFromLockfile: false | ||
importers: | ||
.: | ||
dependencies: | ||
aws-amplify: | ||
specifier: ^6.12.0 | ||
version: 6.12.0 | ||
devDependencies: | ||
'@aws-amplify/backend': | ||
specifier: ^1.11.0 | ||
version: 1.12.0(@aws-sdk/[email protected])(@aws-sdk/[email protected])(@aws-sdk/[email protected](@aws-sdk/[email protected]))(@aws-sdk/[email protected])([email protected]([email protected]))([email protected])([email protected]) | ||
'@aws-amplify/backend-cli': | ||
specifier: ^1.4.5 | ||
version: 1.4.6(@aws-sdk/[email protected](@aws-sdk/[email protected]))(@aws-sdk/[email protected])(@aws-sdk/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]) | ||
aws-cdk: | ||
specifier: ^2.173.4 | ||
version: 2.174.1 | ||
aws-cdk-lib: | ||
specifier: ^2.173.4 | ||
version: 2.174.1([email protected]) | ||
constructs: | ||
specifier: ^10.4.2 | ||
version: 10.4.2 | ||
esbuild: | ||
specifier: ^0.24.2 | ||
version: 0.24.2 | ||
tsx: | ||
specifier: ^4.19.2 | ||
version: 4.19.2 | ||
typescript: | ||
specifier: ^5.7.2 | ||
version: 5.7.2` | ||
); | ||
const lockFileContents = | ||
await pnpmLockFileReader.getLockFileContentsFromCwd(); | ||
assert.deepEqual(lockFileContents, { dependencies: [] }); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
packages/cli-core/src/package-manager-controller/lock-file-reader/types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Dependency } from '@aws-amplify/plugin-types'; | ||
|
||
export type LockFileContents = { | ||
dependencies: Array<Dependency>; | ||
}; | ||
|
||
export type LockFileReader = { | ||
getLockFileContentsFromCwd: () => Promise<LockFileContents | undefined>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,10 +56,25 @@ [email protected]: | |
assert.strictEqual(fspReadFileMock.mock.callCount(), 1); | ||
}); | ||
|
||
void it('returns empty lock file contents when yarn.lock is not present or parse-able', async () => { | ||
void it('returns undefined when yarn.lock is not present or parse-able', async () => { | ||
fspReadFileMock.mock.mockImplementationOnce(() => | ||
Promise.reject(new Error()) | ||
); | ||
const lockFileContents = | ||
await yarnClassicLockFileReader.getLockFileContentsFromCwd(); | ||
assert.deepEqual(lockFileContents, undefined); | ||
}); | ||
|
||
void it('returns empty dependency array when yarn.lock does not have dependencies', async () => { | ||
mock.method( | ||
fsp, | ||
'readFile', | ||
() => `# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
# yarn lockfile v1 | ||
` | ||
); | ||
const lockFileContents = | ||
await yarnClassicLockFileReader.getLockFileContentsFromCwd(); | ||
assert.deepEqual(lockFileContents, { dependencies: [] }); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.