-
-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: generate custom manifest in light mode
- Loading branch information
Showing
12 changed files
with
203 additions
and
14 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 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,29 @@ | ||
const test = require('ava'); | ||
const path = require('path'); | ||
const fs = require('fs-extra'); | ||
const FaviconsWebpackPlugin = require('../'); | ||
|
||
const { logo, generate, mkdir, snapshotCompilationAssets } = require('./util'); | ||
|
||
test.beforeEach(async t => (t.context.root = await mkdir())); | ||
|
||
test('should generate a result with custom manifest values', async t => { | ||
const dist = path.join(t.context.root, 'dist'); | ||
const compilationStats = await generate({ | ||
context: t.context.root, | ||
output: { | ||
path: dist | ||
}, | ||
plugins: [ | ||
new FaviconsWebpackPlugin({ | ||
logo, | ||
mode: 'light', | ||
manifest: path.resolve(__dirname, './fixtures/manifest.json') | ||
}) | ||
] | ||
}); | ||
|
||
snapshotCompilationAssets(t, compilationStats); | ||
}); | ||
|
||
test.afterEach(t => fs.remove(t.context.root)); |
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 @@ | ||
const test = require('ava'); | ||
const path = require('path'); | ||
const fs = require('fs-extra'); | ||
const FaviconsWebpackPlugin = require('../'); | ||
|
||
const { logo, generate, mkdir, snapshotCompilationAssets } = require('./util'); | ||
|
||
test.beforeEach(async t => (t.context.root = await mkdir())); | ||
|
||
test('should generate a result with custom manifest values', async t => { | ||
const dist = path.join(t.context.root, 'dist'); | ||
const compilationStats = await generate({ | ||
context: t.context.root, | ||
output: { | ||
path: dist | ||
}, | ||
plugins: [ | ||
new FaviconsWebpackPlugin({ | ||
logo, | ||
mode: 'light', | ||
manifest: { | ||
name: 'FaviconsDemo', | ||
short_name: 'FaviconsDemo', | ||
description: 'Just a demo', | ||
dir: 'auto', | ||
lang: 'en', | ||
display: 'standalone', | ||
background_color: '#fff', | ||
theme_color: '#fff', | ||
orientation: null | ||
} | ||
}) | ||
] | ||
}); | ||
|
||
snapshotCompilationAssets(t, compilationStats); | ||
}); | ||
|
||
test.afterEach(t => fs.remove(t.context.root)); |
Binary file not shown.
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,42 @@ | ||
# Snapshot report for `test/manifest.light.file.test.js` | ||
|
||
The actual snapshot is saved in `manifest.light.file.test.js.snap`. | ||
|
||
Generated by [AVA](https://ava.li). | ||
|
||
## should generate a result with custom manifest values | ||
|
||
> Snapshot 1 | ||
[ | ||
'assets/favicon.png', | ||
'assets/manifest.json', | ||
'main.js', | ||
] | ||
|
||
> Snapshot 2 | ||
[ | ||
{ | ||
assetName: 'assets/favicon.png', | ||
content: 'png 874x989', | ||
}, | ||
{ | ||
assetName: 'assets/manifest.json', | ||
content: `{␊ | ||
"name": "FaviconsDemo",␊ | ||
"short_name": "FaviconsDemo",␊ | ||
"description": "A manifest used for unit-testing",␊ | ||
"dir": "auto",␊ | ||
"lang": "en",␊ | ||
"display": "standalone",␊ | ||
"background_color": "#fff",␊ | ||
"theme_color": "#fff",␊ | ||
"icons": [␊ | ||
{␊ | ||
"src": "favicon.png"␊ | ||
}␊ | ||
]␊ | ||
}`, | ||
}, | ||
] |
Binary file not shown.
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,42 @@ | ||
# Snapshot report for `test/manifest.light.test.js` | ||
|
||
The actual snapshot is saved in `manifest.light.test.js.snap`. | ||
|
||
Generated by [AVA](https://ava.li). | ||
|
||
## should generate a result with custom manifest values | ||
|
||
> Snapshot 1 | ||
[ | ||
'assets/favicon.png', | ||
'assets/manifest.json', | ||
'main.js', | ||
] | ||
|
||
> Snapshot 2 | ||
[ | ||
{ | ||
assetName: 'assets/favicon.png', | ||
content: 'png 874x989', | ||
}, | ||
{ | ||
assetName: 'assets/manifest.json', | ||
content: `{␊ | ||
"name": "FaviconsDemo",␊ | ||
"short_name": "FaviconsDemo",␊ | ||
"description": "Just a demo",␊ | ||
"dir": "auto",␊ | ||
"lang": "en",␊ | ||
"display": "standalone",␊ | ||
"background_color": "#fff",␊ | ||
"theme_color": "#fff",␊ | ||
"icons": [␊ | ||
{␊ | ||
"src": "favicon.png"␊ | ||
}␊ | ||
]␊ | ||
}`, | ||
}, | ||
] |
Binary file not shown.
Binary file not shown.
Binary file not shown.