diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index eafe631f7dfe..60cf0ee24652 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -4,6 +4,25 @@ on: pull_request: jobs: + unitTest: + name: Unit Test + strategy: + matrix: + os: [ubuntu-latest] + node-version: [16.x] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: yarn + + - run: yarn --frozen-lockfile + - run: yarn jest + lint: name: Lint strategy: diff --git a/src/remark-plugins/remark-cleanup-readme/__snapshots__/index.test.mjs.snap b/src/remark-plugins/remark-cleanup-readme/__snapshots__/index.test.mjs.snap index 69aa6a9a301e..4605a1309324 100644 --- a/src/remark-plugins/remark-cleanup-readme/__snapshots__/index.test.mjs.snap +++ b/src/remark-plugins/remark-cleanup-readme/__snapshots__/index.test.mjs.snap @@ -4,9 +4,9 @@ exports[`cleanup readme should clean up div[align="center"] block with paragraph "/* @jsxRuntime classic */ /* @jsx mdx */ /* @jsxFrag mdx.Fragment */ -const MDXLayout = \\"wrapper\\"; +const MDXLayout = "wrapper"; function MDXContent({components, ...props}) { - return

{\\"Imagemin Webpack\\"}

{\\"Plugin and Loader for \\"}{\\"webpack\\"}{\\" to optimize (compress) all images using \\"}{\\"imagemin\\"}{\\".\\\\nDo not worry about size of images, now they are always optimized/compressed.\\"}

; + return

{"Imagemin Webpack"}

{"Plugin and Loader for "}{"webpack"}{" to optimize (compress) all images using "}{"imagemin"}{".\\nDo not worry about size of images, now they are always optimized/compressed."}

; } MDXContent.isMDXComponent = true; export default MDXContent; @@ -17,9 +17,9 @@ exports[`cleanup readme should clean up div[align="center"] block without paragr "/* @jsxRuntime classic */ /* @jsx mdx */ /* @jsxFrag mdx.Fragment */ -const MDXLayout = \\"wrapper\\"; +const MDXLayout = "wrapper"; function MDXContent({components, ...props}) { - return
; + return
; } MDXContent.isMDXComponent = true; export default MDXContent; @@ -30,9 +30,9 @@ exports[`cleanup readme should clean up nested div[align="center"] block 1`] = "/* @jsxRuntime classic */ /* @jsx mdx */ /* @jsxFrag mdx.Fragment */ -const MDXLayout = \\"wrapper\\"; +const MDXLayout = "wrapper"; function MDXContent({components, ...props}) { - return
; + return
; } MDXContent.isMDXComponent = true; export default MDXContent; diff --git a/src/remark-plugins/remark-custom-asides/__snapshots__/index.test.mjs.snap b/src/remark-plugins/remark-custom-asides/__snapshots__/index.test.mjs.snap index edb6f5982712..fb58948b5761 100644 --- a/src/remark-plugins/remark-custom-asides/__snapshots__/index.test.mjs.snap +++ b/src/remark-plugins/remark-custom-asides/__snapshots__/index.test.mjs.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`customize blockquote should transform W> into aside of warning 1`] = ` -" +" " `; diff --git a/src/remark-plugins/remark-custom-asides/index.test.mjs b/src/remark-plugins/remark-custom-asides/index.test.mjs index 1f11784464ad..b36bd82a12fb 100644 --- a/src/remark-plugins/remark-custom-asides/index.test.mjs +++ b/src/remark-plugins/remark-custom-asides/index.test.mjs @@ -9,7 +9,9 @@ describe('customize blockquote', () => { 'W>': 'warning', }, }) - .use(remarkHtml) + .use(remarkHtml, { + sanitize: false + }) .process( ` W> hello world diff --git a/src/remark-plugins/remark-remove-heading-id/__snapshots__/index.test.mjs.snap b/src/remark-plugins/remark-remove-heading-id/__snapshots__/index.test.mjs.snap index 02e066d7ceb0..f7d4dfeb7050 100644 --- a/src/remark-plugins/remark-remove-heading-id/__snapshots__/index.test.mjs.snap +++ b/src/remark-plugins/remark-remove-heading-id/__snapshots__/index.test.mjs.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`customize blockquote should add id 1`] = ` -"

hello world

+"

hello world

this is me.

" `; diff --git a/src/remark-plugins/remark-responsive-table/__snapshots__/remark-responsive-table.test.mjs.snap b/src/remark-plugins/remark-responsive-table/__snapshots__/remark-responsive-table.test.mjs.snap index 991fef038c46..a57126cc1b38 100644 --- a/src/remark-plugins/remark-responsive-table/__snapshots__/remark-responsive-table.test.mjs.snap +++ b/src/remark-plugins/remark-responsive-table/__snapshots__/remark-responsive-table.test.mjs.snap @@ -10,12 +10,12 @@ exports[`responsive table should add data-th 1`] = ` -baz -- +baz +- -sam -chen +sam +chen @@ -32,12 +32,12 @@ exports[`responsive table should handle empty thead 1`] = ` -baz -- +baz +- -sam -chen +sam +chen diff --git a/src/remark-plugins/remark-responsive-table/remark-responsive-table.test.mjs b/src/remark-plugins/remark-responsive-table/remark-responsive-table.test.mjs index 7729c785faa7..8180ca918a0f 100644 --- a/src/remark-plugins/remark-responsive-table/remark-responsive-table.test.mjs +++ b/src/remark-plugins/remark-responsive-table/remark-responsive-table.test.mjs @@ -8,7 +8,9 @@ describe('responsive table', () => { const processor = remark() .use(remarkGfm) .use(remarkResponsiveTable) - .use(remarkHtml); + .use(remarkHtml, { + sanitize: false, + }); it('should add data-th', () => { processor.process( ` diff --git a/src/remark-plugins/remark-slug/__snapshots__/index.test.mjs.snap b/src/remark-plugins/remark-slug/__snapshots__/index.test.mjs.snap index 16c03e73a1c9..ce0762cc6060 100644 --- a/src/remark-plugins/remark-slug/__snapshots__/index.test.mjs.snap +++ b/src/remark-plugins/remark-slug/__snapshots__/index.test.mjs.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`remark slug should add id 1`] = ` -"

hello world

+"

hello world

this is me.

" `; diff --git a/yarn.lock b/yarn.lock index 2bb6f93e5920..3ed2dbfaa71b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11846,7 +11846,7 @@ unist-util-visit-parents@^4.0.0: "@types/unist" "^2.0.0" unist-util-is "^5.0.0" -unist-util-visit-parents@^5.1.1: +unist-util-visit-parents@^5.0.0, unist-util-visit-parents@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/unist-util-visit-parents/-/unist-util-visit-parents-5.1.1.tgz#868f353e6fce6bf8fa875b251b0f4fec3be709bb" integrity sha512-gks4baapT/kNRaWxuGkl5BIhoanZo7sC/cUT/JToSRNL1dYoXRFl75d++NkjYk4TAu2uv2Px+l8guMajogeuiw==