Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
)
.toBeFalsy()
if (stats.hasErrors()) {
console.error(stats.compilation.errors)
}
// doesn't give any warning
expect(
stats.hasWarnings()
)
.toBeFalsy()
if (stats.hasWarnings()) {
console.log(stats.compilation.warnings)
}
const sitemap = stats.compilation.assets["sitemap.xml"]
if (!sitemap) {
console.log(stats.compilation.assets)
}
// should create a xml for the sitemap
expect(
sitemap && sitemap._value,
)
.toBeTruthy()
// should contain a filtred entry (urlset)
expect(
sitemap._value.includes("
const collection = minify(PhenomicLoaderWebpackPlugin.collection)
const { site_url, collectionOptions } = this.options || {}
if (!site_url) {
throw new Error(
"Missing `site_url` option in sitemap configuration. "
)
}
const sitemap = sm.createSitemap ({
hostname: site_url,
urls: enhanceCollection(collection, collectionOptions)
.map(item => ({ url: item.__url })),
})
compilation.assets["sitemap.xml"] = new RawSource(sitemap.toString())
callback()
})
})