diff --git a/.circleci/config.yml b/.circleci/config.yml index 85524c0..61bfe82 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,9 +1,33 @@ -version: 2 +version: 2.1 + +commands: + cached-dependencies: + steps: + - restore_cache: + name: Restore Yarn Package Cache + keys: + - yarn-packages-{{ checksum "yarn.lock" }} + - run: + name: Install Dependencies + command: yarn install --frozen-lockfile + - save_cache: + name: Save Yarn Package Cache + key: yarn-packages-{{ checksum "yarn.lock" }} + paths: + - ~/.cache/yarn + + install_and_test: + description: >- + Install everything required to run the test suite, then run it. + steps: + - cached-dependencies + - run: yarn test.prod jobs: - test_node_8: + # https://nodejs.org/en/about/releases/ + test_node_lts: docker: - - image: circleci/node:8 + - image: circleci/node:lts steps: - checkout - run: @@ -11,20 +35,33 @@ jobs: command: | curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter chmod +x ./cc-test-reporter - - run: yarn - run: name: cc-before command: | ./cc-test-reporter before-build - - run: yarn test.prod + - install_and_test - run: name: cc-after command: | ./cc-test-reporter after-build --coverage-input-type lcov --exit-code $? + test_node_dubnium: + docker: + - image: circleci/node:dubnium + steps: + - checkout + - install_and_test + + test_node_latest: + docker: + - image: circleci/node:latest + steps: + - checkout + - install_and_test + release: docker: - - image: circleci/node:8 + - image: circleci/node:lts steps: - checkout - run: yarn @@ -35,10 +72,14 @@ workflows: version: 2 test_and_release: jobs: - - test_node_8 + - test_node_lts + - test_node_dubnium + - test_node_latest - release: filters: branches: only: master requires: - - test_node_8 + - test_node_lts + - test_node_dubnium + - test_node_latest diff --git a/package.json b/package.json index 8935179..9a645ef 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "**/*" ], "engines": { - "node": ">=8.3.0" + "node": ">=10.8" }, "scripts": { "build": "sl-scripts build", @@ -41,7 +41,7 @@ "dependencies": { "@stoplight/ordered-object-literal": "^1.0.1", "@stoplight/types": "^11.1.1", - "@stoplight/yaml-ast-parser": "0.0.45", + "@stoplight/yaml-ast-parser": "0.0.46", "lodash": "^4.17.15" }, "devDependencies": { diff --git a/src/__tests__/parseWithPointers.spec.ts b/src/__tests__/parseWithPointers.spec.ts index 53a9201..014a302 100644 --- a/src/__tests__/parseWithPointers.spec.ts +++ b/src/__tests__/parseWithPointers.spec.ts @@ -812,4 +812,8 @@ bar: false }); }); }); + + test.each(['6917528997577384320', '9223372036854775807'])('big int %s', value => { + expect(parseWithPointers(`${value}`).data).toEqual(BigInt(value)); + }); }); diff --git a/src/parseWithPointers.ts b/src/parseWithPointers.ts index e092c37..8dd73b7 100644 --- a/src/parseWithPointers.ts +++ b/src/parseWithPointers.ts @@ -3,9 +3,9 @@ import { DiagnosticSeverity, Dictionary, IDiagnostic, Optional } from '@stopligh import { determineScalarType, load as loadAST, + parseYamlBigInteger, parseYamlBoolean, parseYamlFloat, - parseYamlInteger, YAMLException, } from '@stoplight/yaml-ast-parser'; import { buildJsonPath } from './buildJsonPath'; @@ -120,7 +120,7 @@ export const walkAST = ( return node; }; -function getScalarValue(node: YAMLScalar): number | null | boolean | string | void { +function getScalarValue(node: YAMLScalar): number | bigint | null | boolean | string | void { switch (determineScalarType(node)) { case ScalarType.null: return null; @@ -129,7 +129,7 @@ function getScalarValue(node: YAMLScalar): number | null | boolean | string | vo case ScalarType.bool: return parseYamlBoolean(node.value); case ScalarType.int: - return parseYamlInteger(node.value); + return parseYamlBigInteger(node.value); case ScalarType.float: return parseYamlFloat(node.value); } diff --git a/tsconfig.json b/tsconfig.json index 54647f0..f00c04c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,6 @@ { "extends": "./node_modules/@stoplight/scripts/tsconfig.json", + "lib": ["es2020", "dom"], // target all ts files "include": ["."] diff --git a/yarn.lock b/yarn.lock index f3ac98a..13b481d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1587,10 +1587,10 @@ dependencies: "@types/json-schema" "^7.0.3" -"@stoplight/yaml-ast-parser@0.0.45": - version "0.0.45" - resolved "https://registry.yarnpkg.com/@stoplight/yaml-ast-parser/-/yaml-ast-parser-0.0.45.tgz#672c0a1511d581843be5a9c55899ca95a30dcadb" - integrity sha512-0MTEvgp3XMdeMUSTCGiNECuC+YlLbzytDEIOJVDHrrmzVZpIR3gGnHI6mmPI4P7saPxUiHxFF2uuoTuCNlKjrw== +"@stoplight/yaml-ast-parser@0.0.46": + version "0.0.46" + resolved "https://registry.yarnpkg.com/@stoplight/yaml-ast-parser/-/yaml-ast-parser-0.0.46.tgz#ee9c8da3d8b89ae9007bfe015daf34ee68db9bd5" + integrity sha512-eKVeNt6n3U/nA2hjwUsyLOC48DaMiwRx/qrLPzt9Oie+ke4lPA2Jm8ozUMcleVdV5JyZNpG3UhBcSb3PTlt0Kw== "@storybook/addon-actions@4.0.11": version "4.0.11"