dwyl / nextra-demo

⏭️ A comprehensive demo of using nextra for a documentation site with Auth (private pages), Search and Analytics!
https://nextra-demo-seven.vercel.app/
GNU General Public License v2.0
3 stars 1 forks source link

[PR] Linting markdown files and checking for broken internal and external links #11

Closed LuchoTurtle closed 4 months ago

LuchoTurtle commented 4 months ago

closes #10

This PR adds a few new features:

codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 100.00%. Comparing base (e8a4856) to head (1a3befc).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #11 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 2 3 +1 Lines 138 211 +73 Branches 20 30 +10 ========================================= + Hits 138 211 +73 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

LuchoTurtle commented 4 months ago

Keep getting this error, darn it.

   Jest encountered an unexpected token

    Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.

    Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.

    By default "node_modules" folder is ignored by transformers.

    Here's what you can do:
     • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it.
     • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript
     • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
     • If you need a custom transformation specify a "transform" option in your config.
     • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.

    You'll find more details and examples of these config options in the docs:
    https://jestjs.io/docs/configuration
    For information about custom transformations, see:
    https://jestjs.io/docs/code-transformation

    Details:

    /Users/lucho/Documents/dwyl/nextra-demo/node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/esm-browser/index.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){export { default as v1 } from './v1.js';
                                                                                      ^^^^^^

    SyntaxError: Unexpected token 'export'

       9 |
      10 | /**
    > 11 |  * This function checks external links that are present in the markdown files.
         |                                                      ^
      12 |  * It checks if they're alive or dead using `markdown-lint-check`.
      13 |  */
      14 | export function checkMarkdownExternalLinks(markdownBody) {
LuchoTurtle commented 4 months ago

jest really is config hell for ESM :(

LuchoTurtle commented 4 months ago

Trying to debug

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From tests/unit/link-check.test.ts.

for ages now.

markdown-link-check using async messes up with Jest. The test effectively passes correctly (as it should) but Jest complains something is trying to be imported after the test is passed.

LuchoTurtle commented 4 months ago

@nelsonic this should be ready for review 👌