-
Notifications
You must be signed in to change notification settings - Fork 142
Description
Tell us about your environment
- MarkBind Version: 1.15.2
What did you do? Please include the actual source code causing the issue.
While trying to implement #507 , I found that pages glob patterns in site.json may not be applied correctly in testing. Here's the diff I used to reproduce the issue:
diff --git a/src/Site.js b/src/Site.js
index 89e3b7b..c951158 100644
--- a/src/Site.js
+++ b/src/Site.js
@@ -60,11 +60,7 @@ const SITE_CONFIG_DEFAULT = {
],
pages: [
{
- src: 'index.md',
- title: 'Hello World',
- },
- {
- glob: '**/index.md',
+ glob: '**/*.md',
},
],
deploy: {
@@ -368,6 +364,7 @@ Site.prototype.collectAddressablePages = function () {
// Add pages collected by walkSync without duplication
this.addressablePages = _.unionWith(this.addressablePages, globPaths,
((pageA, pageB) => pageA.src === pageB.src));
+ console.log(this.addressablePages);
};
Site.prototype.collectBaseUrl = function () {
diff --git a/test/unit/utils/data.js b/test/unit/utils/data.js
index 82c2dad..88399cb 100644
--- a/test/unit/utils/data.js
+++ b/test/unit/utils/data.js
@@ -53,11 +53,7 @@ module.exports.SITE_JSON_DEFAULT = '{\n'
+ ' ],\n'
+ ' "pages": [\n'
+ ' {\n'
- + ' "src": "index.md",\n'
- + ' "title": "Hello World"\n'
- + ' },\n'
- + ' {\n'
- + ' "glob" : "**/index.md"\n'
+ + ' "glob" : "**/*.md"\n'
+ ' }\n'
+ ' ],\n'
+ ' "deploy": {\n'After applying, perform the following steps:
- Create a new site (
markbind init) and perform a build (markbind build). Note the output fromconsole.log(this.addressablePages)atSite.js#367. - Run unit tests (
npm run jest). Once again, note the output fromconsole.log(this.addressablePages)atSite.js#367.
What did you expect to happen?
The output of console.log(this.addressablePages) from both markbind build and npm run jest should be identical. Below is the output from markbind build:
[ { src: '_markbind/footers/footer.md',
searchable: undefined,
layout: undefined },
{ src: '_markbind/layouts/default/footer.md',
searchable: undefined,
layout: undefined },
{ src: '_markbind/layouts/default/head.md',
searchable: undefined,
layout: undefined },
{ src: '_markbind/layouts/default/navigation.md',
searchable: undefined,
layout: undefined },
{ src: '_markbind/navigation/site-nav.md',
searchable: undefined,
layout: undefined },
{ src: '_markbind/variables.md',
searchable: undefined,
layout: undefined },
{ src: 'index.md', searchable: undefined, layout: undefined } ]What actually happened? Please include the actual, raw output.
npm run jest produces different output even though both the test site and default site from markbind init are identical. Below is the output from npm run jest:
[ { src: '_markbind/layouts/default/footer.md',
searchable: undefined,
layout: undefined },
{ src: '_markbind/layouts/default/head.md',
searchable: undefined,
layout: undefined },
{ src: '_markbind/layouts/default/navigation.md',
searchable: undefined,
layout: undefined } ]Also note the difference in number of pages generated (7 from markbind build vs 3 from npm run jest).