Skip to content

Commit 83acecf

Browse files
committed
test: repair snapshot test
1 parent 6872b15 commit 83acecf

12 files changed

Lines changed: 56 additions & 15 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Loader Defaults 1`] = `
4+
"export default \`<section>Hello</section>
5+
\`"
6+
`;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<hello>Hello</hello>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import html from './fixture.html' // eslint-disable-line

test/helpers/compiler.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const output = (config) => {
4646

4747
module.exports = function (fixture, config, options) {
4848
config = {
49+
mode: 'development',
4950
devtool: config.devtool || 'sourcemap',
5051
context: path.resolve(__dirname, '..', 'fixtures'),
5152
entry: `./${fixture}`,

test/loader.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe('Loader', () => {
1313

1414
return webpack('fixture.js', config)
1515
.then((stats) => {
16-
const module = stats.toJson().modules[1]
16+
const [module] = stats.toJson().modules
1717

1818
expect(module.source).toMatchSnapshot()
1919
})
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Options config ctx - {Object} 1`] = `
4+
"export default \`<section>Hello</section>
5+
\`"
6+
`;
7+
8+
exports[`Options config path - {String} 1`] = `
9+
"export default \`<section>Hello</section>
10+
\`"
11+
`;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Options parser {Object} 1`] = `"export default \`<div>Hello</div>\`"`;
4+
5+
exports[`Options parser {String} 1`] = `"export default \`<div>Hello</div>\`"`;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Options plugins {Array} 1`] = `
4+
"export default \`<section>Hello</section>
5+
\`"
6+
`;
7+
8+
exports[`Options plugins {Function} - {Array} 1`] = `
9+
"export default \`<section>Hello</section>
10+
\`"
11+
`;
12+
13+
exports[`Options plugins {Function} - {Object} 1`] = `
14+
"export default \`<section>Hello</section>
15+
\`"
16+
`;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`Options render {Object} 1`] = `"throw new Error(\\"Module parse failed: Unexpected token (1:4)\\\\nYou may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders\\\\n> div Hello\\\\n| \\");"`;
3+
exports[`Options render {Object} 1`] = `"export default \`<hello>Hello</hello>\`"`;
44

5-
exports[`Options render {String} 1`] = `"throw new Error(\\"Module parse failed: Unexpected token (1:4)\\\\nYou may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders\\\\n> div Hello\\\\n| \\");"`;
5+
exports[`Options render {String} 1`] = `"export default \`<hello>Hello</hello>\`"`;

test/options/config.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describe('Options', () => {
1818

1919
return webpack('fixture.js', config)
2020
.then((stats) => {
21-
const module = stats.toJson().modules[1]
21+
const [module] = stats.toJson().modules
2222

2323
expect(module.source).toMatchSnapshot()
2424
})
@@ -40,7 +40,7 @@ describe('Options', () => {
4040

4141
return webpack('fixture.js', config)
4242
.then((stats) => {
43-
const module = stats.toJson().modules[1]
43+
const [module] = stats.toJson().modules
4444

4545
expect(module.source).toMatchSnapshot()
4646
})

0 commit comments

Comments
 (0)