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
Altrim Beqiri and agilgur5 committed Oct 5, 2020
1 parent 04d10bd commit c9c6493
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 c9c6493

Please sign in to comment.