diff --git a/.gitignore b/.gitignore index 86c24d0..d2c2136 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,4 @@ node_modules data/* cache/* dist/* -src/tests/testConfig.ts \ No newline at end of file +testConfig.json \ No newline at end of file diff --git a/package.json b/package.json index 3d53cde..8703de7 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "packageManager": "yarn@1.22.17", "homepage": "https://github.com/yanivfranco/cibus-scraper", "scripts": { - "build": "tsc", + "build": "tsc -p tsconfig.build.json", "test": "jest" }, "dependencies": { diff --git a/src/tests/cibusScraper.test.ts b/tests/cibusScraper.test.ts similarity index 63% rename from src/tests/cibusScraper.test.ts rename to tests/cibusScraper.test.ts index 8e1e456..75918d6 100644 --- a/src/tests/cibusScraper.test.ts +++ b/tests/cibusScraper.test.ts @@ -1,12 +1,11 @@ -// @ts-ignore - This file is ignored by git, so we need to ignore the ts check in order to pass build -import { CibusScraper } from "../cibusScraper"; -import { options } from "./testConfig"; +import { readFileSync } from "fs"; +import { CibusScraper, CibusScraperOptions } from "../src/cibusScraper"; jest.setTimeout(60000); describe("CibusScrapper", () => { let scrapper: CibusScraper; - + const options = JSON.parse(readFileSync("tests/testConfig.json", "utf8")) as CibusScraperOptions; beforeEach(() => { scrapper = new CibusScraper(); }); diff --git a/tests/testConfigExample.json b/tests/testConfigExample.json new file mode 100644 index 0000000..0001f7e --- /dev/null +++ b/tests/testConfigExample.json @@ -0,0 +1,10 @@ +{ + "username": "", + "password": "", + "company": "", + "puppeteerLaunchOptions": { + "headless": false, + "slowMo": 20, + "devtools": true + } +} diff --git a/tsconfig.build.json b/tsconfig.build.json new file mode 100644 index 0000000..c1abe07 --- /dev/null +++ b/tsconfig.build.json @@ -0,0 +1,4 @@ +{ + "extends": "./tsconfig.json", + "exclude": ["node_modules/**/*", "dist/**/*", "lib/**/*", "node_modules", "tests"] +} diff --git a/tsconfig.json b/tsconfig.json index 4717952..6c5a1cd 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,6 +10,6 @@ "moduleResolution": "node", "outDir": "./dist" }, - "include": ["src/**/*"], + "include": ["src/**/*", "tests"], "exclude": ["node_modules/**/*", "dist/**/*", "lib/**/*", "node_modules"] }