mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-11-08 23:25:51 +01:00
feat: highlight readme source code (#3506)
* feat: highlight readme source code * chore: fix tests * Delete utils.spec.ts.snap
This commit is contained in:
parent
07144c9886
commit
8715a5cfa2
49
.pnp.cjs
generated
49
.pnp.cjs
generated
@ -78,10 +78,9 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
|||||||
["@verdaccio-scope/verdaccio-auth-foo", "npm:0.0.2"],\
|
["@verdaccio-scope/verdaccio-auth-foo", "npm:0.0.2"],\
|
||||||
["@verdaccio/commons-api", "npm:10.2.0"],\
|
["@verdaccio/commons-api", "npm:10.2.0"],\
|
||||||
["@verdaccio/local-storage", "npm:10.3.1"],\
|
["@verdaccio/local-storage", "npm:10.3.1"],\
|
||||||
["@verdaccio/readme", "npm:10.4.2"],\
|
|
||||||
["@verdaccio/streams", "npm:10.2.0"],\
|
["@verdaccio/streams", "npm:10.2.0"],\
|
||||||
["@verdaccio/types", "npm:10.7.0"],\
|
["@verdaccio/types", "npm:10.7.0"],\
|
||||||
["@verdaccio/ui-theme", "npm:6.0.0-6-next.50"],\
|
["@verdaccio/ui-theme", "npm:6.0.0-6-next.51"],\
|
||||||
["JSONStream", "npm:1.3.5"],\
|
["JSONStream", "npm:1.3.5"],\
|
||||||
["all-contributors-cli", "npm:6.20.0"],\
|
["all-contributors-cli", "npm:6.20.0"],\
|
||||||
["async", "npm:3.2.4"],\
|
["async", "npm:3.2.4"],\
|
||||||
@ -4845,18 +4844,6 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
|||||||
"linkType": "HARD"\
|
"linkType": "HARD"\
|
||||||
}]\
|
}]\
|
||||||
]],\
|
]],\
|
||||||
["@verdaccio/readme", [\
|
|
||||||
["npm:10.4.2", {\
|
|
||||||
"packageLocation": "./.yarn/cache/@verdaccio-readme-npm-10.4.2-2cca0c072d-73492f1137.zip/node_modules/@verdaccio/readme/",\
|
|
||||||
"packageDependencies": [\
|
|
||||||
["@verdaccio/readme", "npm:10.4.2"],\
|
|
||||||
["dompurify", "npm:2.4.0"],\
|
|
||||||
["jsdom", "virtual:2cca0c072d54eb622535386134c131ff0320958b9ce0515b5a1e0aef7ea16a35e036ec0ef2d2625d264420121ebbd88b85bd24e2b5bdc2d4f075f9beaf958114#npm:16.7.0"],\
|
|
||||||
["marked", "npm:4.2.2"]\
|
|
||||||
],\
|
|
||||||
"linkType": "HARD"\
|
|
||||||
}]\
|
|
||||||
]],\
|
|
||||||
["@verdaccio/streams", [\
|
["@verdaccio/streams", [\
|
||||||
["npm:10.2.0", {\
|
["npm:10.2.0", {\
|
||||||
"packageLocation": "./.yarn/cache/@verdaccio-streams-npm-10.2.0-81db112291-2c5fd4953f.zip/node_modules/@verdaccio/streams/",\
|
"packageLocation": "./.yarn/cache/@verdaccio-streams-npm-10.2.0-81db112291-2c5fd4953f.zip/node_modules/@verdaccio/streams/",\
|
||||||
@ -4876,10 +4863,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
|||||||
}]\
|
}]\
|
||||||
]],\
|
]],\
|
||||||
["@verdaccio/ui-theme", [\
|
["@verdaccio/ui-theme", [\
|
||||||
["npm:6.0.0-6-next.50", {\
|
["npm:6.0.0-6-next.51", {\
|
||||||
"packageLocation": "./.yarn/cache/@verdaccio-ui-theme-npm-6.0.0-6-next.50-635b2acf02-1e7ac1608f.zip/node_modules/@verdaccio/ui-theme/",\
|
"packageLocation": "./.yarn/cache/@verdaccio-ui-theme-npm-6.0.0-6-next.51-7dbd590283-b478cb7cd8.zip/node_modules/@verdaccio/ui-theme/",\
|
||||||
"packageDependencies": [\
|
"packageDependencies": [\
|
||||||
["@verdaccio/ui-theme", "npm:6.0.0-6-next.50"]\
|
["@verdaccio/ui-theme", "npm:6.0.0-6-next.51"]\
|
||||||
],\
|
],\
|
||||||
"linkType": "HARD"\
|
"linkType": "HARD"\
|
||||||
}]\
|
}]\
|
||||||
@ -7296,15 +7283,6 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
|||||||
"linkType": "HARD"\
|
"linkType": "HARD"\
|
||||||
}]\
|
}]\
|
||||||
]],\
|
]],\
|
||||||
["dompurify", [\
|
|
||||||
["npm:2.4.0", {\
|
|
||||||
"packageLocation": "./.yarn/cache/dompurify-npm-2.4.0-0ffecf22ef-c93ea73cf8.zip/node_modules/dompurify/",\
|
|
||||||
"packageDependencies": [\
|
|
||||||
["dompurify", "npm:2.4.0"]\
|
|
||||||
],\
|
|
||||||
"linkType": "HARD"\
|
|
||||||
}]\
|
|
||||||
]],\
|
|
||||||
["dot-prop", [\
|
["dot-prop", [\
|
||||||
["npm:5.3.0", {\
|
["npm:5.3.0", {\
|
||||||
"packageLocation": "./.yarn/cache/dot-prop-npm-5.3.0-7bf6ee1eb8-d577579009.zip/node_modules/dot-prop/",\
|
"packageLocation": "./.yarn/cache/dot-prop-npm-5.3.0-7bf6ee1eb8-d577579009.zip/node_modules/dot-prop/",\
|
||||||
@ -10297,7 +10275,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
|||||||
["@types/node", "npm:18.11.9"],\
|
["@types/node", "npm:18.11.9"],\
|
||||||
["jest-mock", "npm:26.6.2"],\
|
["jest-mock", "npm:26.6.2"],\
|
||||||
["jest-util", "npm:26.6.2"],\
|
["jest-util", "npm:26.6.2"],\
|
||||||
["jsdom", "virtual:2cca0c072d54eb622535386134c131ff0320958b9ce0515b5a1e0aef7ea16a35e036ec0ef2d2625d264420121ebbd88b85bd24e2b5bdc2d4f075f9beaf958114#npm:16.7.0"]\
|
["jsdom", "virtual:defa486869c88441047200a53b3aa18d79743b272095f3ee31b5b7b80b2c93d87f722added867470dcb94104504489a1a89040ea8fd89dffb9cfb1864d4bf54e#npm:16.7.0"]\
|
||||||
],\
|
],\
|
||||||
"linkType": "HARD"\
|
"linkType": "HARD"\
|
||||||
}]\
|
}]\
|
||||||
@ -10706,10 +10684,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
|||||||
],\
|
],\
|
||||||
"linkType": "SOFT"\
|
"linkType": "SOFT"\
|
||||||
}],\
|
}],\
|
||||||
["virtual:2cca0c072d54eb622535386134c131ff0320958b9ce0515b5a1e0aef7ea16a35e036ec0ef2d2625d264420121ebbd88b85bd24e2b5bdc2d4f075f9beaf958114#npm:16.7.0", {\
|
["virtual:defa486869c88441047200a53b3aa18d79743b272095f3ee31b5b7b80b2c93d87f722added867470dcb94104504489a1a89040ea8fd89dffb9cfb1864d4bf54e#npm:16.7.0", {\
|
||||||
"packageLocation": "./.yarn/__virtual__/jsdom-virtual-518970426e/0/cache/jsdom-npm-16.7.0-216c5c4bf9-454b833718.zip/node_modules/jsdom/",\
|
"packageLocation": "./.yarn/__virtual__/jsdom-virtual-d1d747a211/0/cache/jsdom-npm-16.7.0-216c5c4bf9-454b833718.zip/node_modules/jsdom/",\
|
||||||
"packageDependencies": [\
|
"packageDependencies": [\
|
||||||
["jsdom", "virtual:2cca0c072d54eb622535386134c131ff0320958b9ce0515b5a1e0aef7ea16a35e036ec0ef2d2625d264420121ebbd88b85bd24e2b5bdc2d4f075f9beaf958114#npm:16.7.0"],\
|
["jsdom", "virtual:defa486869c88441047200a53b3aa18d79743b272095f3ee31b5b7b80b2c93d87f722added867470dcb94104504489a1a89040ea8fd89dffb9cfb1864d4bf54e#npm:16.7.0"],\
|
||||||
["@types/canvas", null],\
|
["@types/canvas", null],\
|
||||||
["abab", "npm:2.0.6"],\
|
["abab", "npm:2.0.6"],\
|
||||||
["acorn", "npm:8.8.1"],\
|
["acorn", "npm:8.8.1"],\
|
||||||
@ -10737,7 +10715,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
|||||||
["whatwg-encoding", "npm:1.0.5"],\
|
["whatwg-encoding", "npm:1.0.5"],\
|
||||||
["whatwg-mimetype", "npm:2.3.0"],\
|
["whatwg-mimetype", "npm:2.3.0"],\
|
||||||
["whatwg-url", "npm:8.7.0"],\
|
["whatwg-url", "npm:8.7.0"],\
|
||||||
["ws", "virtual:518970426e110e331af0e7205d87d1c860793eb156872ced507847acefb38dfa48c3ea74c9df56d29d4234e2bd5eca7283af0febbf0cbaac05abb89f24498f34#npm:7.5.9"],\
|
["ws", "virtual:d1d747a211d62a20e750f460de660a2cab0b8c26eed5e86aa53c81e5d6991bfbf78edfb74d516e5d88a3b849de28b88871ffac8dc80d6c59707fedfeaf750a82#npm:7.5.9"],\
|
||||||
["xml-name-validator", "npm:3.0.0"]\
|
["xml-name-validator", "npm:3.0.0"]\
|
||||||
],\
|
],\
|
||||||
"packagePeers": [\
|
"packagePeers": [\
|
||||||
@ -15294,10 +15272,9 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
|||||||
["@verdaccio-scope/verdaccio-auth-foo", "npm:0.0.2"],\
|
["@verdaccio-scope/verdaccio-auth-foo", "npm:0.0.2"],\
|
||||||
["@verdaccio/commons-api", "npm:10.2.0"],\
|
["@verdaccio/commons-api", "npm:10.2.0"],\
|
||||||
["@verdaccio/local-storage", "npm:10.3.1"],\
|
["@verdaccio/local-storage", "npm:10.3.1"],\
|
||||||
["@verdaccio/readme", "npm:10.4.2"],\
|
|
||||||
["@verdaccio/streams", "npm:10.2.0"],\
|
["@verdaccio/streams", "npm:10.2.0"],\
|
||||||
["@verdaccio/types", "npm:10.7.0"],\
|
["@verdaccio/types", "npm:10.7.0"],\
|
||||||
["@verdaccio/ui-theme", "npm:6.0.0-6-next.50"],\
|
["@verdaccio/ui-theme", "npm:6.0.0-6-next.51"],\
|
||||||
["JSONStream", "npm:1.3.5"],\
|
["JSONStream", "npm:1.3.5"],\
|
||||||
["all-contributors-cli", "npm:6.20.0"],\
|
["all-contributors-cli", "npm:6.20.0"],\
|
||||||
["async", "npm:3.2.4"],\
|
["async", "npm:3.2.4"],\
|
||||||
@ -15650,10 +15627,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
|||||||
],\
|
],\
|
||||||
"linkType": "SOFT"\
|
"linkType": "SOFT"\
|
||||||
}],\
|
}],\
|
||||||
["virtual:518970426e110e331af0e7205d87d1c860793eb156872ced507847acefb38dfa48c3ea74c9df56d29d4234e2bd5eca7283af0febbf0cbaac05abb89f24498f34#npm:7.5.9", {\
|
["virtual:d1d747a211d62a20e750f460de660a2cab0b8c26eed5e86aa53c81e5d6991bfbf78edfb74d516e5d88a3b849de28b88871ffac8dc80d6c59707fedfeaf750a82#npm:7.5.9", {\
|
||||||
"packageLocation": "./.yarn/__virtual__/ws-virtual-9ffc40a239/0/cache/ws-npm-7.5.9-26f12a5ed6-c3c100a181.zip/node_modules/ws/",\
|
"packageLocation": "./.yarn/__virtual__/ws-virtual-1d5cf10b03/0/cache/ws-npm-7.5.9-26f12a5ed6-c3c100a181.zip/node_modules/ws/",\
|
||||||
"packageDependencies": [\
|
"packageDependencies": [\
|
||||||
["ws", "virtual:518970426e110e331af0e7205d87d1c860793eb156872ced507847acefb38dfa48c3ea74c9df56d29d4234e2bd5eca7283af0febbf0cbaac05abb89f24498f34#npm:7.5.9"],\
|
["ws", "virtual:d1d747a211d62a20e750f460de660a2cab0b8c26eed5e86aa53c81e5d6991bfbf78edfb74d516e5d88a3b849de28b88871ffac8dc80d6c59707fedfeaf750a82#npm:7.5.9"],\
|
||||||
["@types/bufferutil", null],\
|
["@types/bufferutil", null],\
|
||||||
["@types/utf-8-validate", null],\
|
["@types/utf-8-validate", null],\
|
||||||
["bufferutil", null],\
|
["bufferutil", null],\
|
||||||
|
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/@verdaccio-ui-theme-npm-6.0.0-6-next.51-7dbd590283-b478cb7cd8.zip
vendored
Normal file
BIN
.yarn/cache/@verdaccio-ui-theme-npm-6.0.0-6-next.51-7dbd590283-b478cb7cd8.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
@ -6,11 +6,12 @@ ENV NODE_ENV=production \
|
|||||||
CI=true \
|
CI=true \
|
||||||
HUSKY_DEBUG=1
|
HUSKY_DEBUG=1
|
||||||
|
|
||||||
RUN apk --no-cache add openssl ca-certificates wget && \
|
RUN apk add --force-overwrite && \
|
||||||
|
apk --no-cache add openssl ca-certificates wget && \
|
||||||
apk --no-cache add g++ gcc libgcc libstdc++ linux-headers make python3 && \
|
apk --no-cache add g++ gcc libgcc libstdc++ linux-headers make python3 && \
|
||||||
wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub && \
|
wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub && \
|
||||||
wget -q https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.29-r0/glibc-2.29-r0.apk && \
|
wget -q https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.35-r0/glibc-2.35-r0.apk && \
|
||||||
apk add glibc-2.29-r0.apk
|
apk add --force-overwrite glibc-2.35-r0.apk
|
||||||
|
|
||||||
WORKDIR /opt/verdaccio-build
|
WORKDIR /opt/verdaccio-build
|
||||||
COPY . .
|
COPY . .
|
||||||
|
@ -20,9 +20,8 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@verdaccio/commons-api": "10.2.0",
|
"@verdaccio/commons-api": "10.2.0",
|
||||||
"@verdaccio/local-storage": "10.3.1",
|
"@verdaccio/local-storage": "10.3.1",
|
||||||
"@verdaccio/readme": "10.4.2",
|
|
||||||
"@verdaccio/streams": "10.2.0",
|
"@verdaccio/streams": "10.2.0",
|
||||||
"@verdaccio/ui-theme": "6.0.0-6-next.50",
|
"@verdaccio/ui-theme": "6.0.0-6-next.51",
|
||||||
"JSONStream": "1.3.5",
|
"JSONStream": "1.3.5",
|
||||||
"async": "3.2.4",
|
"async": "3.2.4",
|
||||||
"body-parser": "1.20.1",
|
"body-parser": "1.20.1",
|
||||||
|
@ -105,7 +105,7 @@ function addPackageWebApi(storage: IStorageHandler, auth: IAuth, config: Config)
|
|||||||
res.set(HEADER_TYPE.CONTENT_TYPE, HEADERS.TEXT_PLAIN);
|
res.set(HEADER_TYPE.CONTENT_TYPE, HEADERS.TEXT_PLAIN);
|
||||||
const referer = req.get('Referer');
|
const referer = req.get('Referer');
|
||||||
const pathname = referer ? new URL(referer).pathname : undefined;
|
const pathname = referer ? new URL(referer).pathname : undefined;
|
||||||
next(parseReadme(info.name, info.readme, { pathname }));
|
next(parseReadme(info.name, info.readme));
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -11,7 +11,6 @@ import validator from 'validator';
|
|||||||
|
|
||||||
// eslint-disable-next-line max-len
|
// eslint-disable-next-line max-len
|
||||||
import { getBadData, getBadRequest, getCode, getConflict, getForbidden, getInternalError, getNotFound, getServiceUnavailable, getUnauthorized } from '@verdaccio/commons-api';
|
import { getBadData, getBadRequest, getCode, getConflict, getForbidden, getInternalError, getNotFound, getServiceUnavailable, getUnauthorized } from '@verdaccio/commons-api';
|
||||||
import sanitizyReadme from '@verdaccio/readme';
|
|
||||||
import { Author, Config, Package, Version } from '@verdaccio/types';
|
import { Author, Config, Package, Version } from '@verdaccio/types';
|
||||||
|
|
||||||
import { AuthorAvatar, StringValue } from '../../types';
|
import { AuthorAvatar, StringValue } from '../../types';
|
||||||
@ -494,18 +493,18 @@ export function addGravatarSupport(pkgInfo: Package, online = true): AuthorAvata
|
|||||||
* parse package readme - markdown/ascii
|
* parse package readme - markdown/ascii
|
||||||
* @param {String} packageName name of package
|
* @param {String} packageName name of package
|
||||||
* @param {String} readme package readme
|
* @param {String} readme package readme
|
||||||
* @param {Object} options sanitizyReadme options
|
|
||||||
* @return {String} converted html template
|
* @return {String} converted html template
|
||||||
*/
|
*/
|
||||||
export function parseReadme(packageName: string, readme: string, options: { pathname?: string | void } = {}): string | void {
|
export function parseReadme(packageName: string, readme: string): string | void {
|
||||||
if (_.isEmpty(readme) === false) {
|
if (_.isEmpty(readme) === false) {
|
||||||
return sanitizyReadme(readme, options);
|
return readme;
|
||||||
}
|
}
|
||||||
|
|
||||||
// logs readme not found error
|
// logs readme not found error
|
||||||
logger.error({ packageName }, '@{packageName}: No readme found');
|
logger.info({ packageName }, '@{packageName}: No readme found');
|
||||||
|
|
||||||
return sanitizyReadme('ERROR: No README data found!');
|
return 'ERROR: No README data found!';
|
||||||
}
|
}
|
||||||
|
|
||||||
export function buildToken(type: string, token: string): string {
|
export function buildToken(type: string, token: string): string {
|
||||||
|
@ -1,51 +0,0 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
||||||
|
|
||||||
exports[`Utilities parseReadme should parse makrdown text to html template 1`] = `
|
|
||||||
"<h1 id=\\"project-title\\">Project Title</h1>
|
|
||||||
<p>One Paragraph of project description goes here</p>
|
|
||||||
<h2 id=\\"getting-started\\">Getting Started</h2>
|
|
||||||
<p>These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.</p>
|
|
||||||
<h3 id=\\"prerequisites\\">Prerequisites</h3>
|
|
||||||
<p>What things you need to install the software and how to install them</p>
|
|
||||||
<pre><code>Give examples
|
|
||||||
</code></pre>
|
|
||||||
<h3 id=\\"installing\\">Installing</h3>
|
|
||||||
<p>A step by step series of examples that tell you how to get a development env running</p>
|
|
||||||
<p>Say what the step will be</p>
|
|
||||||
<pre><code>Give the example
|
|
||||||
</code></pre>
|
|
||||||
<p>And repeat</p>
|
|
||||||
<pre><code>until finished
|
|
||||||
</code></pre>
|
|
||||||
<p>End with an example of getting some data out of the system or using it for a little demo</p>
|
|
||||||
<h2 id=\\"running-the-tests\\">Running the tests</h2>
|
|
||||||
<p>Explain how to run the automated tests for this system</p>
|
|
||||||
<h3 id=\\"break-down-into-end-to-end-tests\\">Break down into end to end tests</h3>
|
|
||||||
<p>Explain what these tests test and why</p>
|
|
||||||
<pre><code>Give an example
|
|
||||||
</code></pre>
|
|
||||||
<h3 id=\\"and-coding-style-tests\\">And coding style tests</h3>
|
|
||||||
<p>Explain what these tests test and why</p>
|
|
||||||
<pre><code>Give an example
|
|
||||||
</code></pre>
|
|
||||||
<h2 id=\\"deployment\\">Deployment</h2>
|
|
||||||
<p>Add additional notes about how to deploy this on a live system</p>
|
|
||||||
<h2 id=\\"built-with\\">Built With</h2>
|
|
||||||
<ul>
|
|
||||||
<li>The web framework used</li>
|
|
||||||
<li>Dependency Management</li>
|
|
||||||
<li>Used to generate RSS Feeds</li>
|
|
||||||
</ul>
|
|
||||||
<h2 id=\\"contributing\\">Contributing</h2>
|
|
||||||
<p>Please read <a href=\\"CONTRIBUTING.md\\">CONTRIBUTING.md</a> for details on our code of conduct, and the process for submitting pull requests to us.</p>
|
|
||||||
<h2 id=\\"versioning\\">Versioning</h2>
|
|
||||||
<p>We use <a href=\\"http://semver.org/\\">SemVer</a> for versioning. For the versions available, see the <a href=\\"https://github.com/your/project/tags\\">tags on this repository</a>.</p>
|
|
||||||
<h2 id=\\"license\\">License</h2>
|
|
||||||
<p>This project is licensed under the MIT License - see the <a href=\\"LICENSE.md\\">LICENSE.md</a> file for details</p>
|
|
||||||
<h2 id=\\"acknowledgments\\">Acknowledgments</h2>
|
|
||||||
<ul>
|
|
||||||
<li>Hat tip to anyone whose code was used</li>
|
|
||||||
<li>Inspiration</li>
|
|
||||||
<li>etc</li>
|
|
||||||
</ul>"
|
|
||||||
`;
|
|
@ -404,26 +404,10 @@ describe('Utilities', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('parseReadme', () => {
|
describe('parseReadme', () => {
|
||||||
test('should parse makrdown text to html template', () => {
|
|
||||||
const markdown = '# markdown';
|
|
||||||
expect(parseReadme('testPackage', markdown)).toEqual('<h1 id="markdown">markdown</h1>');
|
|
||||||
expect(parseReadme('testPackage', String(readmeFile('markdown.md')))).toMatchSnapshot();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('should pass for conversion of non-ascii to markdown text', () => {
|
|
||||||
const simpleText = 'simple text';
|
|
||||||
const randomText = '%%%%%**##==';
|
|
||||||
const randomTextMarkdown = 'simple text \n # markdown';
|
|
||||||
|
|
||||||
expect(parseReadme('testPackage', randomText)).toEqual('<p>%%%%%**##==</p>');
|
|
||||||
expect(parseReadme('testPackage', simpleText)).toEqual('<p>simple text</p>');
|
|
||||||
expect(parseReadme('testPackage', randomTextMarkdown)).toEqual('<p>simple text </p>\n<h1 id="markdown">markdown</h1>');
|
|
||||||
});
|
|
||||||
|
|
||||||
test('should show error for no readme data', () => {
|
test('should show error for no readme data', () => {
|
||||||
const noData = '';
|
const noData = '';
|
||||||
const spy = jest.spyOn(logger, 'error');
|
const spy = jest.spyOn(logger, 'info');
|
||||||
expect(parseReadme('testPackage', noData)).toEqual('<p>ERROR: No README data found!</p>');
|
expect(parseReadme('testPackage', noData)).toEqual('ERROR: No README data found!');
|
||||||
expect(spy).toHaveBeenCalledWith({ packageName: 'testPackage' }, '@{packageName}: No readme found');
|
expect(spy).toHaveBeenCalledWith({ packageName: 'testPackage' }, '@{packageName}: No readme found');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
BIN
yarn.lock
BIN
yarn.lock
Binary file not shown.
Loading…
Reference in New Issue
Block a user