MCPcopy
hub / github.com/webpack/webpack / describeCases

Function describeCases

test/WatchTestCases.template.js:71–481  ·  view source on GitHub ↗
(config)

Source from the content-addressed store, hash-verified

69 * @param {SuiteConfig} config suite config
70 */
71const describeCases = (config) => {
72 describe(config.name, () => {
73 beforeAll(() => {
74 let dest = path.join(__dirname, "js");
75 if (!fs.existsSync(dest)) fs.mkdirSync(dest);
76 dest = path.join(__dirname, "js", `${config.name}-src`);
77 if (!fs.existsSync(dest)) fs.mkdirSync(dest);
78 });
79
80 if (process.env.NO_WATCH_TESTS) {
81 // eslint-disable-next-line jest/no-disabled-tests
82 it.skip("long running tests excluded", () => {});
83
84 return;
85 }
86
87 const casesPath = path.join(__dirname, "watchCases");
88 const categories = fs.readdirSync(casesPath).map((cat) => ({
89 name: cat,
90 tests: fs
91 .readdirSync(path.join(casesPath, cat))
92 .filter((folder) => !folder.includes("_"))
93 .filter((testName) => {
94 const testDirectory = path.join(casesPath, cat, testName);
95 const filterPath = path.join(testDirectory, "test.filter.js");
96 if (fs.existsSync(filterPath) && !require(filterPath)(config)) {
97 // eslint-disable-next-line jest/no-disabled-tests, jest/valid-describe-callback
98 describe.skip(testName, () => it("filtered", () => {}));
99
100 return false;
101 }
102 return true;
103 })
104 .sort()
105 }));
106
107 for (const category of categories) {
108 // eslint-disable-next-line jest/prefer-hooks-on-top, jest/no-duplicate-hooks
109 beforeAll(() => {
110 const dest = path.join(
111 __dirname,
112 "js",
113 `${config.name}-src`,
114 category.name
115 );
116 if (!fs.existsSync(dest)) fs.mkdirSync(dest);
117 });
118
119 describe(category.name, () => {
120 for (const testName of category.tests) {
121 describe(testName, () => {
122 const tempDirectory = path.join(
123 __dirname,
124 "js",
125 `${config.name}-src`,
126 category.name,
127 testName
128 );

Callers

nothing calls this directly

Calls 15

beforeAllFunction · 0.85
prepareOptionsFunction · 0.85
applyConfigFunction · 0.85
copyDiffFunction · 0.85
afterAllFunction · 0.85
sortMethod · 0.80
isArrayMethod · 0.80
entriesMethod · 0.80
tapMethod · 0.80
runBundlesMethod · 0.80
mergeModuleScopeMethod · 0.80
requireFunction · 0.70

Tested by

no test coverage detected