Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
mikicho committed Jan 27, 2024
1 parent 459b31c commit 42df77b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions packages/testwatch/tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ REPL Usage
`;
const mainMenuWithFilters = mainMenu.replace('REPL Usage', `REPL Usage
› Press c to clear the filters.`);
const mainMenuWithPlugin = mainMenu.replace('REPL Usage', 'REPL Usage\n'
+ ' › Press s to suspend watch mode')
const compactMenu = '\nREPL Usage: Press w to show more.';
const filterTestsPrompt = `
Filter Test
Expand Down Expand Up @@ -84,7 +86,8 @@ async function spawnInteractive(commandSequence = 'q', args = []) {
stdout += data;
pending.stdout += data;
const s = pending.stdout;
if (s.includes(mainMenu) || s.includes(mainMenuWithFilters) || s.includes(compactMenu)) {
// TODO: can we check only the last line of each possible option?
if (s.includes(mainMenu) || s.includes(mainMenuWithFilters) || s.includes(compactMenu) || s.includes(mainMenuWithPlugin)) {
pending.resolve();
}
});
Expand All @@ -105,7 +108,6 @@ async function spawnInteractive(commandSequence = 'q', args = []) {
});
});
}

describe('testwatch', { concurrency: true, skip: !isSupported ? 'unsupported node version' : false }, () => {
it('should run all tests on initialization', async () => {
const { outputs, stderr } = await spawnInteractive('q');
Expand Down Expand Up @@ -297,10 +299,7 @@ describe('testwatch', { concurrency: true, skip: !isSupported ? 'unsupported nod
});
});

describe('Plugins', () => {
const mainMenuWithPlugin = mainMenu.replace('REPL Usage', 'REPL Usage\n'
+ ' › Press s to suspend watch mode')

describe('Plugins', () => {
it('should suspend the watch mode', async () => {
const { outputs, stderr } = await spawnInteractive(['s', '\r', 'q']);
assert.strictEqual(stderr, '');
Expand Down

0 comments on commit 42df77b

Please sign in to comment.