From 85089f8396e78b4ac5f4e6f28c4f38e9696c139a Mon Sep 17 00:00:00 2001 From: Ioanna Kyprianou <51630004+ioanna0@users.noreply.github.com> Date: Tue, 13 Oct 2020 16:04:18 +0300 Subject: [PATCH] fix: Create vendor dir and exclude it from coverage (#55) * exclude external-scripts from coverage * Refactor vendors & include 3pts to index.ts * Use rootDirs to add vendors * Update tsconfig.build.json Co-authored-by: Alex Sanders * back to rootDir * bring back rootDirs Co-authored-by: Alex Sanders --- .gitignore | 1 + jest.config.js | 4 +--- src/index.ts | 2 ++ src/third-party-tags/lotame.ts | 2 +- src/third-party-tags/twitter-uwt.spec.ts | 2 +- src/third-party-tags/twitter-uwt.ts | 2 +- tsconfig.build.json | 5 ++++- .../external-scripts => vendor}/lotame-script.ts | 0 .../external-scripts => vendor}/twitter-script.ts | 0 9 files changed, 11 insertions(+), 7 deletions(-) rename {src/third-party-tags/external-scripts => vendor}/lotame-script.ts (100%) rename {src/third-party-tags/external-scripts => vendor}/twitter-script.ts (100%) diff --git a/.gitignore b/.gitignore index 0e75fe557..6761199fb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules dist coverage +.DS_Store diff --git a/jest.config.js b/jest.config.js index e950ec5e1..792bd45cb 100644 --- a/jest.config.js +++ b/jest.config.js @@ -27,9 +27,7 @@ module.exports = { // coverageDirectory: undefined, // An array of regexp pattern strings used to skip coverage collection - // coveragePathIgnorePatterns: [ - // "/node_modules/" - // ], + coveragePathIgnorePatterns: ['vendor'], // Indicates which provider should be used to instrument code for coverage // coverageProvider: "babel", diff --git a/src/index.ts b/src/index.ts index 7adcfebd9..c11ffec0d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,5 @@ export { ias } from './third-party-tags/ias'; export { permutive } from './third-party-tags/permutive'; export { fbPixel } from './third-party-tags/facebook-pixel'; +export { twitter } from './third-party-tags/twitter-uwt'; +export { lotame } from './third-party-tags/lotame'; diff --git a/src/third-party-tags/lotame.ts b/src/third-party-tags/lotame.ts index 5dc5d65fb..461f9e131 100644 --- a/src/third-party-tags/lotame.ts +++ b/src/third-party-tags/lotame.ts @@ -1,5 +1,5 @@ +import { lotameScript } from '../../vendor/lotame-script'; import { GetThirdPartyTag } from '../types'; -import { lotameScript } from './external-scripts/lotame-script'; export type LotameData = { ozoneLotameData: Array; diff --git a/src/third-party-tags/twitter-uwt.spec.ts b/src/third-party-tags/twitter-uwt.spec.ts index 5d799ff11..0be286ea5 100644 --- a/src/third-party-tags/twitter-uwt.spec.ts +++ b/src/third-party-tags/twitter-uwt.spec.ts @@ -1,4 +1,4 @@ -import { twitterScript } from './external-scripts/twitter-script'; +import { twitterScript } from '../../vendor/twitter-script'; import { twitter } from './twitter-uwt'; describe('twitter', () => { diff --git a/src/third-party-tags/twitter-uwt.ts b/src/third-party-tags/twitter-uwt.ts index 84653866e..ee0a27319 100644 --- a/src/third-party-tags/twitter-uwt.ts +++ b/src/third-party-tags/twitter-uwt.ts @@ -1,5 +1,5 @@ +import { twitterScript as insertSnippet } from '../../vendor/twitter-script'; import { GetThirdPartyTag } from '../types'; -import { twitterScript as insertSnippet } from './external-scripts/twitter-script'; export const twitter: GetThirdPartyTag = ({ shouldRun }) => ({ shouldRun, diff --git a/tsconfig.build.json b/tsconfig.build.json index 9a17522b7..2951d8f3f 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -3,7 +3,10 @@ "declaration": true, "noEmit": false, "outDir": "dist", - "rootDir": "src" + "rootDirs": [ + "../../vendor", + "src", + ] }, "extends": "./tsconfig.json", "include": ["src"], diff --git a/src/third-party-tags/external-scripts/lotame-script.ts b/vendor/lotame-script.ts similarity index 100% rename from src/third-party-tags/external-scripts/lotame-script.ts rename to vendor/lotame-script.ts diff --git a/src/third-party-tags/external-scripts/twitter-script.ts b/vendor/twitter-script.ts similarity index 100% rename from src/third-party-tags/external-scripts/twitter-script.ts rename to vendor/twitter-script.ts