From e500525e2155ca739aceff855b52101b36b97eec Mon Sep 17 00:00:00 2001 From: omrilotan Date: Thu, 19 May 2022 13:26:53 +0100 Subject: [PATCH] test jsdom environemtn --- jest/jest.config.browser.js | 3 +++ jest/package.json | 6 ++++-- package.json | 12 +++++++++--- 3 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 jest/jest.config.browser.js diff --git a/jest/jest.config.browser.js b/jest/jest.config.browser.js new file mode 100644 index 0000000..0c5c2f9 --- /dev/null +++ b/jest/jest.config.browser.js @@ -0,0 +1,3 @@ +module.exports = { + testEnvironment: 'jsdom', +} diff --git a/jest/package.json b/jest/package.json index bfb153a..181d68d 100644 --- a/jest/package.json +++ b/jest/package.json @@ -1,11 +1,12 @@ { "type": "commonjs", "scripts": { + "browser": "jest esm -c jest.config.browser.js", "cjs": "jest cjs -c jest.config.js", "esm": "jest esm -c jest.config.js", - "ts": "jest ts -c jest.config.ts.js", "pretest": "which jest || npm i", - "test": "npm run esm && npm run cjs && npm run ts" + "test": "npm run esm && npm run cjs && npm run browser && npm run ts", + "ts": "jest ts -c jest.config.ts.js" }, "dependencies": { "isbot": "../" @@ -17,6 +18,7 @@ "@types/jest": "^27.5.0", "babel-jest": "^28.1.0", "jest": "^28.1.0", + "jest-environment-jsdom": "^28.1.0", "ts-jest": "^28.0.2" } } diff --git a/package.json b/package.json index d4a4f14..35fd0c7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "isbot", - "version": "3.4.7", + "version": "3.5.0-rc", "description": "🤖 detect bots/crawlers/spiders via the user agent.", "keywords": [ "bot", @@ -27,10 +27,16 @@ "exports": { "./package.json": "./package.json", ".": { - "browser": "./index.mjs", + "browser": { + "import": "./index.mjs", + "require": "./index.js" + }, + "node": { + "import": "./index.mjs", + "require": "./index.js" + }, "import": "./index.mjs", "require": "./index.js", - "node": "./index.js", "default": "./index.js" } },