Skip to content

Commit

Permalink
chore(lambda-nodejs): fix test broken in CodeBuild (#17884)
Browse files Browse the repository at this point in the history
This test fails in our CodeBuild environment with the following error:

```
FAIL test/util.test.js
  ● extractDependencies › with file dependency
    expect(received).toEqual(expected) // deep equality
    - Expected  - 1
    + Received  + 1
      Object {
    -   "my-module": StringMatching /aws-cdk\/packages\/@aws-cdk\/core/,
    +   "my-module": "file:/codebuild/output/src777018412/src/packages/@aws-cdk/core",
      }
      130 |     }));
      131 |
    > 132 |     expect(extractDependencies(pkgPath, ['my-module'])).toEqual({
          |                                                         ^
      133 |       'my-module': expect.stringMatching(/aws-cdk\/packages\/@aws-cdk\/core/),
      134 |     });
      135 |
      at Object.<anonymous> (test/util.test.ts:132:57)
 ```

This is due to the source being located in .../src instead of .../aws-cdk. Fix
the test by stopping the check at the 'packages' directory.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
njlynch authored Dec 7, 2021
1 parent 58c2c65 commit d5c249f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-lambda-nodejs/test/util.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ describe('extractDependencies', () => {
}));

expect(extractDependencies(pkgPath, ['my-module'])).toEqual({
'my-module': expect.stringMatching(/aws-cdk\/packages\/@aws-cdk\/core/),
'my-module': expect.stringMatching(/packages\/@aws-cdk\/core/),
});

fs.unlinkSync(pkgPath);
Expand Down

0 comments on commit d5c249f

Please sign in to comment.