Skip to content

Commit

Permalink
Add tests for lodash and lodash-es
Browse files Browse the repository at this point in the history
  • Loading branch information
Altrim Beqiri committed Sep 25, 2020
1 parent 9266e19 commit 474a675
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
"@rollup/plugin-node-resolve": "^9.0.0",
"@rollup/plugin-replace": "^2.2.1",
"@types/jest": "^25.2.1",
"@types/lodash": "^4.14.161",
"@typescript-eslint/eslint-plugin": "^2.12.0",
"@typescript-eslint/parser": "^2.12.0",
"ansi-escapes": "^4.2.1",
Expand Down Expand Up @@ -102,6 +101,7 @@
"devDependencies": {
"@types/eslint": "^6.1.2",
"@types/fs-extra": "^9.0.1",
"@types/lodash": "^4.14.161",
"@types/node": "^14.11.1",
"@types/react": "^16.9.11",
"@types/rollup-plugin-json": "^3.0.2",
Expand Down
32 changes: 24 additions & 8 deletions test/e2e/tsdx-build-default.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,30 @@ describe('tsdx build :: zero-config defaults', () => {
expect(matched).toBeFalsy();
});

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

const matched = grep(/lodash\/fp/, ['dist/build-default.*.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('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 clean the dist directory before rebuilding', () => {
let output = execWithCache('node ../dist/index.js build');
expect(output.code).toBe(0);
Expand Down Expand Up @@ -105,14 +129,6 @@ describe('tsdx build :: zero-config defaults', () => {
shell.mv('package-og.json', 'package.json');
});

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

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

afterAll(() => {
util.teardownStage(stageName);
});
Expand Down

0 comments on commit 474a675

Please sign in to comment.