Skip to content

Commit bd37a13

Browse files
committed
chore: re-order tests
1 parent 1584450 commit bd37a13

39 files changed

+314
-263
lines changed

.github/workflows/check.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,20 @@
33
name: Check
44

55
on:
6-
# Push to master will deploy a beta version
76
push:
87
branches: [master, renovate/**]
98
pull_request:
109
branches: [master]
1110

11+
env:
12+
LATEST_NODE_VERSION: 22
13+
LINUX_VERSION: ubuntu-latest
14+
WINDOWS_VERSION: windows-2025
15+
16+
concurrency:
17+
cancel-in-progress: false
18+
group: checks-${{ github.event_name }}
19+
1220
jobs:
1321
build_and_test:
1422
name: Build & Test
@@ -62,6 +70,7 @@ jobs:
6270
matrix:
6371
os: [ubuntu-latest, windows-2025]
6472
python-version: ["3.9", "3.10", "3.11", "3.12"]
73+
6574
runs-on: ${{ matrix.os }}
6675

6776
steps:

package.json

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
"scripts": {
99
"dev:apify": "tsx ./src/entrypoints/apify.ts",
1010
"dev:actor": "tsx ./src/entrypoints/actor.ts",
11-
"test": "vitest run",
12-
"test-python": "vitest run -t '.*\\[python\\]'",
11+
"test:all": "yarn test:local && yarn test:api",
12+
"test:local": "vitest run ./test/local",
13+
"test:api": "vitest run ./test/api",
14+
"test:python": "vitest run -t '\\[python\\]'",
1315
"test:cucumber": "cross-env NODE_OPTIONS=\"--import tsx\" cucumber-js",
1416
"lint": "eslint src test scripts features --ext .ts,.cjs,.mjs",
1517
"lint:fix": "eslint src test scripts features --fix --ext .ts,.cjs,.mjs",
@@ -151,6 +153,25 @@
151153
"yarn": "4.9.2"
152154
},
153155
"packageManager": "[email protected]",
156+
"devEngines": {
157+
"runtime": [
158+
{
159+
"name": "node",
160+
"version": ">= 20",
161+
"onFail": "error"
162+
},
163+
{
164+
"name": "bun",
165+
"version": ">= 1.2.5",
166+
"onFail": "ignore"
167+
}
168+
],
169+
"packageManager": {
170+
"name": "yarn",
171+
"version": ">= 4",
172+
"onFail": "download"
173+
}
174+
},
154175
"lint-staged": {
155176
"*": "biome format --write --no-errors-on-unmatched",
156177
"*.{mjs,js,ts}": "eslint --fix --ext mjs,js,ts",

scripts/generate-cli-docs.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ const categories: Record<string, CommandsInCategory[]> = {
6565
],
6666
'general': [
6767
//
68-
// { command: Commands.help },
68+
{ command: Commands.help },
69+
{ command: Commands.upgrade },
6970
],
7071
'dataset': [
7172
//

src/lib/hooks/useCLIVersionCheck.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ async function isOnline(timeout = 500) {
3131
),
3232
).catch(() => null);
3333

34+
clearTimeout(timeoutId);
35+
3436
if (!res) {
3537
cliDebugPrint('isOnline', { state: 'timeout' });
3638

3739
return false;
3840
}
3941

4042
if (res.ok) {
41-
clearTimeout(timeoutId);
42-
4343
cliDebugPrint('isOnline', {
4444
state: 'online',
4545
site: res.url,

test/__setup__/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import isCI from 'is-ci';
66
import { getApifyClientOptions } from '../../src/lib/utils.js';
77

88
const { TEST_USER_TOKEN: ENV_TEST_USER_TOKEN } = process.env;
9+
910
export const TEST_USER_BAD_TOKEN = 'badToken';
1011

1112
if (!ENV_TEST_USER_TOKEN) {

test/__setup__/hooks/useAuthSetup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const envVariable = '__APIFY_INTERNAL_TEST_AUTH_PATH__';
3030
/**
3131
* A hook that allows each test to have a unique auth setup.
3232
*/
33-
export function useAuthSetup({ cleanup, perTest }: UseAuthSetupOptions = { cleanup: true, perTest: true }) {
33+
export function useAuthSetup({ cleanup = true, perTest = true }: UseAuthSetupOptions = {}) {
3434
const random = cryptoRandomObjectId(12);
3535

3636
const envValue = () => (perTest ? cryptoRandomObjectId(12) : random);
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { platform } from 'node:os';
2+
3+
import { cryptoRandomObjectId } from '@apify/utilities';
4+
5+
export function useUniqueId(prefix: string) {
6+
return `${prefix}-${cryptoRandomObjectId(10)}-${platform()}`;
7+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { fileURLToPath } from 'node:url';
2+
3+
export const defaultsInputSchemaPath = fileURLToPath(new URL('./defaults.json', import.meta.url));
4+
5+
export const invalidInputSchemaPath = fileURLToPath(new URL('./invalid.json', import.meta.url));
6+
7+
export const missingRequiredPropertyInputSchemaPath = fileURLToPath(
8+
new URL('./missing-required-property.json', import.meta.url),
9+
);
10+
11+
export const prefillsInputSchemaPath = fileURLToPath(new URL('./prefills.json', import.meta.url));
12+
13+
export const unparsableInputSchemaPath = fileURLToPath(new URL('./unparsable.json', import.meta.url));
14+
15+
export const validInputSchemaPath = fileURLToPath(new URL('./valid.json', import.meta.url));

test/__setup__/test-data/paths.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { fileURLToPath } from 'node:url';
2+
3+
export const inputFilePath = fileURLToPath(new URL('./input-file.json', import.meta.url));

test/api/__fixtures__/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)