Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[remark-extend] failing tests for advanced js #1637

Closed
wants to merge 2 commits into from

Conversation

tlouisse
Copy link
Member

Test cases that illustrate the issue addressed here: #1578

    it('supports js content', async () => {
      const result = await executeMd(
        [
          //
          "```js ::importBlockContent('./fixtures/js-simple.md', '## Simple')",
          '```',
        ].join('\n'),
      );

      expect(result).to.equal(
        [
          //
          '```js',
          "const x = 'My Example';",
          '```',
          '',
        ].join('\n'),
      );
    });

    it('considers variables outside imported block', async () => {
      const result = await executeMd(
        [
          //
          "```js ::importBlockContent('./fixtures/js-advanced-1.md', '## Consuming shared var')",
          '```',
        ].join('\n'),
      );

      expect(result).to.equal(
        [
          //
          '```js',
          "import { sharedVar } from 'some-global-lib';",
          // This file is needed for its side effect
          // Note its location changed from '../some-local-file.js' to './some-local-file.js'
          "import './some-local-file.js';",
          '```',
          '',
          '```js',
          'export const x = sharedVar`My Example`;',
          '```',
          '',
        ].join('\n'),
      );
    });

    // N.B. if the goal of remark-extend is only to extend lion docs, we can limit the
    // functionality to 1:1 mappings of page names and leave this a nice to have
    it.skip('considers name clashes in variables outside imported blocks of multiple files', async () => {
      const result = await executeMd(
        [
          //
          "```js ::importBlockContent('./fixtures/js-advanced-1.md', '## Consuming shared var')",
          '```',
          '',
          "```js ::importBlockContent('./fixtures/js-advanced-2.md', '## Consuming conflicting shared var')",
          '```',
        ].join('\n'),
      );

      expect(result).to.equal(
        [
          //
          '```js',
          "import { sharedVar } from 'some-global-lib';",
          "import { sharedVar_2 } from 'some-other-global-lib';",
          "import '../some-local-file.js';",
          '```',
          '',
          '```js',
          'export const x = sharedVar`My Example`;',
          '```',
          '',
          '```js',
          'export const y = sharedVar_2`My Example`;',
          '```',
          '',
        ].join('\n'),
      );
    });

@changeset-bot
Copy link

changeset-bot bot commented Mar 23, 2022

⚠️ No Changeset found

Latest commit: dc7355b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@tlouisse tlouisse force-pushed the feat/remarkExtendAdvancedJs branch from 16e21c3 to dc7355b Compare March 28, 2022 11:04
@tlouisse tlouisse changed the title Feat/remark extend advanced js [remark-extend] failing tests for advanced js Mar 31, 2022
@gerjanvangeest
Copy link
Member

This PR is abandoned, please reopen and update it if you still want this fix applied in our codebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants