mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-13 00:57:53 +02:00
Fix Jest tests that fail on Windows (#896)
* Fix failing tests * Suppress build output in build tests
This commit is contained in:
parent
e27e18bd63
commit
3f896c8e18
3 changed files with 6 additions and 3 deletions
|
@ -28,7 +28,7 @@ let outputAssetsFiles = [];
|
|||
|
||||
function generateSite() {
|
||||
shell.cd('website');
|
||||
shell.exec('yarn build');
|
||||
shell.exec('yarn build', {silent: true});
|
||||
}
|
||||
|
||||
function clearBuildFolder() {
|
||||
|
|
|
@ -89,7 +89,8 @@ describe('getFile', () => {
|
|||
fs.existsSync = jest.fn().mockReturnValue(true);
|
||||
fs.readFileSync = jest.fn().mockImplementation(file => {
|
||||
const fakePath = file.replace(process.cwd().replace(/website$/, ''), '');
|
||||
return fakeContent[fakePath];
|
||||
const normalizedPath = fakePath.replace(/\\/g, '/');
|
||||
return fakeContent[normalizedPath];
|
||||
});
|
||||
|
||||
test('docs does not exist', () => {
|
||||
|
|
|
@ -17,8 +17,10 @@ function getSubDir(file, refDir) {
|
|||
}
|
||||
|
||||
function getLanguage(file, refDir) {
|
||||
const separator = escapeStringRegexp(path.sep);
|
||||
const baseDir = escapeStringRegexp(path.basename(refDir));
|
||||
const regexSubFolder = new RegExp(
|
||||
`${escapeStringRegexp(path.basename(refDir))}/(.*?)/.*`
|
||||
`${baseDir}${separator}(.*?)${separator}.*`
|
||||
);
|
||||
const match = regexSubFolder.exec(file);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue