This repository has been archived by the owner on Mar 17, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3981acc
commit e5fe4e8
Showing
28 changed files
with
503 additions
and
534 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`when applied with \`context\` option matches snapshot for \`{String}\` value 1`] = `"module.exports = __webpack_public_path__ + \\"9c87cbf3ba33126ffd25ae7f2f6bbafb.png\\";"`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`when applied with \`emitFile\` option matches snapshot for \`true\` (\`{Boolean}\`) (default) 1`] = `"64eababb117f90535085779cc0325003.svg"`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`errors validation errors 1`] = ` | ||
"File Loader Invalid Options | ||
options.useRelativePath should be boolean | ||
" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Loader Defaults 1`] = `"module.exports = __webpack_public_path__ + \\"9c87cbf3ba33126ffd25ae7f2f6bbafb.png\\";"`; | ||
exports[`loader should works without options 1`] = `"module.exports = __webpack_public_path__ + \\"9c87cbf3ba33126ffd25ae7f2f6bbafb.png\\";"`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`when applied with \`name\` option matches snapshot for \`{Function}\` value 1`] = `"module.exports = __webpack_public_path__ + \\"9c87cbf3ba33126ffd25ae7f2f6bbafb.png\\";"`; | ||
|
||
exports[`when applied with \`name\` option matches snapshot for \`{String}\` value 1`] = `"module.exports = __webpack_public_path__ + \\"9c87cbf3ba33126ffd25ae7f2f6bbafb.png\\";"`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import webpack from './helpers/compiler'; | ||
|
||
describe('when applied with `context` option', () => { | ||
it('matches snapshot for `{String}` value', async () => { | ||
const config = { | ||
loader: { | ||
test: /(png|jpg|svg)/, | ||
options: { | ||
context: `${__dirname}`, | ||
}, | ||
}, | ||
}; | ||
|
||
const stats = await webpack('fixture.js', config); | ||
const [module] = stats.toJson().modules; | ||
const { source } = module; | ||
|
||
expect(source).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import webpack from './helpers/compiler'; | ||
|
||
describe('when applied with `emitFile` option', () => { | ||
it('matches snapshot for `true` (`{Boolean}`) (default)', async () => { | ||
const config = { | ||
loader: { | ||
test: /(png|jpg|svg)/, | ||
options: { | ||
emitFile: true, | ||
}, | ||
}, | ||
}; | ||
|
||
const stats = await webpack('emitFile/fixture.js', config); | ||
const [, module] = stats.toJson().modules; | ||
const { assets } = module; | ||
|
||
expect(assets[0]).toMatchSnapshot(); | ||
}); | ||
|
||
it('matches snapshot for `false` value (`{Boolean}`)', async () => { | ||
const config = { | ||
loader: { | ||
test: /(png|jpg|svg)/, | ||
options: { | ||
emitFile: false, | ||
}, | ||
}, | ||
}; | ||
|
||
const stats = await webpack('emitFile/fixture.js', config); | ||
const [module] = stats.toJson().modules; | ||
const { assets } = module; | ||
|
||
// eslint-disable-next-line no-undefined | ||
expect(assets[0]).toBe(undefined); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import loader from '../src'; | ||
|
||
describe('errors', () => { | ||
it('validation errors', () => { | ||
const err = () => | ||
loader.call({ | ||
query: { useRelativePath: 1 }, | ||
emitFile: true, | ||
}); | ||
|
||
expect(err).toThrow(); | ||
expect(err).toThrowErrorMatchingSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import webpack from './helpers/compiler'; | ||
|
||
describe('when applied with `name` option', () => { | ||
it('matches snapshot for `{String}` value', async () => { | ||
const config = { | ||
loader: { | ||
test: /(png|jpg|svg)/, | ||
options: { | ||
name: '[hash].[ext]', | ||
}, | ||
}, | ||
}; | ||
|
||
const stats = await webpack('fixture.js', config); | ||
const [module] = stats.toJson().modules; | ||
const { source } = module; | ||
|
||
expect(source).toMatchSnapshot(); | ||
}); | ||
|
||
it('matches snapshot for `{Function}` value', async () => { | ||
const config = { | ||
loader: { | ||
test: /(png|jpg|svg)/, | ||
options: { | ||
name() { | ||
return '[hash].[ext]'; | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
const stats = await webpack('fixture.js', config); | ||
const [module] = stats.toJson().modules; | ||
const { source } = module; | ||
|
||
expect(source).toMatchSnapshot(); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.