mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-11 16:17:25 +02:00
chore: fix flaky tests (#8259)
This commit is contained in:
parent
5baa56b4bf
commit
9f4d2e7136
5 changed files with 10 additions and 10 deletions
3
jest.config.mjs
vendored
3
jest.config.mjs
vendored
|
@ -36,6 +36,9 @@ export default {
|
||||||
},
|
},
|
||||||
testEnvironment: 'node',
|
testEnvironment: 'node',
|
||||||
testPathIgnorePatterns: ignorePatterns,
|
testPathIgnorePatterns: ignorePatterns,
|
||||||
|
// Default 5s timeout often fails on Windows :s,
|
||||||
|
// see https://github.com/facebook/docusaurus/pull/8259
|
||||||
|
testTimeout: 15000,
|
||||||
coveragePathIgnorePatterns: [
|
coveragePathIgnorePatterns: [
|
||||||
...ignorePatterns,
|
...ignorePatterns,
|
||||||
// We also ignore all package entry points
|
// We also ignore all package entry points
|
||||||
|
|
|
@ -12,7 +12,7 @@ exports[`error prints objects 1`] = `
|
||||||
"[ERROR] 1,2,3",
|
"[ERROR] 1,2,3",
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"[ERROR] Sat Nov 13 2021 00:00:00 GMT+0000 (Coordinated Universal Time)",
|
"[ERROR] Sat, 13 Nov 2021 00:00:00 GMT",
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
`;
|
`;
|
||||||
|
@ -29,7 +29,7 @@ exports[`info prints objects 1`] = `
|
||||||
"[INFO] 1,2,3",
|
"[INFO] 1,2,3",
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"[INFO] Sat Nov 13 2021 00:00:00 GMT+0000 (Coordinated Universal Time)",
|
"[INFO] Sat, 13 Nov 2021 00:00:00 GMT",
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
`;
|
`;
|
||||||
|
@ -46,7 +46,7 @@ exports[`success prints objects 1`] = `
|
||||||
"[SUCCESS] 1,2,3",
|
"[SUCCESS] 1,2,3",
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"[SUCCESS] Sat Nov 13 2021 00:00:00 GMT+0000 (Coordinated Universal Time)",
|
"[SUCCESS] Sat, 13 Nov 2021 00:00:00 GMT",
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
`;
|
`;
|
||||||
|
@ -63,7 +63,7 @@ exports[`warn prints objects 1`] = `
|
||||||
"[WARNING] 1,2,3",
|
"[WARNING] 1,2,3",
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"[WARNING] Sat Nov 13 2021 00:00:00 GMT+0000 (Coordinated Universal Time)",
|
"[WARNING] Sat, 13 Nov 2021 00:00:00 GMT",
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
`;
|
`;
|
||||||
|
|
|
@ -60,6 +60,9 @@ function stringify(msg: unknown): string {
|
||||||
if (String(msg) === '[object Object]') {
|
if (String(msg) === '[object Object]') {
|
||||||
return JSON.stringify(msg);
|
return JSON.stringify(msg);
|
||||||
}
|
}
|
||||||
|
if (msg instanceof Date) {
|
||||||
|
return msg.toUTCString();
|
||||||
|
}
|
||||||
return String(msg);
|
return String(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,8 +34,6 @@ import type {
|
||||||
import type {LoadContext} from '@docusaurus/types';
|
import type {LoadContext} from '@docusaurus/types';
|
||||||
import type {Optional} from 'utility-types';
|
import type {Optional} from 'utility-types';
|
||||||
|
|
||||||
jest.setTimeout(15000);
|
|
||||||
|
|
||||||
const fixtureDir = path.join(__dirname, '__fixtures__');
|
const fixtureDir = path.join(__dirname, '__fixtures__');
|
||||||
|
|
||||||
const createFakeDocFile = ({
|
const createFakeDocFile = ({
|
||||||
|
|
|
@ -5,15 +5,11 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {jest} from '@jest/globals';
|
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import {extractThemeCodeMessages} from '../../src/utils';
|
import {extractThemeCodeMessages} from '../../src/utils';
|
||||||
|
|
||||||
// Seems the 5s default timeout fails sometimes
|
|
||||||
jest.setTimeout(15000);
|
|
||||||
|
|
||||||
describe('theme translations', () => {
|
describe('theme translations', () => {
|
||||||
it('has base messages files contain EXACTLY all the translations extracted from the theme. Please run "yarn workspace @docusaurus/theme-translations update" to keep base messages files up-to-date', async () => {
|
it('has base messages files contain EXACTLY all the translations extracted from the theme. Please run "yarn workspace @docusaurus/theme-translations update" to keep base messages files up-to-date', async () => {
|
||||||
const baseMessagesDirPath = path.join(__dirname, '../base');
|
const baseMessagesDirPath = path.join(__dirname, '../base');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue