Skip to content

Commit 00881d8

Browse files
committed
test: nut for test-run-id file
1 parent f606104 commit 00881d8

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/commands/apex/run/test.nut.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,20 @@ describe('apex run test', () => {
206206
execCmd(`apex:get:test -i ${result?.testRunId}`, { ensureExitCode: 0 });
207207
});
208208

209+
it('will save test-run-id file for async', async () => {
210+
const resultDir = 'asyncResults';
211+
const result = execCmd<TestRunIdResult>(`apex:run:test --json --output-dir ${resultDir}`, { ensureExitCode: 0 })
212+
.jsonOutput?.result;
213+
expect(result?.testRunId).to.be.a('string');
214+
expect(result?.testRunId.startsWith('707')).to.be.true;
215+
const outputDir = path.join(session.project.dir, resultDir);
216+
const testRunIdFile = path.join(outputDir, 'test-run-id.txt');
217+
expect(fs.existsSync(testRunIdFile)).to.be.true;
218+
expect(await fs.promises.readFile(testRunIdFile, 'utf-8')).equal(result?.testRunId);
219+
// get the test results to make sure it's not 'ALREADY IN PROGRESS' or 'QUEUED' for the next test
220+
execCmd(`apex:get:test -i ${result?.testRunId}`, { ensureExitCode: 0 });
221+
});
222+
209223
it('will run default tests and default async', async () => {
210224
const result = execCmd('apex:run:test', { ensureExitCode: 0 }).shellOutput.stdout;
211225
expect(result).to.include('apex get test -i 707');

0 commit comments

Comments
 (0)