diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 07958c87db..3006de8480 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,7 @@ name: CI on: [push, pull_request] +env: + NODE_VERSION_USED_FOR_DEVELOPMENT: 14 jobs: lint: name: Lint source files @@ -10,6 +12,8 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v1 + with: + node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }} - name: Cache Node.js modules uses: actions/cache@v2 @@ -57,6 +61,8 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v1 + with: + node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }} - name: Cache Node.js modules uses: actions/cache@v2 @@ -81,6 +87,8 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v1 + with: + node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }} - name: Cache Node.js modules uses: actions/cache@v2 @@ -97,25 +105,26 @@ jobs: run: npm run testonly:cover - name: Upload coverage to Codecov + if: ${{ always() }} uses: codecov/codecov-action@v1 with: file: ./coverage/tests/coverage-final.json fail_ci_if_error: true test: - name: Run tests on Node v${{ matrix.node_version }} + name: Run tests on Node v${{ matrix.node_version_to_setup }} runs-on: ubuntu-latest strategy: matrix: - node_version: [10, 12, 14] + node_version_to_setup: [10, 12, 14] steps: - name: Checkout repo uses: actions/checkout@v2 - - name: Setup Node.js v${{ matrix.node_version }} + - name: Setup Node.js v${{ matrix.node_version_to_setup }} uses: actions/setup-node@v1 with: - node-version: ${{ matrix.node_version }} + node-version: ${{ matrix.node_version_to_setup }} - name: Cache Node.js modules uses: actions/cache@v2 @@ -142,6 +151,8 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v1 + with: + node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }} - name: Cache Node.js modules uses: actions/cache@v2 @@ -171,6 +182,8 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v1 + with: + node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }} - name: Cache Node.js modules uses: actions/cache@v2 diff --git a/.nycrc.yml b/.nycrc.yml index ad74db4ae2..44aaed89e4 100644 --- a/.nycrc.yml +++ b/.nycrc.yml @@ -19,3 +19,8 @@ temp-directory: 'coverage/tests' report-dir: 'coverage/tests' skip-full: true reporter: [json, html, text] +check-coverage: true +branches: 100 +lines: 100 +functions: 100 +statements: 100 diff --git a/package.json b/package.json index 05ab923fb1..0582d3ae3f 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,9 @@ "graphql-js" ], "engines": { + "node": ">= 14.2" + }, + "engines_on_npm": { "node": ">= 10.x" }, "scripts": { diff --git a/resources/build.js b/resources/build.js index 728bef7b88..16ccc0890c 100644 --- a/resources/build.js +++ b/resources/build.js @@ -53,6 +53,9 @@ function buildPackageJSON() { delete packageJSON.scripts; delete packageJSON.devDependencies; + packageJSON.engines = packageJSON.engines_on_npm; + delete packageJSON.engines_on_npm; + const versionJS = require('../dist/version.js'); assert( versionJS.version === packageJSON.version, diff --git a/resources/utils.js b/resources/utils.js index e72f9c84d1..85e2f28bfe 100644 --- a/resources/utils.js +++ b/resources/utils.js @@ -49,6 +49,13 @@ function rmdirRecursive(dirPath) { } function readdirRecursive(dirPath, opts = {}) { + console.log('-------'); + const result = readdirRecursive2(dirPath, opts); + console.log('+++++++'); + return result; +} + +function readdirRecursive2(dirPath, opts = {}) { const { ignoreDir } = opts; const result = []; for (const dirent of fs.readdirSync(dirPath, { withFileTypes: true })) { @@ -61,7 +68,7 @@ function readdirRecursive(dirPath, opts = {}) { if (ignoreDir && ignoreDir.test(name)) { continue; } - const list = readdirRecursive(path.join(dirPath, name), opts).map((f) => + const list = readdirRecursive2(path.join(dirPath, name), opts).map((f) => path.join(name, f), ); result.push(...list); diff --git a/src/type/validate.js b/src/type/validate.js index 4d8e5a8fc2..903ed69951 100644 --- a/src/type/validate.js +++ b/src/type/validate.js @@ -357,7 +357,12 @@ function validateTypeImplementsInterface( `Interface field ${iface.name}.${fieldName} expects type ` + `${inspect(ifaceField.type)} but ${type.name}.${fieldName} ` + `is type ${inspect(typeField.type)}.`, - [ifaceField.astNode?.type, typeField.astNode?.type], + [ + // istanbul ignore next (TODO need to write coverage tests) + ifaceField.astNode?.type, + // istanbul ignore next (TODO need to write coverage tests) + typeField.astNode?.type, + ], ); } @@ -384,7 +389,12 @@ function validateTypeImplementsInterface( `expects type ${inspect(ifaceArg.type)} but ` + `${type.name}.${fieldName}(${argName}:) is type ` + `${inspect(typeArg.type)}.`, - [ifaceArg.astNode?.type, typeArg.astNode?.type], + [ + // istanbul ignore next (TODO need to write coverage tests) + ifaceArg.astNode?.type, + // istanbul ignore next (TODO need to write coverage tests) + typeArg.astNode?.type, + ], ); }