js-vitest template
small update for fix-jest-dom
This commit is contained in:
@@ -2,17 +2,17 @@ import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
const typesPath = path.resolve('node_modules', '@types', 'testing-library__jest-dom', 'index.d.ts');
|
||||
const refMatcher = /[\r\n]+\/\/\/ <reference types="jest" \/>/;
|
||||
|
||||
fs.readFile(typesPath, 'utf8', (err, data) => {
|
||||
if (err) throw err;
|
||||
|
||||
let lines = data.split('\n');
|
||||
|
||||
if (lines[8] === '/// <reference types="jest" />') {
|
||||
lines = lines.slice(0, 8).concat(lines.slice(9));
|
||||
}
|
||||
|
||||
fs.writeFile(typesPath, lines.join('\n'), 'utf8', function(err) {
|
||||
if (err) throw err;
|
||||
});
|
||||
fs.writeFile(
|
||||
typesPath,
|
||||
data.replace(refMatcher, ''),
|
||||
'utf8',
|
||||
function(err) {
|
||||
if (err) throw err;
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user