diff --git a/package-lock.json b/package-lock.json index d5c1db5b5..a7320c1b7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35876,7 +35876,7 @@ "cross-spawn": "^7.0.1", "deepmerge": "^4.2.2", "getopts": "^2.3.0", - "glob": "^7.1.6", + "glob": "^8.0.0", "handlebars": "^4.7.6", "inquirer": "6.5.2", "json5": "^2.1.0", @@ -35917,6 +35917,43 @@ "node": ">= 8.0.0" } }, + "packages/gasket-cli/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "packages/gasket-cli/node_modules/glob": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz", + "integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "packages/gasket-cli/node_modules/minimatch": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz", + "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, "packages/gasket-data": { "name": "@gasket/data", "version": "6.34.6", @@ -36174,7 +36211,7 @@ "version": "6.34.6", "license": "MIT", "dependencies": { - "glob": "^7.1.6", + "glob": "^8.0.0", "lodash.defaultsdeep": "^4.6.1", "markdown-table": "^1.1.3", "mkdirp": "^1.0.4", @@ -36213,6 +36250,43 @@ "nyc": "^15.1.0" } }, + "packages/gasket-plugin-docs/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "packages/gasket-plugin-docs/node_modules/glob": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz", + "integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "packages/gasket-plugin-docs/node_modules/minimatch": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz", + "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, "packages/gasket-plugin-docsify": { "name": "@gasket/plugin-docsify", "version": "6.34.6", @@ -36220,7 +36294,7 @@ "dependencies": { "docsify": "^4.10.2", "docsify-cli": "^4.4.2", - "glob": "^7.1.6", + "glob": "^8.0.0", "handlebars": "^4.7.6", "lodash.defaultsdeep": "^4.6.1", "mkdirp": "^1.0.4" @@ -36240,6 +36314,43 @@ "sinon": "^14.0.0" } }, + "packages/gasket-plugin-docsify/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "packages/gasket-plugin-docsify/node_modules/glob": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz", + "integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "packages/gasket-plugin-docsify/node_modules/minimatch": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz", + "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, "packages/gasket-plugin-docusaurus": { "name": "@gasket/plugin-docusaurus", "version": "6.34.6", @@ -36292,7 +36403,7 @@ "compression": "^1.7.2", "cookie-parser": "^1.4.3", "diagnostics": "^2.0.2", - "glob": "^7.1.6", + "glob": "^8.0.0", "http2-express-bridge": "^1.0.7" }, "devDependencies": { @@ -36314,6 +36425,43 @@ "express": "^4.16.3" } }, + "packages/gasket-plugin-express/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "packages/gasket-plugin-express/node_modules/glob": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz", + "integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "packages/gasket-plugin-express/node_modules/minimatch": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz", + "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, "packages/gasket-plugin-fastify": { "name": "@gasket/plugin-fastify", "version": "6.34.6", @@ -40391,7 +40539,7 @@ "fancy-test": "^2.0.0", "fetch-mock": "^9.0.0", "getopts": "^2.3.0", - "glob": "^7.1.6", + "glob": "^8.0.0", "handlebars": "^4.7.6", "inquirer": "6.5.2", "json5": "^2.1.0", @@ -40408,6 +40556,36 @@ "std-mocks": "^1.0.1", "tar-fs": "^2.0.0", "untildify": "^4.0.0" + }, + "dependencies": { + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "requires": { + "balanced-match": "^1.0.0" + } + }, + "glob": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz", + "integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + } + }, + "minimatch": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz", + "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==", + "requires": { + "brace-expansion": "^2.0.1" + } + } } }, "@gasket/data": { @@ -40632,7 +40810,7 @@ "eslint-plugin-json": "^3.1.0", "eslint-plugin-mocha": "^10.0.3", "eslint-plugin-unicorn": "^44.0.0", - "glob": "^7.1.6", + "glob": "^8.0.0", "jsdoc-to-markdown": "^7.1.0", "lodash.defaultsdeep": "^4.6.1", "markdown-table": "^1.1.3", @@ -40642,6 +40820,36 @@ "proxyquire": "^2.1.3", "rimraf": "^3.0.2", "sinon": "^14.0.0" + }, + "dependencies": { + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "requires": { + "balanced-match": "^1.0.0" + } + }, + "glob": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz", + "integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + } + }, + "minimatch": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz", + "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==", + "requires": { + "brace-expansion": "^2.0.1" + } + } } }, "@gasket/plugin-docs-graphs": { @@ -40670,7 +40878,7 @@ "eslint-plugin-json": "^3.1.0", "eslint-plugin-mocha": "^10.0.3", "eslint-plugin-unicorn": "^44.0.0", - "glob": "^7.1.6", + "glob": "^8.0.0", "handlebars": "^4.7.6", "lodash.defaultsdeep": "^4.6.1", "mkdirp": "^1.0.4", @@ -40678,6 +40886,36 @@ "nyc": "^15.1.0", "proxyquire": "^2.1.3", "sinon": "^14.0.0" + }, + "dependencies": { + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "requires": { + "balanced-match": "^1.0.0" + } + }, + "glob": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz", + "integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + } + }, + "minimatch": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz", + "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==", + "requires": { + "brace-expansion": "^2.0.1" + } + } } }, "@gasket/plugin-docusaurus": { @@ -40731,12 +40969,42 @@ "eslint-plugin-mocha": "^10.0.3", "eslint-plugin-unicorn": "^44.0.0", "express": "^4.16.3", - "glob": "^7.1.6", + "glob": "^8.0.0", "http2-express-bridge": "^1.0.7", "mocha": "^10.0.0", "nyc": "^15.1.0", "proxyquire": "^2.1.3", "sinon": "^14.0.0" + }, + "dependencies": { + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "requires": { + "balanced-match": "^1.0.0" + } + }, + "glob": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz", + "integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + } + }, + "minimatch": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz", + "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==", + "requires": { + "brace-expansion": "^2.0.1" + } + } } }, "@gasket/plugin-fastify": { diff --git a/packages/gasket-cli/package.json b/packages/gasket-cli/package.json index 570c1581b..bcfb206f8 100644 --- a/packages/gasket-cli/package.json +++ b/packages/gasket-cli/package.json @@ -73,7 +73,7 @@ "cross-spawn": "^7.0.1", "deepmerge": "^4.2.2", "getopts": "^2.3.0", - "glob": "^7.1.6", + "glob": "^8.0.0", "handlebars": "^4.7.6", "inquirer": "6.5.2", "json5": "^2.1.0", diff --git a/packages/gasket-plugin-docs/package.json b/packages/gasket-plugin-docs/package.json index ac5188889..49b664f11 100644 --- a/packages/gasket-plugin-docs/package.json +++ b/packages/gasket-plugin-docs/package.json @@ -41,7 +41,7 @@ }, "homepage": "https://github.com/godaddy/gasket/tree/main/packages/gasket-plugin-docs", "dependencies": { - "glob": "^7.1.6", + "glob": "^8.0.0", "lodash.defaultsdeep": "^4.6.1", "markdown-table": "^1.1.3", "mkdirp": "^1.0.4", diff --git a/packages/gasket-plugin-docs/test/fixtures/files/file-a.md b/packages/gasket-plugin-docs/test/fixtures/files/file-a.md new file mode 100644 index 000000000..e69de29bb diff --git a/packages/gasket-plugin-docs/test/fixtures/files/file-b.md b/packages/gasket-plugin-docs/test/fixtures/files/file-b.md new file mode 100644 index 000000000..e69de29bb diff --git a/packages/gasket-plugin-docs/test/utils/config-set-builder.test.js b/packages/gasket-plugin-docs/test/utils/config-set-builder.test.js index c1b4b627e..17d8038de 100644 --- a/packages/gasket-plugin-docs/test/utils/config-set-builder.test.js +++ b/packages/gasket-plugin-docs/test/utils/config-set-builder.test.js @@ -3,30 +3,32 @@ const assume = require('assume'); const sinon = require('sinon'); const proxyquire = require('proxyquire'); const path = require('path'); +const { promisify } = require('util'); -const globStub = sinon.stub(); -const DocsConfigSetBuilder = proxyquire('../../lib/utils/config-set-builder', { - glob: globStub, - util: { - promisify: f => f - } -}); +const fixtures = path.resolve(__dirname, '..', 'fixtures'); -const { docsSetupDefault } = DocsConfigSetBuilder; +describe('utils - DocsConfigSetBuilder', () => { + let instance, DocsConfigSetBuilder, buildDocsConfigSpy, mockGasket, globSpy; -const buildDocsConfigSpy = sinon.spy(DocsConfigSetBuilder.prototype, '_buildDocsConfig'); + beforeEach(async () => { + DocsConfigSetBuilder = proxyquire('../../lib/utils/config-set-builder', { + util: { + promisify: f => { + globSpy = sinon.spy(promisify(f)); + return globSpy; + } + } + }); -const mockGasket = { - config: { - root: '/path/to/app', - docs: { outputDir: '.docs' } - } -}; + buildDocsConfigSpy = sinon.spy(DocsConfigSetBuilder.prototype, '_buildDocsConfig'); -describe('utils - DocsConfigSetBuilder', () => { - let instance; + mockGasket = { + config: { + root: '/path/to/app', + docs: { outputDir: '.docs' } + } + }; - beforeEach(async () => { sinon.resetHistory(); instance = new DocsConfigSetBuilder(mockGasket); }); @@ -69,7 +71,7 @@ describe('utils - DocsConfigSetBuilder', () => { it('uses default docsSetup if not passed', async () => { await instance.addApp({ name: 'app-one' }); - assume(buildDocsConfigSpy).calledWithMatch(sinon.match.object, docsSetupDefault); + assume(buildDocsConfigSpy).calledWithMatch(sinon.match.object, DocsConfigSetBuilder.docsSetupDefault); }); it('adds targetRoot to overrides', async () => { @@ -98,7 +100,7 @@ describe('utils - DocsConfigSetBuilder', () => { it('uses default docsSetup if not passed', async () => { await instance.addPlugin({ name: 'example-plugin' }); - assume(buildDocsConfigSpy).calledWithMatch(sinon.match.object, docsSetupDefault); + assume(buildDocsConfigSpy).calledWithMatch(sinon.match.object, DocsConfigSetBuilder.docsSetupDefault); }); it('accepts custom docsSetup', async () => { @@ -189,7 +191,7 @@ describe('utils - DocsConfigSetBuilder', () => { it('uses default docsSetup if not set', async () => { await instance.addPreset({ name: 'example-preset' }); - assume(buildDocsConfigSpy).calledWithMatch(sinon.match.object, docsSetupDefault); + assume(buildDocsConfigSpy).calledWithMatch(sinon.match.object, DocsConfigSetBuilder.docsSetupDefault); }); it('accepts custom docsSetup', async () => { @@ -256,7 +258,7 @@ describe('utils - DocsConfigSetBuilder', () => { it('does NOT use default docsSetup if not passed', async () => { await instance.addModule({ name: 'example-module' }); - assume(buildDocsConfigSpy).not.calledWith(sinon.match.object, docsSetupDefault); + assume(buildDocsConfigSpy).not.calledWith(sinon.match.object, DocsConfigSetBuilder.docsSetupDefault); assume(buildDocsConfigSpy).calledWith(sinon.match.object, {}); }); @@ -269,7 +271,7 @@ describe('utils - DocsConfigSetBuilder', () => { it('uses default docsSetup if not set for @gasket modules', async () => { await instance.addModule({ name: '@gasket/example' }); - assume(buildDocsConfigSpy).calledWith(sinon.match.object, docsSetupDefault); + assume(buildDocsConfigSpy).calledWith(sinon.match.object, DocsConfigSetBuilder.docsSetupDefault); }); it('accepts custom docsSetup', async () => { @@ -492,7 +494,7 @@ describe('utils - DocsConfigSetBuilder', () => { }); describe('._findAllFiles', () => { - const mockSourceRoot = '/path/to/example-module'; + const mockSourceRoot = fixtures; it('adds file from link', async () => { const results = await instance._findAllFiles({}, {}, 'README.md', mockSourceRoot); @@ -521,26 +523,25 @@ describe('utils - DocsConfigSetBuilder', () => { }); it('looks up files of docsSetup from sourceRoot', async () => { - const files = ['README.md', 'docs/**/*']; + const files = ['./files/*']; await instance._findAllFiles({}, { files }, null, mockSourceRoot); files.forEach(file => { - assume(globStub).calledWith(file, { cwd: mockSourceRoot }); + assume(globSpy).calledWith(file, { cwd: mockSourceRoot, nonegate: true, nocomment: true, allowWindowsEscape: true }); }); }); it('adds files from resolved globs', async () => { - const files = ['docs/**/*']; - const expected = ['docs/ONE.md', 'docs/TWO.md', 'docs/THREE.md']; - globStub.resolves(expected); + const files = ['./files/*']; + const expected = ['./files/file-a.md', './files/file-b.md']; const results = await instance._findAllFiles({}, { files }, null, mockSourceRoot); assume(results).eqls(expected); }); it('files can be a single string (for safety)', async () => { - const files = 'docs/**/*'; - const expected = ['docs/ONE.md', 'docs/TWO.md', 'docs/THREE.md']; + const files = './files/*'; + const expected = ['./files/file-a.md', './files/file-b.md']; const results = await instance._findAllFiles({}, { files }, null, mockSourceRoot); - assume(globStub).calledWith(files); + assume(globSpy).calledWith(files); assume(results).eqls(expected); }); @@ -575,7 +576,6 @@ describe('utils - DocsConfigSetBuilder', () => { }] }; const files = ['README.md']; - globStub.resolves(['README.md']); const results = await instance._findAllFiles(mockInfo, { files }, 'README.md#with-hash', mockSourceRoot); assume(results).lengthOf(1); assume(results).includes('README.md'); diff --git a/packages/gasket-plugin-docsify/package.json b/packages/gasket-plugin-docsify/package.json index 510cb3cf3..63ca64329 100644 --- a/packages/gasket-plugin-docsify/package.json +++ b/packages/gasket-plugin-docsify/package.json @@ -43,7 +43,7 @@ "dependencies": { "docsify": "^4.10.2", "docsify-cli": "^4.4.2", - "glob": "^7.1.6", + "glob": "^8.0.0", "handlebars": "^4.7.6", "lodash.defaultsdeep": "^4.6.1", "mkdirp": "^1.0.4" diff --git a/packages/gasket-plugin-docsify/test/generate-content.test.js b/packages/gasket-plugin-docsify/test/generate-content.test.js index 7972f0918..66686e81f 100644 --- a/packages/gasket-plugin-docsify/test/generate-content.test.js +++ b/packages/gasket-plugin-docsify/test/generate-content.test.js @@ -4,6 +4,7 @@ const sinon = require('sinon'); const proxyquire = require('proxyquire'); const { readFile } = require('fs').promises; const path = require('path'); +const { promisify } = require('util'); const template = readFile(path.join(__dirname, '..', 'generator', 'index.html'), 'utf8'); @@ -19,28 +20,30 @@ const mockDocsConfigSet = { }; const readFileStub = sinon.stub().resolves('mock-content'); -const globStub = sinon.stub().resolves(['favicon.ico']); const writeFileStub = sinon.stub(); const copyFileStub = sinon.stub(); const mkdirpStub = sinon.stub().resolves('/path/to/app'); -const generateContent = proxyquire('../lib/generate-content', { - fs: { - promises: { - readFile: readFileStub.resolves(template), - writeFile: writeFileStub, - copyFile: copyFileStub - } - }, - mkdirp: mkdirpStub, - glob: globStub, - util: { - promisify: f => f - } -}); describe('generateIndex', () => { + let generateContent, globSpy; beforeEach(() => { + generateContent = proxyquire('../lib/generate-content', { + fs: { + promises: { + readFile: readFileStub.resolves(template), + writeFile: writeFileStub, + copyFile: copyFileStub + } + }, + mkdirp: mkdirpStub, + util: { + promisify: f => { + globSpy = sinon.spy(promisify(f)); + return globSpy; + } + } + }); writeFileStub.resetHistory(); }); diff --git a/packages/gasket-plugin-express/package.json b/packages/gasket-plugin-express/package.json index a5a2a7054..f49df6c2a 100644 --- a/packages/gasket-plugin-express/package.json +++ b/packages/gasket-plugin-express/package.json @@ -45,7 +45,7 @@ "compression": "^1.7.2", "cookie-parser": "^1.4.3", "diagnostics": "^2.0.2", - "glob": "^7.1.6", + "glob": "^8.0.0", "http2-express-bridge": "^1.0.7" }, "devDependencies": {