node/test/fixtures/test-runner/output/test-runner-plan-timeout.js
Antoine du Hamel ad07869602
tools: enable linter in test/fixtures/test-runner/output
PR-URL: https://github.com/nodejs/node/pull/57698
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
2025-04-04 10:44:21 +02:00

76 lines
1.5 KiB
JavaScript

'use strict';
const { describe, it } = require('node:test');
describe('planning with wait', () => {
it('planning with wait and passing', async (t) => {
t.plan(1, { wait: 5000 });
const asyncActivity = () => {
setTimeout(() => {
t.assert.ok(true);
}, 250);
};
asyncActivity();
});
it('planning with wait and failing', async (t) => {
t.plan(1, { wait: 5000 });
const asyncActivity = () => {
setTimeout(() => {
t.assert.ok(false);
}, 250);
};
asyncActivity();
});
it('planning wait time expires before plan is met', async (t) => {
t.plan(2, { wait: 500 });
const asyncActivity = () => {
setTimeout(() => {
t.assert.ok(true);
}, 50_000_000);
};
asyncActivity();
});
it(`planning with wait "options.wait : true" and passing`, async (t) => {
t.plan(1, { wait: true });
const asyncActivity = () => {
setTimeout(() => {
t.assert.ok(true);
}, 250);
};
asyncActivity();
});
it(`planning with wait "options.wait : true" and failing`, async (t) => {
t.plan(1, { wait: true });
const asyncActivity = () => {
setTimeout(() => {
t.assert.ok(false);
}, 250);
};
asyncActivity();
});
it(`planning with wait "options.wait : false" should not wait`, async (t) => {
t.plan(1, { wait: false });
const asyncActivity = () => {
setTimeout(() => {
t.assert.ok(true);
}, 500_000);
};
asyncActivity();
});
});