diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 30a3a556f1..94f3977761 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,7 +15,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - node-version: [12.x] + node-version: [12.x,] os: [macOS-10.14, windows-latest, ubuntu-18.04] name: "Build on Node.js: ${{ matrix.node-version }} OS: ${{ matrix.os }}" steps: @@ -30,7 +30,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [12.x, 10.x] + node-version: [14.x, 12.x, 10.x] name: "Test on Node.js ${{ matrix.node-version }}" steps: - uses: actions/checkout@v2 diff --git a/package-lock.json b/package-lock.json index c3ba279190..85394602c6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -46,6 +46,14 @@ "browserslist": "^4.12.0", "invariant": "^2.2.4", "semver": "^5.5.0" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } } }, "@babel/core": { @@ -123,6 +131,12 @@ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", "dev": true + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true } } }, @@ -207,6 +221,14 @@ "invariant": "^2.2.4", "levenary": "^1.1.1", "semver": "^5.5.0" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } } }, "@babel/helper-create-class-features-plugin": { @@ -1590,6 +1612,12 @@ "lodash": "^4.17.13", "to-fast-properties": "^2.0.0" } + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true } } }, @@ -4416,7 +4444,8 @@ "codemirror": { "version": "5.57.0", "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.57.0.tgz", - "integrity": "sha512-WGc6UL7Hqt+8a6ZAsj/f1ApQl3NPvHY/UQSzG6fB6l4BjExgVdhFaxd7mRTw1UCiYe/6q86zHP+kfvBQcZGvUg==" + "integrity": "sha512-WGc6UL7Hqt+8a6ZAsj/f1ApQl3NPvHY/UQSzG6fB6l4BjExgVdhFaxd7mRTw1UCiYe/6q86zHP+kfvBQcZGvUg==", + "dev": true }, "codemirror-console": { "version": "2.0.1", @@ -4723,6 +4752,14 @@ "semver": "^5.5.0", "shebang-command": "^1.2.0", "which": "^1.2.9" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } } }, "crypt": { @@ -9159,6 +9196,14 @@ "dev": true, "requires": { "semver": "^5.6.0" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } } }, "make-dir": { @@ -9169,6 +9214,14 @@ "requires": { "pify": "^4.0.1", "semver": "^5.6.0" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } } }, "map-age-cleaner": { @@ -10114,6 +10167,13 @@ "resolve": "^1.10.0", "semver": "2 || 3 || 4 || 5", "validate-npm-package-license": "^3.0.1" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + } } }, "normalize-path": { @@ -10687,6 +10747,14 @@ "registry-auth-token": "^3.0.1", "registry-url": "^3.0.3", "semver": "^5.1.0" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } } }, "parent-module": { @@ -11249,6 +11317,14 @@ "semver": "2 || 3 || 4 || 5", "slide": "~1.1.3", "util-extend": "^1.0.1" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } } }, "read-package-json": { @@ -12137,9 +12213,9 @@ } }, "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", + "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==" }, "semver-diff": { "version": "2.1.0", @@ -12148,6 +12224,14 @@ "dev": true, "requires": { "semver": "^5.0.3" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } } }, "send": { diff --git a/package.json b/package.json index e526e2464a..29124f6f32 100644 --- a/package.json +++ b/package.json @@ -119,5 +119,7 @@ "wait-on": "^5.0.1", "workbox-cli": "^3.6.3" }, - "dependencies": {} + "dependencies": { + "semver": "^7.3.2" + } } diff --git a/source/basic/object/README.md b/source/basic/object/README.md index 55f61e0ed3..67a34e98b0 100644 --- a/source/basic/object/README.md +++ b/source/basic/object/README.md @@ -541,10 +541,10 @@ printWidgetTitle({ window: { title: "Book Viewer" } -}); // => "ウィジェットのタイトルはBook Viewerです" +}); // "ウィジェットのタイトルはBook Viewerです" と出力される printWidgetTitle({ // タイトルが定義されてない空のオブジェクト -}); // => "ウィジェットのタイトルは未定義です" +}); // "ウィジェットのタイトルは未定義です" と出力される ``` また、Optional chaining演算子(`?.`)はブラケット記法(`[]`)と組み合わせることもできます。 @@ -555,7 +555,7 @@ printWidgetTitle({ ```js const languages = { ja: { - hello: "こんにちは!" + hello: "こんにちは!" }, en: { hello: "Hello!" diff --git a/source/basic/operator/README.md b/source/basic/operator/README.md index f82726d831..eb64fbde25 100644 --- a/source/basic/operator/README.md +++ b/source/basic/operator/README.md @@ -924,12 +924,12 @@ Nullish coalescing演算子(`??`)は、左辺の値が**nulish**であるなら ```js // 左辺がnullishであるため、右辺の値の評価結果を返す console.log(null ?? "右辺の値"); // => "右辺の値" -console.log(undefiend ?? "右辺の値"); // => "右辺の値" +console.log(undefined ?? "右辺の値"); // => "右辺の値" // 左辺がnullishではないため、右辺の値の評価結果を返す console.log(true ?? "右辺の値"); // => true console.log(false ?? "右辺の値"); // => false console.log(0 ?? "右辺の値"); // => 0 -console.log("文字列" ?? "右辺の値"); // => "左辺の値" +console.log("文字列" ?? "右辺の値"); // => "文字列" ``` Nullish coalescing演算子(`??`)とOR演算子(`||`)は、値のデフォルト値を指定する場合によく利用されています。 diff --git a/test/markdown-doc-test.js b/test/markdown-doc-test.js index 0d7c9266f5..0ac51b9c21 100644 --- a/test/markdown-doc-test.js +++ b/test/markdown-doc-test.js @@ -2,20 +2,21 @@ "use strict"; import { test } from "@power-doctest/tester"; import { parse } from "@power-doctest/markdown"; +import { toTestCode } from "./lib/testing-code"; + const globby = require("globby"); const fs = require("fs"); const path = require("path"); - -import { toTestCode } from "./lib/testing-code"; +const semver = require("semver"); const sourceDir = path.join(__dirname, "..", "source"); /** * 指定したECMAScriptバージョンをmetaにもつコードは実行環境によってはサポートされてないので無視する - * .travis.ymlのサポートしているNode.jsバージョンに合わせる + * 最新版のNodeでは無視しない * @type {string[]} */ -const AllowECMAScriptVersions = ["2017", "2018", "2019", "2020"]; +const AllowECMAScriptVersions = semver.cmp(process.version, ">=", "14.0.0") ? [] : ["2017", "2018", "2019", "2020"]; /** * Markdownファイルの CodeBlock に対してdoctestを行う * CodeBlockは必ず実行できるとは限らないので、