Merge pull request #5461 from Tyriar/tyriar/glob
Remove need for glob module
This commit is contained in:
@@ -92,7 +92,6 @@
|
|||||||
"eslint-plugin-jsdoc": "^46.9.1",
|
"eslint-plugin-jsdoc": "^46.9.1",
|
||||||
"express": "^4.19.2",
|
"express": "^4.19.2",
|
||||||
"express-ws": "^5.0.2",
|
"express-ws": "^5.0.2",
|
||||||
"glob": "^13.0.0",
|
|
||||||
"jsdom": "^18.0.1",
|
"jsdom": "^18.0.1",
|
||||||
"mocha": "^10.1.0",
|
"mocha": "^10.1.0",
|
||||||
"mustache": "^4.2.0",
|
"mustache": "^4.2.0",
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as glob from 'glob';
|
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as os from 'os';
|
import * as os from 'os';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
@@ -15,7 +14,10 @@ import { IDisposable } from '@xterm/xterm';
|
|||||||
const COLS = 80;
|
const COLS = 80;
|
||||||
const ROWS = 25;
|
const ROWS = 25;
|
||||||
|
|
||||||
const TESTFILES = glob.sync('**/escape_sequence_files/*.in', { cwd: path.join(__dirname, '../..')});
|
const escapeSequenceFilesDir = path.join(__dirname, '../../fixtures/escape_sequence_files');
|
||||||
|
const TESTFILES = fs.readdirSync(escapeSequenceFilesDir)
|
||||||
|
.filter(f => f.endsWith('.in'))
|
||||||
|
.map(f => path.join(escapeSequenceFilesDir, f));
|
||||||
const SKIP_FILES = [
|
const SKIP_FILES = [
|
||||||
't0055-EL.in', // EL/ED handle cursor at cols differently (see #3362)
|
't0055-EL.in', // EL/ED handle cursor at cols differently (see #3362)
|
||||||
't0084-CBT.in',
|
't0084-CBT.in',
|
||||||
@@ -33,7 +35,7 @@ if (os.platform() === 'darwin') {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
// filter skipFilenames
|
// filter skipFilenames
|
||||||
const FILES = TESTFILES.filter(value => !SKIP_FILES.includes(value.split('/').slice(-1)[0]));
|
const FILES = TESTFILES.filter(value => !SKIP_FILES.includes(path.basename(value)));
|
||||||
|
|
||||||
describe('Escape Sequence Files', function(): void {
|
describe('Escape Sequence Files', function(): void {
|
||||||
this.timeout(1000);
|
this.timeout(1000);
|
||||||
@@ -62,7 +64,7 @@ describe('Escape Sequence Files', function(): void {
|
|||||||
});
|
});
|
||||||
|
|
||||||
for (const filename of FILES) {
|
for (const filename of FILES) {
|
||||||
(process.platform === 'win32' ? it.skip : it)(filename.split('/').slice(-1)[0], async () => {
|
(process.platform === 'win32' ? it.skip : it)(path.basename(filename), async () => {
|
||||||
// reset terminal and handler
|
// reset terminal and handler
|
||||||
if (customHandler) {
|
if (customHandler) {
|
||||||
customHandler.dispose();
|
customHandler.dispose();
|
||||||
@@ -88,7 +90,7 @@ describe('Escape Sequence Files', function(): void {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// compare with expected output (right trimmed)
|
// compare with expected output (right trimmed)
|
||||||
const expected = fs.readFileSync(filename.split('.')[0] + '.text', 'utf8');
|
const expected = fs.readFileSync(filename.replace(/\.in$/, '.text'), 'utf8');
|
||||||
const expectedRightTrimmed = expected.split('\n').map(l => l.replace(/\s+$/, '')).join('\n');
|
const expectedRightTrimmed = expected.split('\n').map(l => l.replace(/\s+$/, '')).join('\n');
|
||||||
if (content !== expectedRightTrimmed) {
|
if (content !== expectedRightTrimmed) {
|
||||||
throw new Error(formatError(fs.readFileSync(filename, 'utf8'), content, expected));
|
throw new Error(formatError(fs.readFileSync(filename, 'utf8'), content, expected));
|
||||||
|
|||||||
Reference in New Issue
Block a user