Skip to content

Commit b389b4f

Browse files
test: persistent cache (#25)
1 parent aff77eb commit b389b4f

13 files changed

+165
-27
lines changed

test/CssMinimizerPlugin.test.js

+67-1
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,10 @@ describe('CssMinimizerPlugin', () => {
353353
test: /entry.js$/i,
354354
use: [
355355
{
356-
loader: path.resolve(__dirname, './helpers/preLoader'),
356+
loader: path.resolve(
357+
__dirname,
358+
'./helpers/emitAssetInChildCompilationLoader'
359+
),
357360
},
358361
],
359362
},
@@ -445,4 +448,67 @@ describe('CssMinimizerPlugin', () => {
445448
expect(getWarnings(stats)).toMatchSnapshot('warnings');
446449
}
447450
});
451+
452+
it('should work in watch mode', async () => {
453+
const compiler = getCompiler({
454+
entry: {
455+
foo: `${__dirname}/fixtures/simple.js`,
456+
},
457+
plugins: [],
458+
module: {
459+
rules: [
460+
{
461+
test: /.s?css$/i,
462+
use: ['css-loader'],
463+
},
464+
{
465+
test: /simple-emit.js$/i,
466+
loader: require.resolve('./helpers/emitAssetLoader.js'),
467+
},
468+
{
469+
test: /simple-emit-2.js$/i,
470+
loader: require.resolve('./helpers/emitAssetLoader2.js'),
471+
},
472+
],
473+
},
474+
});
475+
476+
new CssMinimizerPlugin().apply(compiler);
477+
478+
const stats = await compile(compiler);
479+
480+
if (getCompiler.isWebpack4()) {
481+
expect(
482+
Object.keys(stats.compilation.assets).filter(
483+
(assetName) => stats.compilation.assets[assetName].emitted
484+
).length
485+
).toBe(4);
486+
} else {
487+
expect(stats.compilation.emittedAssets.size).toBe(4);
488+
}
489+
490+
expect(readAssets(compiler, stats, '.css')).toMatchSnapshot('assets');
491+
expect(getWarnings(stats)).toMatchSnapshot('errors');
492+
expect(getErrors(stats)).toMatchSnapshot('warnings');
493+
494+
await new Promise(async (resolve) => {
495+
const newStats = await compile(compiler);
496+
497+
if (getCompiler.isWebpack4()) {
498+
expect(
499+
Object.keys(newStats.compilation.assets).filter(
500+
(assetName) => newStats.compilation.assets[assetName].emitted
501+
).length
502+
).toBe(0);
503+
} else {
504+
expect(newStats.compilation.emittedAssets.size).toBe(0);
505+
}
506+
507+
expect(readAssets(compiler, newStats, '.css')).toMatchSnapshot('assets');
508+
expect(getWarnings(newStats)).toMatchSnapshot('errors');
509+
expect(getErrors(newStats)).toMatchSnapshot('warnings');
510+
511+
resolve();
512+
});
513+
});
448514
});

test/__snapshots__/CssMinimizerPlugin.test.js.snap.webpack4

+22
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,28 @@ exports[`CssMinimizerPlugin should work and show minimized assets in stats: erro
6969

7070
exports[`CssMinimizerPlugin should work and show minimized assets in stats: warnings 1`] = `Array []`;
7171

72+
exports[`CssMinimizerPlugin should work in watch mode: assets 1`] = `
73+
Object {
74+
"style-2.css": "a{color:coral}",
75+
"style.css": "a{color:red}",
76+
}
77+
`;
78+
79+
exports[`CssMinimizerPlugin should work in watch mode: assets 2`] = `
80+
Object {
81+
"style-2.css": "a{color:coral}",
82+
"style.css": "a{color:red}",
83+
}
84+
`;
85+
86+
exports[`CssMinimizerPlugin should work in watch mode: errors 1`] = `Array []`;
87+
88+
exports[`CssMinimizerPlugin should work in watch mode: errors 2`] = `Array []`;
89+
90+
exports[`CssMinimizerPlugin should work in watch mode: warnings 1`] = `Array []`;
91+
92+
exports[`CssMinimizerPlugin should work in watch mode: warnings 2`] = `Array []`;
93+
7294
exports[`CssMinimizerPlugin should work with assets using querystring: entry.css.map?v=test 1`] = `"{\\"version\\":3,\\"sources\\": [replaced for tests], \\"names\\":[],\\"mappings\\":\\"AAAA,KACE,SACF,CACA,EACE,UACF\\",\\"file\\":\\"entry.css?v=test\\",\\"sourcesContent\\":[\\"body {\\\\n color: red;\\\\n}\\\\na {\\\\n color: blue;\\\\n}\\"],\\"sourceRoot\\":\\"\\"}"`;
7395

7496
exports[`CssMinimizerPlugin should work with assets using querystring: entry.css?v=test 1`] = `

test/__snapshots__/CssMinimizerPlugin.test.js.snap.webpack5

+23-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ exports[`CssMinimizerPlugin should respect the hash options #1: warnings 1`] = `
6161

6262
exports[`CssMinimizerPlugin should work and generate real content hash: assets 1`] = `
6363
Object {
64-
"entry.19e4764f9c1d9fe130e2.655a1d8e7614dda9272e.1afdccbeaec4b0402d74.css": "body{color:red}a{color:#00f}",
64+
"entry.19e4764f9c1d9fe130e2.2d6ce991710d63180e35.87eaf84ce322e15b3c17.css": "body{color:red}a{color:#00f}",
6565
}
6666
`;
6767

@@ -79,6 +79,28 @@ exports[`CssMinimizerPlugin should work and show minimized assets in stats: erro
7979

8080
exports[`CssMinimizerPlugin should work and show minimized assets in stats: warnings 1`] = `Array []`;
8181

82+
exports[`CssMinimizerPlugin should work in watch mode: assets 1`] = `
83+
Object {
84+
"style-2.css": "a{color:coral}",
85+
"style.css": "a{color:red}",
86+
}
87+
`;
88+
89+
exports[`CssMinimizerPlugin should work in watch mode: assets 2`] = `
90+
Object {
91+
"style-2.css": "a{color:coral}",
92+
"style.css": "a{color:red}",
93+
}
94+
`;
95+
96+
exports[`CssMinimizerPlugin should work in watch mode: errors 1`] = `Array []`;
97+
98+
exports[`CssMinimizerPlugin should work in watch mode: errors 2`] = `Array []`;
99+
100+
exports[`CssMinimizerPlugin should work in watch mode: warnings 1`] = `Array []`;
101+
102+
exports[`CssMinimizerPlugin should work in watch mode: warnings 2`] = `Array []`;
103+
82104
exports[`CssMinimizerPlugin should work with assets using querystring: entry.css.map?v=test 1`] = `"{\\"version\\":3,\\"sources\\": [replaced for tests], \\"names\\":[],\\"mappings\\":\\"AAAA,KACE,SACF,CACA,EACE,UACF\\",\\"file\\":\\"entry.css?v=test\\",\\"sourcesContent\\":[\\"body {\\\\n color: red;\\\\n}\\\\na {\\\\n color: blue;\\\\n}\\"],\\"sourceRoot\\":\\"\\"}"`;
83105

84106
exports[`CssMinimizerPlugin should work with assets using querystring: entry.css?v=test 1`] = `

test/__snapshots__/sourceMap-option.test.js.snap.webpack4

+7-7
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ Object {
3131
}
3232
`;
3333

34-
exports[`when applied with "sourceMap" option matches snapshot for "true" value, using previous sourcemap: entry.css.map 1`] = `"{\\"version\\":3,\\"sources\\": [replaced for tests], \\"names\\":[],\\"mappings\\":\\"AAAA,KACE,gBCEA,SDFiB,CCCnB,OAGI,iBAAkB\\",\\"file\\":\\"entry.css\\",\\"sourcesContent\\":[\\"body {\\\\n font-weight: bold;\\\\n}\\",\\"@import 'bar';\\\\n\\\\nbody {\\\\n color: red;\\\\n a {\\\\n text-align: center;\\\\n }\\\\n}\\"],\\"sourceRoot\\":\\"\\"}"`;
34+
exports[`when applied with "sourceMap" option matches snapshot for "true" value, using previous sourcemap: entry.css.map 1`] = `"{\\"version\\":3,\\"sources\\": [replaced for tests], \\"names\\":[],\\"mappings\\":\\"AAAA,KACE,eAAiB,CCEjB,SDFiB,CCCnB,OAGI,iBAAkB\\",\\"file\\":\\"entry.css\\",\\"sourcesContent\\":[\\"body {\\\\n font-weight: bold;\\\\n}\\",\\"@import 'bar';\\\\n\\\\nbody {\\\\n color: red;\\\\n a {\\\\n text-align: center;\\\\n }\\\\n}\\"],\\"sourceRoot\\":\\"\\"}"`;
3535

36-
exports[`when applied with "sourceMap" option matches snapshot for "true" value, using previous sourcemap: entry2.css.map 1`] = `"{\\"version\\":3,\\"sources\\": [replaced for tests], \\"names\\":[],\\"mappings\\":\\"AAAA,KACE,gBCEA,SDFiB,CCGlB,OAGC,iBAAkB\\",\\"file\\":\\"entry2.css\\",\\"sourcesContent\\":[\\"body {\\\\n font-weight: bold;\\\\n}\\",\\"@import 'bar';\\\\n\\\\nbody {\\\\n color: red;\\\\n}\\\\n\\\\nbody a {\\\\n text-align: center;\\\\n}\\"],\\"sourceRoot\\":\\"\\"}"`;
36+
exports[`when applied with "sourceMap" option matches snapshot for "true" value, using previous sourcemap: entry2.css.map 1`] = `"{\\"version\\":3,\\"sources\\": [replaced for tests], \\"names\\":[],\\"mappings\\":\\"AAAA,KACE,eAAiB,CCEjB,SDFiB,CCKnB,OACE,iBAAkB\\",\\"file\\":\\"entry2.css\\",\\"sourcesContent\\":[\\"body {\\\\n font-weight: bold;\\\\n}\\",\\"@import 'bar';\\\\n\\\\nbody {\\\\n color: red;\\\\n}\\\\n\\\\nbody a {\\\\n text-align: center;\\\\n}\\"],\\"sourceRoot\\":\\"\\"}"`;
3737

3838
exports[`when applied with "sourceMap" option matches snapshot for "true" value, using previous sourcemap: errors 1`] = `Array []`;
3939

@@ -48,9 +48,9 @@ Object {
4848
}
4949
`;
5050

51-
exports[`when applied with "sourceMap" option matches snapshot for "true" value, without previous sourcemap: entry.css.map 1`] = `"{\\"version\\":3,\\"sources\\": [replaced for tests], \\"names\\":[],\\"mappings\\":\\"AAAA,KACE,gBCEA,SDFiB,CCCnB,OAGI,iBAAkB\\",\\"file\\":\\"entry.css\\",\\"sourcesContent\\":[\\"body {\\\\n font-weight: bold;\\\\n}\\",\\"@import 'bar';\\\\n\\\\nbody {\\\\n color: red;\\\\n a {\\\\n text-align: center;\\\\n }\\\\n}\\"],\\"sourceRoot\\":\\"\\"}"`;
51+
exports[`when applied with "sourceMap" option matches snapshot for "true" value, without previous sourcemap: entry.css.map 1`] = `"{\\"version\\":3,\\"sources\\": [replaced for tests], \\"names\\":[],\\"mappings\\":\\"AAAA,KACE,eAAiB,CCEjB,SDFiB,CCCnB,OAGI,iBAAkB\\",\\"file\\":\\"entry.css\\",\\"sourcesContent\\":[\\"body {\\\\n font-weight: bold;\\\\n}\\",\\"@import 'bar';\\\\n\\\\nbody {\\\\n color: red;\\\\n a {\\\\n text-align: center;\\\\n }\\\\n}\\"],\\"sourceRoot\\":\\"\\"}"`;
5252

53-
exports[`when applied with "sourceMap" option matches snapshot for "true" value, without previous sourcemap: entry2.css.map 1`] = `"{\\"version\\":3,\\"sources\\": [replaced for tests], \\"names\\":[],\\"mappings\\":\\"AAAA,KACE,gBCEA,SDFiB,CCGlB,OAGC,iBAAkB\\",\\"file\\":\\"entry2.css\\",\\"sourcesContent\\":[\\"body {\\\\n font-weight: bold;\\\\n}\\",\\"@import 'bar';\\\\n\\\\nbody {\\\\n color: red;\\\\n}\\\\n\\\\nbody a {\\\\n text-align: center;\\\\n}\\"],\\"sourceRoot\\":\\"\\"}"`;
53+
exports[`when applied with "sourceMap" option matches snapshot for "true" value, without previous sourcemap: entry2.css.map 1`] = `"{\\"version\\":3,\\"sources\\": [replaced for tests], \\"names\\":[],\\"mappings\\":\\"AAAA,KACE,eAAiB,CCEjB,SDFiB,CCKnB,OACE,iBAAkB\\",\\"file\\":\\"entry2.css\\",\\"sourcesContent\\":[\\"body {\\\\n font-weight: bold;\\\\n}\\",\\"@import 'bar';\\\\n\\\\nbody {\\\\n color: red;\\\\n}\\\\n\\\\nbody a {\\\\n text-align: center;\\\\n}\\"],\\"sourceRoot\\":\\"\\"}"`;
5454

5555
exports[`when applied with "sourceMap" option matches snapshot for "true" value, without previous sourcemap: errors 1`] = `Array []`;
5656

@@ -67,17 +67,17 @@ Object {
6767

6868
exports[`when applied with "sourceMap" option matches snapshot when using SourceMapDevToolPlugin (with filename, publicPath and fileContext options): errors 1`] = `Array []`;
6969

70-
exports[`when applied with "sourceMap" option matches snapshot when using SourceMapDevToolPlugin (with filename, publicPath and fileContext options): sourcemaps/entry.css.map 1`] = `"{\\"version\\":3,\\"sources\\": [replaced for tests], \\"names\\":[],\\"mappings\\":\\"AAAA,KACE,gBCEA,SDFiB,CCCnB,OAGI,iBAAkB\\",\\"file\\":\\"dist/entry.css\\",\\"sourcesContent\\":[\\"body {\\\\n font-weight: bold;\\\\n}\\",\\"@import 'bar';\\\\n\\\\nbody {\\\\n color: red;\\\\n a {\\\\n text-align: center;\\\\n }\\\\n}\\"],\\"sourceRoot\\":\\"\\"}"`;
70+
exports[`when applied with "sourceMap" option matches snapshot when using SourceMapDevToolPlugin (with filename, publicPath and fileContext options): sourcemaps/entry.css.map 1`] = `"{\\"version\\":3,\\"sources\\": [replaced for tests], \\"names\\":[],\\"mappings\\":\\"AAAA,KACE,eAAiB,CCEjB,SDFiB,CCCnB,OAGI,iBAAkB\\",\\"file\\":\\"dist/entry.css\\",\\"sourcesContent\\":[\\"body {\\\\n font-weight: bold;\\\\n}\\",\\"@import 'bar';\\\\n\\\\nbody {\\\\n color: red;\\\\n a {\\\\n text-align: center;\\\\n }\\\\n}\\"],\\"sourceRoot\\":\\"\\"}"`;
7171

72-
exports[`when applied with "sourceMap" option matches snapshot when using SourceMapDevToolPlugin (with filename, publicPath and fileContext options): sourcemaps/entry2.css.map 1`] = `"{\\"version\\":3,\\"sources\\": [replaced for tests], \\"names\\":[],\\"mappings\\":\\"AAAA,KACE,gBCEA,SDFiB,CCGlB,OAGC,iBAAkB\\",\\"file\\":\\"dist/entry2.css\\",\\"sourcesContent\\":[\\"body {\\\\n font-weight: bold;\\\\n}\\",\\"@import 'bar';\\\\n\\\\nbody {\\\\n color: red;\\\\n}\\\\n\\\\nbody a {\\\\n text-align: center;\\\\n}\\"],\\"sourceRoot\\":\\"\\"}"`;
72+
exports[`when applied with "sourceMap" option matches snapshot when using SourceMapDevToolPlugin (with filename, publicPath and fileContext options): sourcemaps/entry2.css.map 1`] = `"{\\"version\\":3,\\"sources\\": [replaced for tests], \\"names\\":[],\\"mappings\\":\\"AAAA,KACE,eAAiB,CCEjB,SDFiB,CCKnB,OACE,iBAAkB\\",\\"file\\":\\"dist/entry2.css\\",\\"sourcesContent\\":[\\"body {\\\\n font-weight: bold;\\\\n}\\",\\"@import 'bar';\\\\n\\\\nbody {\\\\n color: red;\\\\n}\\\\n\\\\nbody a {\\\\n text-align: center;\\\\n}\\"],\\"sourceRoot\\":\\"\\"}"`;
7373

7474
exports[`when applied with "sourceMap" option matches snapshot when using SourceMapDevToolPlugin (with filename, publicPath and fileContext options): warnings 1`] = `Array []`;
7575

7676
exports[`when applied with "sourceMap" option should emit warning when broken sourcemap: errors 1`] = `
7777
Array [
7878
"Error: broken-source-map.css from Css Minimizer
7979
Error: \\"version\\" is a required argument.",
80-
"ModuleBuildError: Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
80+
"ModuleBuildError: Module build failed (from /node_modules/mini-css-extract-plugin/dist/loader.js):
8181
Error: broken-source-map.css from Css Minimizer",
8282
]
8383
`;

test/__snapshots__/sourceMap-option.test.js.snap.webpack5

+7-7
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ Object {
3131
}
3232
`;
3333

34-
exports[`when applied with "sourceMap" option matches snapshot for "true" value, using previous sourcemap: entry.css.map 1`] = `"{\\"version\\":3,\\"sources\\": [replaced for tests], \\"names\\":[],\\"mappings\\":\\"AAAA,KACE,gBCEA,SDFiB,CCCnB,OAGI,iBAAkB\\",\\"file\\":\\"entry.css\\",\\"sourcesContent\\":[\\"body {\\\\n font-weight: bold;\\\\n}\\",\\"@import 'bar';\\\\n\\\\nbody {\\\\n color: red;\\\\n a {\\\\n text-align: center;\\\\n }\\\\n}\\"],\\"sourceRoot\\":\\"\\"}"`;
34+
exports[`when applied with "sourceMap" option matches snapshot for "true" value, using previous sourcemap: entry.css.map 1`] = `"{\\"version\\":3,\\"sources\\": [replaced for tests], \\"names\\":[],\\"mappings\\":\\"AAAA,KACE,eAAiB,CCEjB,SDFiB,CCCnB,OAGI,iBAAkB\\",\\"file\\":\\"entry.css\\",\\"sourcesContent\\":[\\"body {\\\\n font-weight: bold;\\\\n}\\",\\"@import 'bar';\\\\n\\\\nbody {\\\\n color: red;\\\\n a {\\\\n text-align: center;\\\\n }\\\\n}\\"],\\"sourceRoot\\":\\"\\"}"`;
3535

36-
exports[`when applied with "sourceMap" option matches snapshot for "true" value, using previous sourcemap: entry2.css.map 1`] = `"{\\"version\\":3,\\"sources\\": [replaced for tests], \\"names\\":[],\\"mappings\\":\\"AAAA,KACE,gBCEA,SDFiB,CCGlB,OAGC,iBAAkB\\",\\"file\\":\\"entry2.css\\",\\"sourcesContent\\":[\\"body {\\\\n font-weight: bold;\\\\n}\\",\\"@import 'bar';\\\\n\\\\nbody {\\\\n color: red;\\\\n}\\\\n\\\\nbody a {\\\\n text-align: center;\\\\n}\\"],\\"sourceRoot\\":\\"\\"}"`;
36+
exports[`when applied with "sourceMap" option matches snapshot for "true" value, using previous sourcemap: entry2.css.map 1`] = `"{\\"version\\":3,\\"sources\\": [replaced for tests], \\"names\\":[],\\"mappings\\":\\"AAAA,KACE,eAAiB,CCEjB,SDFiB,CCKnB,OACE,iBAAkB\\",\\"file\\":\\"entry2.css\\",\\"sourcesContent\\":[\\"body {\\\\n font-weight: bold;\\\\n}\\",\\"@import 'bar';\\\\n\\\\nbody {\\\\n color: red;\\\\n}\\\\n\\\\nbody a {\\\\n text-align: center;\\\\n}\\"],\\"sourceRoot\\":\\"\\"}"`;
3737

3838
exports[`when applied with "sourceMap" option matches snapshot for "true" value, using previous sourcemap: errors 1`] = `Array []`;
3939

@@ -48,9 +48,9 @@ Object {
4848
}
4949
`;
5050

51-
exports[`when applied with "sourceMap" option matches snapshot for "true" value, without previous sourcemap: entry.css.map 1`] = `"{\\"version\\":3,\\"sources\\": [replaced for tests], \\"names\\":[],\\"mappings\\":\\"AAAA,KACE,gBCEA,SDFiB,CCCnB,OAGI,iBAAkB\\",\\"file\\":\\"entry.css\\",\\"sourcesContent\\":[\\"body {\\\\n font-weight: bold;\\\\n}\\",\\"@import 'bar';\\\\n\\\\nbody {\\\\n color: red;\\\\n a {\\\\n text-align: center;\\\\n }\\\\n}\\"],\\"sourceRoot\\":\\"\\"}"`;
51+
exports[`when applied with "sourceMap" option matches snapshot for "true" value, without previous sourcemap: entry.css.map 1`] = `"{\\"version\\":3,\\"sources\\": [replaced for tests], \\"names\\":[],\\"mappings\\":\\"AAAA,KACE,eAAiB,CCEjB,SDFiB,CCCnB,OAGI,iBAAkB\\",\\"file\\":\\"entry.css\\",\\"sourcesContent\\":[\\"body {\\\\n font-weight: bold;\\\\n}\\",\\"@import 'bar';\\\\n\\\\nbody {\\\\n color: red;\\\\n a {\\\\n text-align: center;\\\\n }\\\\n}\\"],\\"sourceRoot\\":\\"\\"}"`;
5252

53-
exports[`when applied with "sourceMap" option matches snapshot for "true" value, without previous sourcemap: entry2.css.map 1`] = `"{\\"version\\":3,\\"sources\\": [replaced for tests], \\"names\\":[],\\"mappings\\":\\"AAAA,KACE,gBCEA,SDFiB,CCGlB,OAGC,iBAAkB\\",\\"file\\":\\"entry2.css\\",\\"sourcesContent\\":[\\"body {\\\\n font-weight: bold;\\\\n}\\",\\"@import 'bar';\\\\n\\\\nbody {\\\\n color: red;\\\\n}\\\\n\\\\nbody a {\\\\n text-align: center;\\\\n}\\"],\\"sourceRoot\\":\\"\\"}"`;
53+
exports[`when applied with "sourceMap" option matches snapshot for "true" value, without previous sourcemap: entry2.css.map 1`] = `"{\\"version\\":3,\\"sources\\": [replaced for tests], \\"names\\":[],\\"mappings\\":\\"AAAA,KACE,eAAiB,CCEjB,SDFiB,CCKnB,OACE,iBAAkB\\",\\"file\\":\\"entry2.css\\",\\"sourcesContent\\":[\\"body {\\\\n font-weight: bold;\\\\n}\\",\\"@import 'bar';\\\\n\\\\nbody {\\\\n color: red;\\\\n}\\\\n\\\\nbody a {\\\\n text-align: center;\\\\n}\\"],\\"sourceRoot\\":\\"\\"}"`;
5454

5555
exports[`when applied with "sourceMap" option matches snapshot for "true" value, without previous sourcemap: errors 1`] = `Array []`;
5656

@@ -67,17 +67,17 @@ Object {
6767

6868
exports[`when applied with "sourceMap" option matches snapshot when using SourceMapDevToolPlugin (with filename, publicPath and fileContext options): errors 1`] = `Array []`;
6969

70-
exports[`when applied with "sourceMap" option matches snapshot when using SourceMapDevToolPlugin (with filename, publicPath and fileContext options): sourcemaps/entry.css.map 1`] = `"{\\"version\\":3,\\"sources\\": [replaced for tests], \\"names\\":[],\\"mappings\\":\\"AAAA,KACE,gBCEA,SDFiB,CCCnB,OAGI,iBAAkB\\",\\"file\\":\\"dist/entry.css\\",\\"sourcesContent\\":[\\"body {\\\\n font-weight: bold;\\\\n}\\",\\"@import 'bar';\\\\n\\\\nbody {\\\\n color: red;\\\\n a {\\\\n text-align: center;\\\\n }\\\\n}\\"],\\"sourceRoot\\":\\"\\"}"`;
70+
exports[`when applied with "sourceMap" option matches snapshot when using SourceMapDevToolPlugin (with filename, publicPath and fileContext options): sourcemaps/entry.css.map 1`] = `"{\\"version\\":3,\\"sources\\": [replaced for tests], \\"names\\":[],\\"mappings\\":\\"AAAA,KACE,eAAiB,CCEjB,SDFiB,CCCnB,OAGI,iBAAkB\\",\\"file\\":\\"dist/entry.css\\",\\"sourcesContent\\":[\\"body {\\\\n font-weight: bold;\\\\n}\\",\\"@import 'bar';\\\\n\\\\nbody {\\\\n color: red;\\\\n a {\\\\n text-align: center;\\\\n }\\\\n}\\"],\\"sourceRoot\\":\\"\\"}"`;
7171

72-
exports[`when applied with "sourceMap" option matches snapshot when using SourceMapDevToolPlugin (with filename, publicPath and fileContext options): sourcemaps/entry2.css.map 1`] = `"{\\"version\\":3,\\"sources\\": [replaced for tests], \\"names\\":[],\\"mappings\\":\\"AAAA,KACE,gBCEA,SDFiB,CCGlB,OAGC,iBAAkB\\",\\"file\\":\\"dist/entry2.css\\",\\"sourcesContent\\":[\\"body {\\\\n font-weight: bold;\\\\n}\\",\\"@import 'bar';\\\\n\\\\nbody {\\\\n color: red;\\\\n}\\\\n\\\\nbody a {\\\\n text-align: center;\\\\n}\\"],\\"sourceRoot\\":\\"\\"}"`;
72+
exports[`when applied with "sourceMap" option matches snapshot when using SourceMapDevToolPlugin (with filename, publicPath and fileContext options): sourcemaps/entry2.css.map 1`] = `"{\\"version\\":3,\\"sources\\": [replaced for tests], \\"names\\":[],\\"mappings\\":\\"AAAA,KACE,eAAiB,CCEjB,SDFiB,CCKnB,OACE,iBAAkB\\",\\"file\\":\\"dist/entry2.css\\",\\"sourcesContent\\":[\\"body {\\\\n font-weight: bold;\\\\n}\\",\\"@import 'bar';\\\\n\\\\nbody {\\\\n color: red;\\\\n}\\\\n\\\\nbody a {\\\\n text-align: center;\\\\n}\\"],\\"sourceRoot\\":\\"\\"}"`;
7373

7474
exports[`when applied with "sourceMap" option matches snapshot when using SourceMapDevToolPlugin (with filename, publicPath and fileContext options): warnings 1`] = `Array []`;
7575

7676
exports[`when applied with "sourceMap" option should emit warning when broken sourcemap: errors 1`] = `
7777
Array [
7878
"Error: broken-source-map.css from Css Minimizer
7979
Error: \\"version\\" is a required argument.",
80-
"ModuleBuildError: Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
80+
"ModuleBuildError: Module build failed (from ../../node_modules/mini-css-extract-plugin/dist/loader.js):
8181
Error: broken-source-map.css from Css Minimizer",
8282
]
8383
`;

test/fixtures/simple-async.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default 'bar';

test/fixtures/simple-emit-2.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default 'bar';

test/fixtures/simple-emit.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default 'foo';

0 commit comments

Comments
 (0)