Skip to content
This repository has been archived by the owner on Feb 13, 2025. It is now read-only.

Commit

Permalink
Adding unist-util-select to dependencies, removing lint ignores, addi…
Browse files Browse the repository at this point in the history
…ng test workflow
  • Loading branch information
JasonHowellSlavin committed Dec 21, 2023
1 parent ed5a62b commit d9af680
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 11 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Run tests
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, edited]
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 2

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install XVFB
run: sudo apt-get install xvfb

- name: Install dependencies
run: npm install

- name: Run the tests
run: xvfb-run -a npm test

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/lcov.info
1 change: 0 additions & 1 deletion bacom-blog/aside/aside.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { readFile } from 'fs/promises';
/* eslint-disable-next-line import/no-extraneous-dependencies */
import { select, selectAll } from 'unist-util-select';
import { getMdast, moveNodeParent } from '../../utils/mdast-utils.js';
import { STATUS_SUCCESS } from '../../utils/migration-utils.js';
Expand Down
1 change: 0 additions & 1 deletion bacom-blog/embed/embed.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable-next-line import/no-extraneous-dependencies */
import { select } from 'unist-util-select';
import { selectAllBlocks, extractLink } from '../../utils/mdast-utils.js';
import {
Expand Down
1 change: 0 additions & 1 deletion bacom-blog/figure/images-to-figure.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable-next-line import/no-extraneous-dependencies */
import { select } from 'unist-util-select';
import { selectAllBlocks } from '../../utils/mdast-utils.js';
import { STATUS_SUCCESS, STATUS_WARNING } from '../../utils/migration-utils.js';
Expand Down
1 change: 0 additions & 1 deletion bacom-blog/links/linksDnt.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable-next-line import/no-extraneous-dependencies */
import { selectAll } from 'unist-util-select';
import {
STATUS_SUCCESS,
Expand Down
1 change: 0 additions & 1 deletion bacom-blog/pull-quote/pull-quote-update.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable-next-line import/no-extraneous-dependencies */
import { selectAll } from 'unist-util-select';
import {
STATUS_SUCCESS,
Expand Down
1 change: 0 additions & 1 deletion bacom-blog/tag-header/tag-header.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { readFile } from 'fs/promises';
/* eslint-disable-next-line import/no-extraneous-dependencies */
import { select, selectAll } from 'unist-util-select';
import { getMdast } from '../../utils/mdast-utils.js';
import { STATUS_SUCCESS, STATUS_WARNING } from '../../utils/migration-utils.js';
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"stylelint": "14.6.0",
"stylelint-config-prettier": "9.0.3",
"stylelint-config-standard": "25.0.0",
"unist-util-select": "^5.1.0",
"xlsx": "^0.18.5"
},
"lint-staged": {
Expand Down
3 changes: 1 addition & 2 deletions test/bacom-blog/aside/aside.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { readFile } from 'fs/promises';
import { expect } from '@esm-bundle/chai';
/* eslint-disable-next-line import/no-extraneous-dependencies */
import { select } from 'unist-util-select';
import { getMdast, mdast2md } from '../../../utils/mdast-utils.js';
import { bannerToAside } from '../../../bacom-blog/aside/aside.js';
Expand Down Expand Up @@ -96,7 +95,7 @@ describe('convertBannerToAside', () => {
expect(bannerMdast.type).to.equal('root');

const imageNode = select('image', bannerMdast);
expect(imageNode).to.be.null;
expect(imageNode).to.be.undefined;

const mdast = await getMdast(mdast2md(bannerMdast));
expect(mdast).to.deep.equal(asideMdast);
Expand Down
1 change: 0 additions & 1 deletion test/bacom-blog/quote/quote.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { readFile } from 'fs/promises';
import { expect } from '@esm-bundle/chai';
/* eslint-disable-next-line import/no-extraneous-dependencies */
import { select } from 'unist-util-select';
import {
convertPullQuote,
Expand Down
3 changes: 1 addition & 2 deletions test/utils/mdast-utils.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { expect } from '@esm-bundle/chai';
/* eslint-disable-next-line import/no-extraneous-dependencies */
import { select } from 'unist-util-select';
import {
getMdast,
Expand Down Expand Up @@ -71,7 +70,7 @@ describe('mdast-utils', () => {
moveNodeParent(fromMdast, 'image', 'paragraph', toMdast);

expect(select('paragraph', toMdast)).to.not.be.null;
expect(select('paragraph', fromMdast)).to.be.null;
expect(select('paragraph', fromMdast)).to.be.undefined;
});
});
});

0 comments on commit d9af680

Please sign in to comment.