Skip to content

Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.

Update packages, migrate jest

Ondra Urban5a9f5b4b87bd
diff --git a/jest.config.js b/jest.config.js
index e7cc34ed5..5de837f5e 100644
--- a/jest.config.js
+++ b/jest.config.js
@@ -1,6 +1,8 @@
const path = require('path');
module.exports = {
+ testEnvironment: 'node',
+ testRunner: 'jest-circus/runner',
verbose: true,
rootDir: path.join(__dirname, './'),
testMatch: ['**/?(*.)+(spec|test).[tj]s?(x)'],
diff --git a/package.json b/package.json
index f924aaeaa..56d885b79 100644
--- a/package.json
+++ b/package.json
@@ -47,71 +47,72 @@
"prepare": "npm run build",
"prepublishOnly": "(test $TRAVIS || (echo \"Publishing is reserved to the Travis CI!\"; exit 1))",
"clean": "rm -rf ./build ./types",
- "lint": "npm run build && eslint ./src ./test",
+ "lint": "eslint ./src ./test",
"lint:fix": "eslint ./src ./test --ext .js,.jsx --fix"
},
"dependencies": {
"@apify/http-request": "^1.2.0",
"@apify/ps-tree": "^1.1.3",
- "@types/cheerio": "^0.22.16",
+ "@types/cheerio": "^0.22.18",
"@types/node": "^12",
- "@types/puppeteer": "^2.0.0",
+ "@types/puppeteer": "^2.1.0",
"@types/tough-cookie": "^4.0.0",
"@types/socket.io": "^2.1.4",
"apify-client": "^0.6.0",
- "apify-shared": "^0.2.7",
+ "apify-shared": "^0.2.15",
"cheerio": "^1.0.0-rc.3",
"content-type": "^1.0.4",
"express": "^4.17.1",
"fs-extra": "^9.0.0",
"htmlparser2": "^4.1.0",
- "iconv-lite": "^0.5.0",
- "jquery": "^3.4.1",
- "mime-types": "^2.1.24",
+ "iconv-lite": "^0.5.1",
+ "jquery": "^3.5.1",
+ "mime-types": "^2.1.27",
"proxy-chain": "^0.4.4",
"rimraf": "^3.0.2",
- "semver": "^7.1.3",
- "socket.io": "^2.2.0",
- "stream-json": "^1.3.3",
+ "semver": "^7.3.2",
+ "socket.io": "^2.3.0",
+ "stream-json": "^1.5.0",
"tough-cookie": "^4.0.0",
- "underscore": "^1.9.1",
- "ws": "^7.2.1"
+ "underscore": "^1.10.2",
+ "ws": "^7.3.0"
},
"devDependencies": {
"@apify/eslint-config": "^0.0.3",
- "@babel/cli": "^7.0.0",
- "@babel/core": "^7.0.0",
- "@babel/preset-env": "^7.0.0",
- "@babel/register": "^7.0.0",
+ "@babel/cli": "^7.8.4",
+ "@babel/core": "^7.9.6",
+ "@babel/preset-env": "^7.9.6",
+ "@babel/register": "^7.9.0",
"@types/content-type": "^1.1.3",
"@types/fs-extra": "^8.1.0",
"@types/htmlparser2": "^3.10.1",
- "@types/jest": "^25.1.3",
+ "@types/jest": "^25.2.2",
"@types/request-promise-native": "^1.0.17",
"@types/rimraf": "^3.0.0",
- "@types/semver": "^7.1.0",
+ "@types/semver": "^7.2.0",
"@types/sinon": "^9.0.0",
- "@types/underscore": "^1.9.4",
- "@types/ws": "^7.2.1",
+ "@types/underscore": "^1.10.0",
+ "@types/ws": "^7.2.4",
"basic-auth-parser": "^0.0.2",
"body-parser": "^1.19.0",
- "csv-parse": "^4.4.3",
+ "csv-parse": "^4.9.1",
"eslint": "^7.0.0",
"fpcollect": "^1.0.4",
"fpscanner": "^0.1.5",
- "jest": "^25.1.0",
- "ts-jest": "^25.2.1",
- "jsdoc": "^3.5.5",
+ "jest": "^26.0.1",
+ "jest-circus": "^26.0.1",
+ "jsdoc": "^3.6.4",
"jsdoc-export-default-interop": "^0.3.1",
"portastic": "^1.0.1",
- "prettier": "^2.0.1",
+ "prettier": "^2.0.5",
"proxy": "^1.0.1",
- "sinon": "^9.0.0",
+ "sinon": "^9.0.2",
"sinon-stub-promise": "^4.0.0",
- "socket.io-client": "^2.2.0",
- "typescript": "^3.8.3",
- "ua-parser-js": "^0.7.20",
- "why-is-node-running": "^2.0.3"
+ "socket.io-client": "^2.3.0",
+ "ts-jest": "^25.5.1",
+ "typescript": "^3.9.2",
+ "ua-parser-js": "^0.7.21",
+ "why-is-node-running": "^2.1.2"
},
"optionalDependencies": {
"puppeteer": "3.0.4"
diff --git a/test/.eslintrc.json b/test/.eslintrc.json
index c4cf79fbe..1e6583889 100644
--- a/test/.eslintrc.json
+++ b/test/.eslintrc.json
@@ -11,7 +11,6 @@
"afterEach": false,
"expect": false,
"test": false,
- "jest": false,
- "jasmine": false
+ "jest": false
}
}
diff --git a/test/session_pool/session_pool.test.js b/test/session_pool/session_pool.test.js
index bb3535092..a13b46c09 100644
--- a/test/session_pool/session_pool.test.js
+++ b/test/session_pool/session_pool.test.js
@@ -62,7 +62,7 @@ describe('SessionPool - testing session pool', () => {
expect(sessionPool[key]).toEqual(value);
});
// log is appended to sessionOptions after sessionPool instantiation
- expect(sessionPool.sessionOptions).toEqual({ ...opts.sessionOptions, log: jasmine.any(defaultLog.Log) });
+ expect(sessionPool.sessionOptions).toEqual({ ...opts.sessionOptions, log: expect.any(defaultLog.Log) });
const store = await Apify.openKeyValueStore('TEST');
await store.drop();
@@ -91,7 +91,7 @@ describe('SessionPool - testing session pool', () => {
expect(sessionPool[key]).toEqual(value);
});
// log is appended to sessionOptions after sessionPool instantiation
- expect(sessionPool.sessionOptions).toEqual({ ...opts.sessionOptions, log: jasmine.any(defaultLog.Log) });
+ expect(sessionPool.sessionOptions).toEqual({ ...opts.sessionOptions, log: expect.any(defaultLog.Log) });
const store = await Apify.openKeyValueStore('TEST');
await store.drop();