Answer the question
In order to leave comments, you need to log in
Is it possible to manually feed tests to jest?
Good day.
There is nodejs, jest and the desire to run the test manually. What I mean? Usually, jest'a tests are processed automatically by it, and it itself is launched from the command line. I would like it like this:
module.exports = async function checkStatus(browser, { url, status = null }) {
const page = await browser.newPage();
describe('Google', () => {
beforeAll(async () => {
await page.goto(url);
});
it('should be titled "Google"', async () => {
await expect(page.title()).resolves.toMatch('Google');
});
});
};
Answer the question
In order to leave comments, you need to log in
If I understand your question correctly, then:
const { exec } = require('child_process');
exec('yarn test -t "Google"', (err, stdout, stderr) => {
if (err) {
console.error(err);
return;
}
console.log(`stdout: ${stdout}`);
console.error(`stderr: ${stderr}`);
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question