Skip to content

Commit

Permalink
fix: node 20 skip text changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MoLow committed Sep 26, 2023
1 parent 8b93b60 commit 684a1fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions packages/testwatch/nodeVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
const [major, minor] = process.versions.node.split('.').map(Number);

module.exports = {
major,
minor,
isSupported: major > 20 || (major === 20 && minor >= 3) || (major === 18 && minor >= 17),
};
10 changes: 6 additions & 4 deletions packages/testwatch/tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { once } = require('node:events');
const assert = require('node:assert');
const path = require('node:path');
const chalk = require('chalk');
const { isSupported } = require('../nodeVersion');
const { isSupported, major, minor } = require('../nodeVersion');

const clear = '\x1Bc';
const esc = '\x1b';
Expand Down Expand Up @@ -38,6 +38,8 @@ Filter Test
const filterFilesPrompt = filterTestsPrompt.replace('test', 'file').replace('Test', 'File');
const debugOutput = process.env.DEBUG || process.argv.includes('--debug');

const skipText = major >= 20 && minor >= 7 ? '# test name does not match pattern' : '# SKIP';

function debug(str) {
if (debugOutput) {
const delimiter = chalk.bgWhite('--CLEAR--');
Expand Down Expand Up @@ -174,8 +176,8 @@ describe('testwatch', { concurrency: true, skip: !isSupported ? 'unsupported nod
'',
'',
`${tests
.replace('✔ j - sum (*ms)', '﹣ j - sum (*ms) # SKIP')
.replace('✔ index - sum (*ms)', '﹣ index - sum (*ms) # SKIP')
.replace('✔ j - sum (*ms)', `﹣ j - sum (*ms) ${skipText}`)
.replace('✔ index - sum (*ms)', `﹣ index - sum (*ms) ${skipText}`)
}\n${compactMenu}\n${clearLines}${activeFilters}${mainMenuWithFilters}\n`,
]);
});
Expand Down Expand Up @@ -238,7 +240,7 @@ describe('testwatch', { concurrency: true, skip: !isSupported ? 'unsupported nod
const activeFilters = '\nActive Filters: file name **/index*.*, test name /sum/\n';
assert.strictEqual(stderr, '');
assert.strictEqual(outputs.length, 11);
assert.strictEqual(outputs[10], `${testsRun[1].replace('✔ index - subtraction (*ms)', '﹣ index - subtraction (*ms) # SKIP')}\n${compactMenu}\n${clearLines}${activeFilters}${mainMenuWithFilters}\n`);
assert.strictEqual(outputs[10], `${testsRun[1].replace('✔ index - subtraction (*ms)', `﹣ index - subtraction (*ms) ${skipText}`)}\n${compactMenu}\n${clearLines}${activeFilters}${mainMenuWithFilters}\n`);
});

it('should mention when no files found', async () => {
Expand Down

0 comments on commit 684a1fe

Please sign in to comment.