Skip to content

Commit

Permalink
fix(build): missing bundle mode
Browse files Browse the repository at this point in the history
  • Loading branch information
gjuchault committed Aug 16, 2022
1 parent c524631 commit ff379fc
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 27 deletions.
11 changes: 6 additions & 5 deletions scripts/build.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import path from "path";
import { build as esbuild } from "esbuild";
import { build as esbuild, BuildOptions } from "esbuild";

const baseConfig = {
platform: "node" as const,
target: "esnext" as const,
format: "cjs" as const,
const baseConfig: BuildOptions = {
platform: "node",
target: "esnext",
format: "cjs",
nodePaths: [path.join(__dirname, "../src")],
sourcemap: true,
external: [],
bundle: true,
};

async function main() {
Expand Down
21 changes: 4 additions & 17 deletions src/__tests__/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,14 @@
import { describe, expect, it } from "vitest";
import { foo, bar } from "../index";
import { foobar } from "../index";

describe("foo()", () => {
describe("foobar()", () => {
describe("given two positive integers", () => {
const first = 1;
const second = 2;

describe("when called", () => {
it("returns the sum of them", () => {
expect(foo(first, second)).toEqual(3);
});
});
});
});

describe("bar()", () => {
describe("given two positive integers", () => {
const first = 2;
const second = 1;

describe("when called", () => {
it("returns the subtraction of them", () => {
expect(bar(first, second)).toEqual(1);
it("returns the sum of them multiplied by 3", () => {
expect(foobar(first, second)).toEqual(9);
});
});
});
Expand Down
3 changes: 3 additions & 0 deletions src/bar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function bar() {
return "bar";
}
3 changes: 3 additions & 0 deletions src/foo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function foo() {
return "foo";
}
9 changes: 4 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export function foo(a: number, b: number): number {
return a + b;
}
import { bar } from "./bar";
import { foo } from "./foo";

export function bar(a: number, b: number): number {
return a - b;
export function foobar(a: number, b: number) {
return foo().repeat(a).length + bar().repeat(b).length;
}

0 comments on commit ff379fc

Please sign in to comment.