Skip to content

Commit

Permalink
test: ensure lodash-es replacement is done properly
Browse files Browse the repository at this point in the history
- lodash for CJS, lodash-es for ESM

- previously, there were no tests for this behavior, so this adds them
  to ensure the replacement continues to work, even with the new
  fix with regex lookahead for `lodash/fp`

Co-authored-by: Anton Gilgur <[email protected]>
  • Loading branch information
2 people authored and paul-vd committed Dec 1, 2020
1 parent e5e4f75 commit 60022b5
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/e2e/tsdx-build-default.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,22 @@ describe('tsdx build :: zero-config defaults', () => {
expect(matched).toBeFalsy();
});

it('should use lodash for the CJS build', () => {
const output = execWithCache('node ../dist/index.js build');
expect(output.code).toBe(0);

const matched = grep(/lodash/, ['dist/build-default.cjs.*.js']);
expect(matched).toBeTruthy();
});

it('should use lodash-es for the ESM build', () => {
const output = execWithCache('node ../dist/index.js build');
expect(output.code).toBe(0);

const matched = grep(/lodash-es/, ['dist/build-default.esm.js']);
expect(matched).toBeTruthy();
});

it("shouldn't replace lodash/fp", () => {
const output = execWithCache('node ../dist/index.js build');
expect(output.code).toBe(0);
Expand Down

0 comments on commit 60022b5

Please sign in to comment.