Skip to content

Commit bf487b5

Browse files
test: remove unuseful test
1 parent 70e28cb commit bf487b5

2 files changed

Lines changed: 0 additions & 149 deletions

File tree

test/__snapshots__/emit-option.test.js.snap

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,5 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`emit option should invalidate the cache with disabled "emit" option: assets 1`] = `
4-
Array [
5-
"main.js",
6-
"static/react.svg",
7-
]
8-
`;
9-
10-
exports[`emit option should invalidate the cache with disabled "emit" option: assets 2`] = `
11-
Array [
12-
"main.js",
13-
]
14-
`;
15-
16-
exports[`emit option should invalidate the cache with disabled "emit" option: emittedAssets 1`] = `
17-
Array [
18-
"main.js",
19-
"static/react.svg",
20-
]
21-
`;
22-
23-
exports[`emit option should invalidate the cache with disabled "emit" option: emittedAssets 2`] = `Array []`;
24-
25-
exports[`emit option should invalidate the cache with disabled "emit" option: errors 1`] = `Array []`;
26-
27-
exports[`emit option should invalidate the cache with disabled "emit" option: errors 2`] = `Array []`;
28-
29-
exports[`emit option should invalidate the cache with disabled "emit" option: warnings 1`] = `Array []`;
30-
31-
exports[`emit option should invalidate the cache with disabled "emit" option: warnings 2`] = `Array []`;
32-
333
exports[`emit option should work when emit option is "false": assets 1`] = `
344
Array [
355
"main.js",

test/emit-option.test.js

Lines changed: 0 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -361,123 +361,4 @@ describe("emit option", () => {
361361
});
362362
});
363363
});
364-
365-
it('should invalidate the cache with disabled "emit" option', async () => {
366-
class AssetsModifyPlugin {
367-
constructor(options = {}) {
368-
this.options = options;
369-
}
370-
371-
apply(compiler) {
372-
compiler.hooks.emit.tapAsync(
373-
"AssetsModifyPlugin",
374-
(compilation, callback) => {
375-
fs.writeFileSync(this.options.file, ".a{color: red;}");
376-
377-
callback();
378-
},
379-
);
380-
}
381-
}
382-
383-
const outputPath = path.resolve(__dirname, "./js/cache-memory-3");
384-
const modifyAsset = path.resolve(__dirname, "fixtures", "style-url.css");
385-
const modifyAssetContent = fs.readFileSync(modifyAsset);
386-
const webpackConfig = {
387-
mode: "development",
388-
context: path.resolve(__dirname, "fixtures"),
389-
cache: {
390-
type: "memory",
391-
},
392-
output: {
393-
path: outputPath,
394-
},
395-
entry: "./style-url.js",
396-
module: {
397-
rules: [
398-
{
399-
test: /\.css$/,
400-
use: [
401-
{
402-
loader: MiniCssExtractPlugin.loader,
403-
options: {
404-
emit: false,
405-
},
406-
},
407-
"css-loader",
408-
],
409-
},
410-
{
411-
test: /\.svg$/,
412-
type: "asset/resource",
413-
generator: {
414-
filename: "static/[name][ext][query]",
415-
},
416-
},
417-
],
418-
},
419-
plugins: [
420-
new MiniCssExtractPlugin({
421-
filename: "[name].css",
422-
}),
423-
new AssetsModifyPlugin({
424-
file: modifyAsset,
425-
}),
426-
],
427-
};
428-
429-
await del([outputPath]);
430-
431-
const compiler1 = webpack(webpackConfig);
432-
433-
await new Promise((resolve, reject) => {
434-
compiler1.run((error, stats) => {
435-
if (error) {
436-
reject(error);
437-
438-
return;
439-
}
440-
441-
compiler1.close(() => {
442-
expect(Object.keys(stats.compilation.assets).sort()).toMatchSnapshot(
443-
"assets",
444-
);
445-
expect([...stats.compilation.emittedAssets].sort()).toMatchSnapshot(
446-
"emittedAssets",
447-
);
448-
expect(getWarnings(stats)).toMatchSnapshot("warnings");
449-
expect(getErrors(stats)).toMatchSnapshot("errors");
450-
451-
resolve();
452-
});
453-
});
454-
});
455-
456-
const compiler2 = webpack(webpackConfig);
457-
458-
await new Promise((resolve, reject) => {
459-
compiler2.run((error, stats) => {
460-
if (error) {
461-
reject(error);
462-
463-
return;
464-
}
465-
466-
compiler2.close(() => {
467-
expect(Object.keys(stats.compilation.assets).sort()).toMatchSnapshot(
468-
"assets",
469-
);
470-
expect([...stats.compilation.emittedAssets].sort()).toMatchSnapshot(
471-
"emittedAssets",
472-
);
473-
expect(getWarnings(stats)).toMatchSnapshot("warnings");
474-
expect(getErrors(stats)).toMatchSnapshot("errors");
475-
476-
resolve();
477-
});
478-
});
479-
});
480-
481-
fs.writeFileSync(modifyAsset, modifyAssetContent);
482-
});
483364
});

0 commit comments

Comments
 (0)