apify-test-tools 0.8.6 → 0.8.7-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/bin/slack.ts +4 -4
- package/dist/bin/slack.js +4 -4
- package/dist/bin/slack.js.map +1 -1
- package/dist/lib/consts.d.ts +6 -0
- package/dist/lib/consts.d.ts.map +1 -1
- package/dist/lib/consts.js +6 -0
- package/dist/lib/consts.js.map +1 -1
- package/dist/lib/lib.d.ts.map +1 -1
- package/dist/lib/lib.js +3 -3
- package/dist/lib/lib.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/lib/consts.ts +7 -0
- package/lib/lib.ts +4 -3
- package/package.json +61 -61
package/lib/consts.ts
CHANGED
|
@@ -16,3 +16,10 @@ export const TO_FINISH_WITH_OPTIONS: ToFinishWithOptionsWithDefaults = {
|
|
|
16
16
|
* Both the test runs and the vitest test specs should finish in this time - 1 hour
|
|
17
17
|
*/
|
|
18
18
|
export const DEFAULT_TEST_RUN_DURATION_MS = 60 * 60 * 1000; // 1 hour
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Delay before checking the dataset and statistics after a run finishes to resolve eventual consistency.
|
|
22
|
+
* - This value should ensure that the dataset and statistics are fully updated before any assertions are made.
|
|
23
|
+
* - Super rarely the platform is still not synced even after 10s, so 20s should be sufficient practically always.
|
|
24
|
+
*/
|
|
25
|
+
export const DATASET_SYNC_DELAY_MS = 20 * 1000; // 20 seconds
|
package/lib/lib.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ApifyClient } from 'apify-client';
|
|
|
3
3
|
import type { SuiteFactory, TestContext, TestFunction } from 'vitest';
|
|
4
4
|
import { describe as vitestDescribe, ExpectStatic, test as vitestTest } from 'vitest';
|
|
5
5
|
|
|
6
|
-
import { DEFAULT_TEST_RUN_DURATION_MS } from './consts.js';
|
|
6
|
+
import { DATASET_SYNC_DELAY_MS, DEFAULT_TEST_RUN_DURATION_MS } from './consts.js';
|
|
7
7
|
import { extendExpect } from './extend-expect.js';
|
|
8
8
|
import { RunTestResult } from './run-test-result.js';
|
|
9
9
|
import type { ActorBuild, ActorTestOptions, RunOptions } from './types.js';
|
|
@@ -61,6 +61,7 @@ export const testActor = <T>(
|
|
|
61
61
|
...DEFAULT_TEST_ACTOR_OPTIONS,
|
|
62
62
|
...testOptions,
|
|
63
63
|
};
|
|
64
|
+
|
|
64
65
|
const name = `${actorName}: ${testName}`;
|
|
65
66
|
const shouldRun = !!RUN_ALL_PLATFORM_TESTS || config.has(actorName);
|
|
66
67
|
vitestTest.runIf(shouldRun)(name, options, async <TYPE extends TestContext>(context: TYPE) => {
|
|
@@ -280,8 +281,8 @@ const createStartRunFn = <T>(actorNameOrId: string, testContext: TestContext) =>
|
|
|
280
281
|
actorName: actorNameOrId,
|
|
281
282
|
};
|
|
282
283
|
|
|
283
|
-
// waiting for
|
|
284
|
-
await sleep(
|
|
284
|
+
// waiting for dataset and statistics to sync, the Apify platform is only eventually consistent.
|
|
285
|
+
await sleep(DATASET_SYNC_DELAY_MS);
|
|
285
286
|
|
|
286
287
|
return new RunTestResult(apifyClient, run);
|
|
287
288
|
};
|
package/package.json
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
2
|
+
"name": "apify-test-tools",
|
|
3
|
+
"version": "0.8.7-beta.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "TBD",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/apify/apify-test-tools.git"
|
|
9
|
+
},
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=18.0.0"
|
|
12
|
+
},
|
|
13
|
+
"bin": {
|
|
14
|
+
"apify-test-tools": "dist/bin/main.js"
|
|
15
|
+
},
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"main": "./dist/lib/lib.js",
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@apify/consts": "^2.43.0",
|
|
20
|
+
"@slack/web-api": "^7.9.2",
|
|
21
|
+
"apify-client": "^2.22.2",
|
|
22
|
+
"yargs": "^18.0.0"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@apify/eslint-config": "^1.0.0",
|
|
26
|
+
"@apify/tsconfig": "^0.1.1",
|
|
27
|
+
"@types/node": "^24.0.0",
|
|
28
|
+
"@types/yargs": "^17.0.33",
|
|
29
|
+
"eslint": "^9.29.0",
|
|
30
|
+
"eslint-config-prettier": "^10.1.5",
|
|
31
|
+
"globals": "^17.0.0",
|
|
32
|
+
"prettier": "^3.5.3",
|
|
33
|
+
"tsx": "^4.20.3",
|
|
34
|
+
"typescript": "^5.9.3",
|
|
35
|
+
"typescript-eslint": "^8.34.1",
|
|
36
|
+
"vitest": "^3.2.4",
|
|
37
|
+
"knip": "^5.65.0",
|
|
38
|
+
"husky": "^9.0.11",
|
|
39
|
+
"lint-staged": "^15.2.2"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"vitest": ">=3.2.4"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"start": "npm run dist/bin/main.js",
|
|
46
|
+
"start:dev": "GITHUB_WORKSPACE=local-clone tsx bin/main.ts",
|
|
47
|
+
"build": "tsc && chmod +x ./dist/bin/main.js",
|
|
48
|
+
"lint": "eslint",
|
|
49
|
+
"lint:fix": "eslint --fix",
|
|
50
|
+
"format": "prettier --write .",
|
|
51
|
+
"format:check": "prettier --check .",
|
|
52
|
+
"type-check": "tsc --noEmit",
|
|
53
|
+
"test": "vitest run",
|
|
54
|
+
"check-unused": "npx knip",
|
|
55
|
+
"prepare": "husky .husky || true"
|
|
56
|
+
},
|
|
57
|
+
"lint-staged": {
|
|
58
|
+
"*.js": "eslint",
|
|
59
|
+
"*.ts": "eslint"
|
|
60
|
+
},
|
|
61
|
+
"author": "oklinov",
|
|
62
|
+
"license": "ISC"
|
|
63
63
|
}
|