Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jogold committed May 20, 2021
1 parent e37701f commit 7ab655c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/@aws-cdk/aws-lambda-nodejs/test/bundling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,27 @@ test('Detects yarn.lock', () => {
});
});

test('Detects pnpm-lock.yaml', () => {
const pnpmLock = '/project/pnpm-lock.yaml';
Bundling.bundle({
entry: __filename,
depsLockFilePath: pnpmLock,
runtime: Runtime.NODEJS_12_X,
nodeModules: ['delay'],
forceDockerBundling: true,
});

// Correctly bundles with esbuild
expect(Code.fromAsset).toHaveBeenCalledWith(path.dirname(pnpmLock), {
assetHashType: AssetHashType.OUTPUT,
bundling: expect.objectContaining({
command: expect.arrayContaining([
expect.stringMatching(/pnpm-lock\.yaml.+pnpm install/),
]),
}),
});
});

test('with Docker build args', () => {
Bundling.bundle({
entry,
Expand Down
13 changes: 13 additions & 0 deletions packages/@aws-cdk/aws-lambda-nodejs/test/docker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,19 @@ test('can yarn install with non root user', () => {
expect(proc.status).toEqual(0);
});

test('can pnpm install with non root user', () => {
const proc = spawnSync('docker', [
'run', '-u', '500:500',
'esbuild',
'bash', '-c', [
'mkdir /tmp/test',
'cd /tmp/test',
'pnpm add constructs',
].join(' && '),
]);
expect(proc.status).toEqual(0);
});

test('cache folders have the right permissions', () => {
const proc = spawnSync('docker', [
'run', 'esbuild',
Expand Down

0 comments on commit 7ab655c

Please sign in to comment.