diff --git a/.github/workflows/tester.yml b/.github/workflows/tester.yml new file mode 100644 index 0000000..b5a5742 --- /dev/null +++ b/.github/workflows/tester.yml @@ -0,0 +1,30 @@ +name: Tester + +on: [push, pull_request] + +jobs: + tester: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + node-version: ['10.x', '12.x', '14.x'] + fail-fast: false + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - name: Cache NPM dependencies + uses: actions/cache@v1 + with: + path: node_modules + key: ${{ runner.os }}-npm-cache + restore-keys: ${{ runner.os }}-npm-cache + - name: Install Dependencies + run: npm install + - name: Test + run: npm run test + env: + CI: true diff --git a/.mocharc.yml b/.mocharc.yml new file mode 100755 index 0000000..2a55f11 --- /dev/null +++ b/.mocharc.yml @@ -0,0 +1,7 @@ +color: true +reporter: spec +ui: bdd +full-trace: true +exit: true +require: + - "chai/register-should" diff --git a/.travis.yml b/.travis.yml deleted file mode 100755 index 07b8c6c..0000000 --- a/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -sudo: false -language: node_js -node_js: - - "8" - - "10" - - "node" # latest stable Node.js release - -cache: npm - -script: - - npm install - - npm run eslint - - npm test diff --git a/lib/filter.js b/lib/filter.js index 5e70272..ba020b9 100755 --- a/lib/filter.js +++ b/lib/filter.js @@ -30,7 +30,7 @@ module.exports = function(data) { config.nofollow.exclude = [exclude]; } - const filterExternal = (data) => { + const filterExternal = data => { return data.replace(//gi, (str, hrefStr, href) => { if (!isExternal(href, config)) return str; diff --git a/package.json b/package.json index 97a0535..01213a4 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "index.js" ], "engines": { - "node": ">= 8.6.0" + "node": ">= 10.13.0" }, "scripts": { "eslint": "eslint .", @@ -33,9 +33,9 @@ "homepage": "https://github.com/hexojs/hexo-filter-nofollow#readme", "devDependencies": { "chai": "^4.2.0", - "eslint": "^6.2.2", - "eslint-config-hexo": "^3.0.0", + "eslint": "^7.5.0", + "eslint-config-hexo": "^4.1.0", "hexo": "hexojs/hexo", - "mocha": "^6.2.0" + "mocha": "^8.0.1" } } diff --git a/test/mocha.opts b/test/mocha.opts deleted file mode 100755 index 78f25f9..0000000 --- a/test/mocha.opts +++ /dev/null @@ -1,6 +0,0 @@ ---colors ---reporter spec ---ui bdd ---full-trace ---exit ---require chai/register-should \ No newline at end of file