Skip to content

Commit 8c4923a

Browse files
authored
CI: add Node.js 14 (#1246)
* CI: add Node.js 14 * fix(operator): コードを修正 * fix(object): fix code * fix * chore: format * chore: fix code
1 parent 8aaf25b commit 8c4923a

File tree

6 files changed

+103
-16
lines changed

6 files changed

+103
-16
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ${{ matrix.os }}
1616
strategy:
1717
matrix:
18-
node-version: [12.x]
18+
node-version: [12.x,]
1919
os: [macOS-10.14, windows-latest, ubuntu-18.04]
2020
name: "Build on Node.js: ${{ matrix.node-version }} OS: ${{ matrix.os }}"
2121
steps:
@@ -30,7 +30,7 @@ jobs:
3030
runs-on: ubuntu-latest
3131
strategy:
3232
matrix:
33-
node-version: [12.x, 10.x]
33+
node-version: [14.x, 12.x, 10.x]
3434
name: "Test on Node.js ${{ matrix.node-version }}"
3535
steps:
3636
- uses: actions/checkout@v2

package-lock.json

Lines changed: 88 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,5 +119,7 @@
119119
"wait-on": "^5.0.1",
120120
"workbox-cli": "^3.6.3"
121121
},
122-
"dependencies": {}
122+
"dependencies": {
123+
"semver": "^7.3.2"
124+
}
123125
}

source/basic/object/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -541,10 +541,10 @@ printWidgetTitle({
541541
window: {
542542
title: "Book Viewer"
543543
}
544-
}); // => "ウィジェットのタイトルはBook Viewerです"
544+
}); // "ウィジェットのタイトルはBook Viewerです" と出力される
545545
printWidgetTitle({
546546
// タイトルが定義されてない空のオブジェクト
547-
}); // => "ウィジェットのタイトルは未定義です"
547+
}); // "ウィジェットのタイトルは未定義です" と出力される
548548
```
549549
550550
また、Optional chaining演算子(`?.`)はブラケット記法(`[]`)と組み合わせることもできます。
@@ -555,7 +555,7 @@ printWidgetTitle({
555555
```js
556556
const languages = {
557557
ja: {
558-
hello: "こんにちは!"
558+
hello: "こんにちは"
559559
},
560560
en: {
561561
hello: "Hello!"

source/basic/operator/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -924,12 +924,12 @@ Nullish coalescing演算子(`??`)は、左辺の値が**nulish**であるなら
924924
```js
925925
// 左辺がnullishであるため、右辺の値の評価結果を返す
926926
console.log(null ?? "右辺の値"); // => "右辺の値"
927-
console.log(undefiend ?? "右辺の値"); // => "右辺の値"
927+
console.log(undefined ?? "右辺の値"); // => "右辺の値"
928928
// 左辺がnullishではないため、右辺の値の評価結果を返す
929929
console.log(true ?? "右辺の値"); // => true
930930
console.log(false ?? "右辺の値"); // => false
931931
console.log(0 ?? "右辺の値"); // => 0
932-
console.log("文字列" ?? "右辺の値"); // => "左辺の値"
932+
console.log("文字列" ?? "右辺の値"); // => "文字列"
933933
```
934934
935935
Nullish coalescing演算子(`??`)とOR演算子(`||`)は、値のデフォルト値を指定する場合によく利用されています。

test/markdown-doc-test.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,21 @@
22
"use strict";
33
import { test } from "@power-doctest/tester";
44
import { parse } from "@power-doctest/markdown";
5+
import { toTestCode } from "./lib/testing-code";
6+
57
const globby = require("globby");
68
const fs = require("fs");
79
const path = require("path");
8-
9-
import { toTestCode } from "./lib/testing-code";
10+
const semver = require("semver");
1011
const sourceDir = path.join(__dirname, "..", "source");
1112

1213

1314
/**
1415
* 指定したECMAScriptバージョンをmetaにもつコードは実行環境によってはサポートされてないので無視する
15-
* .travis.ymlのサポートしているNode.jsバージョンに合わせる
16+
* 最新版のNodeでは無視しない
1617
* @type {string[]}
1718
*/
18-
const AllowECMAScriptVersions = ["2017", "2018", "2019", "2020"];
19+
const AllowECMAScriptVersions = semver.cmp(process.version, ">=", "14.0.0") ? [] : ["2017", "2018", "2019", "2020"];
1920
/**
2021
* Markdownファイルの CodeBlock に対してdoctestを行う
2122
* CodeBlockは必ず実行できるとは限らないので、

0 commit comments

Comments
 (0)