Skip to content

Commit 5ad13ac

Browse files
committed
fix: allow absolute path
1 parent a5c5662 commit 5ad13ac

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/commands/actor/calculate-memory.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { join } from 'node:path';
1+
import { join, resolve } from 'node:path';
22
import process from 'node:process';
33

44
import { calculateRunDynamicMemory } from '@apify/actor-memory-expression';
@@ -76,7 +76,7 @@ export class ActorCalculateMemoryCommand extends ApifyCommand<typeof ActorCalcul
7676
}
7777

7878
// Let's not check for input existence here, as the expression might not use it at all.
79-
const inputPath = join(process.cwd(), this.flags.input);
79+
const inputPath = resolve(process.cwd(), this.flags.input);
8080
const inputJson = getJsonFileContent(inputPath) ?? {};
8181

8282
info({ message: `Evaluating memory expression: ${memoryExpression}` });

test/local/commands/actor/calculate-memory.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ describe('apify actor calculate-memory', () => {
5656

5757
it('should calculate memory using defaultMemoryMbytes flag', async () => {
5858
await testRunCommand(ActorCalculateMemoryCommand, {
59-
flags_input: `${getLocalKeyValueStorePath('default')}/INPUT.json`,
59+
flags_input: inputPath,
6060
flags_defaultMemoryMbytes: START_URLS_LENGTH_BASED_MEMORY_EXPRESSION,
6161
});
6262

@@ -67,7 +67,7 @@ describe('apify actor calculate-memory', () => {
6767
await createActorJson({ defaultMemoryMbytes: START_URLS_LENGTH_BASED_MEMORY_EXPRESSION });
6868

6969
await testRunCommand(ActorCalculateMemoryCommand, {
70-
flags_input: `${getLocalKeyValueStorePath('default')}/INPUT.json`,
70+
flags_input: inputPath,
7171
});
7272

7373
expect(lastLogMessage()).toMatch(/4096 MB/);

0 commit comments

Comments
 (0)