diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 207994e..74cb754 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,6 @@ name: esbuild-jest -on: [push] +on: [push, pull_request] jobs: ubuntu-latest: @@ -19,6 +19,7 @@ jobs: - run: yarn - run: yarn build - run: yarn test + - run: yarn test:coverage env: CI: true windows-latest: @@ -37,6 +38,7 @@ jobs: - run: yarn - run: yarn build - run: yarn test + - run: yarn test:coverage env: CI: true macos-latest: @@ -55,5 +57,6 @@ jobs: - run: yarn - run: yarn build - run: yarn test + - run: yarn test:coverage env: CI: true diff --git a/.gitignore b/.gitignore index c93c40f..4277722 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ node_modules dist .envrc -default.nix \ No newline at end of file +default.nix +coverage \ No newline at end of file diff --git a/package.json b/package.json index c456524..8c87d25 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "scripts": { "postinstall": "yarn build", "build": "ts-node ./tools/build.ts", - "test": "jest --clearCache && jest --detectOpenHandles" + "test": "jest --clearCache && jest --detectOpenHandles", + "test:coverage": "jest --clearCache && jest --coverage" }, "repository": { "type": "git", diff --git a/src/index.ts b/src/index.ts index 12501db..a58c604 100644 --- a/src/index.ts +++ b/src/index.ts @@ -17,7 +17,7 @@ const createTransformer = (options?: Options) => ({ const ext = getExt(filename), extName = extname(filename).slice(1) // Caution: disabling this, can cause issues with inlineSnapshots since can't find the original line - const enableSourcemaps = options?.sourcemap || true + const enableSourcemaps = options?.sourcemap === false ? false : (options?.sourcemap || true) const loader = (options?.loaders && options?.loaders[ext] ? options.loaders[ext] : loaders.includes(extName) ? extName: 'text'