mirror of
https://github.com/actions/setup-node.git
synced 2025-04-21 21:30:55 +00:00
add unit tests
This commit is contained in:
parent
06981c41e3
commit
38d01b1022
20
.github/workflows/versions.yml
vendored
20
.github/workflows/versions.yml
vendored
@ -71,6 +71,26 @@ jobs:
|
|||||||
__tests__/verify-node.sh "$majorVersion"
|
__tests__/verify-node.sh "$majorVersion"
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
|
rc-syntax:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
node-version: [16.0.0-rc.1, 18.0.0-rc.2, 19.0.0-rc.0]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Setup Node
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node-version }}
|
||||||
|
- name: Verify node and npm
|
||||||
|
run: |
|
||||||
|
rcVersion="${{ matrix.node-version }}"
|
||||||
|
majorVersion=$(echo $rcVersion | cut -d- -f1)
|
||||||
|
__tests__/verify-node.sh "$majorVersion"
|
||||||
|
shell: bash
|
||||||
|
|
||||||
manifest:
|
manifest:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
|
35
__tests__/data/node-nightly-index.json
Normal file
35
__tests__/data/node-nightly-index.json
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
[
|
||||||
|
{"version":"v20.0.0-nightly2022101987cdf7d412","date":"2022-10-19","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-arm64-tar","osx-x64-pkg","osx-x64-tar","src","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"npm":"8.19.2","v8":"10.7.193.16","uv":"1.43.0","zlib":"1.2.11","openssl":"3.0.5+quic","modules":"111","lts":false,"security":false},
|
||||||
|
{"version":"v19.0.0-nightly202210182672219b78","date":"2022-10-18","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-arm64-tar","osx-x64-pkg","osx-x64-tar","src","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"npm":"8.19.2","v8":"10.7.193.13","uv":"1.43.0","zlib":"1.2.11","openssl":"3.0.5+quic","modules":"111","lts":false,"security":false},
|
||||||
|
|
||||||
|
|
||||||
|
{"version":"v19.0.0-nightly202204201fe5d56403","date":"2022-04-20","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-arm64-tar","osx-x64-tar","src","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip"],"npm":"8.7.0","v8":"10.1.124.8","uv":"1.43.0","zlib":"1.2.11","openssl":"3.0.2+quic","modules":"108","lts":false,"security":false},
|
||||||
|
{"version":"v18.0.0-nightly20220419bde889bd4e","date":"2022-04-19","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-arm64-tar","osx-x64-pkg","osx-x64-tar","src","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip"],"npm":"8.7.0","v8":"10.1.124.8","uv":"1.43.0","zlib":"1.2.11","openssl":"3.0.2+quic","modules":"108","lts":false,"security":false},
|
||||||
|
{"version":"v18.0.0-nightly202204180699150267","date":"2022-04-18","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-arm64-tar","osx-x64-pkg","osx-x64-tar","src","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip"],"npm":"8.7.0","v8":"10.1.124.8","uv":"1.43.0","zlib":"1.2.11","openssl":"3.0.2+quic","modules":"108","lts":false,"security":false},
|
||||||
|
|
||||||
|
{"version":"v18.0.0-nightly202110204cb3e06ed8","date":"2021-10-20","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-arm64-tar","osx-x64-pkg","osx-x64-tar","src","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"npm":"8.1.0","v8":"9.5.172.21","uv":"1.42.0","zlib":"1.2.11","openssl":"3.0.0+quic","modules":"102","lts":false,"security":false},
|
||||||
|
{"version":"v17.5.0-nightly20220209e43808936a","date":"2022-02-09","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-arm64-tar","osx-x64-pkg","osx-x64-tar","src","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"npm":"8.4.1","v8":"9.6.180.15","uv":"1.43.0","zlib":"1.2.11","openssl":"3.0.1+quic","modules":"102","lts":false,"security":false},
|
||||||
|
{"version":"v17.0.0-nightly202110193f11666dc7","date":"2021-10-19","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-arm64-tar","osx-x64-pkg","osx-x64-tar","src","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"npm":"8.1.0","v8":"9.5.172.21","uv":"1.42.0","zlib":"1.2.11","openssl":"3.0.0+quic","modules":"102","lts":false,"security":false},
|
||||||
|
{"version":"v17.0.0-nightly20211018c0a70203de","date":"2021-10-18","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-arm64-tar","osx-x64-pkg","osx-x64-tar","src","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"npm":"8.0.0","v8":"9.5.172.21","uv":"1.42.0","zlib":"1.2.11","openssl":"3.0.0+quic","modules":"102","lts":false,"security":false},
|
||||||
|
|
||||||
|
{"version":"v16.0.0-nightly20210420a0261d231c","date":"2021-04-20","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-arm64-tar","osx-x64-pkg","osx-x64-tar","src","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"npm":"7.10.0","v8":"9.0.257.17","uv":"1.41.0","zlib":"1.2.11","openssl":"1.1.1k+quic","modules":"93","lts":false,"security":false},
|
||||||
|
{"version":"v16.0.0-nightly20210417bc31dc0e0f","date":"2021-04-17","files":["aix-ppc64","headers","linux-arm64","linux-ppc64le","linux-s390x","linux-x64","osx-arm64-tar","osx-x64-pkg","osx-x64-tar","src","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"npm":"7.10.0","v8":"9.0.257.17","uv":"1.41.0","zlib":"1.2.11","openssl":"1.1.1k+quic","modules":"93","lts":false,"security":false},
|
||||||
|
{"version":"v16.0.0-nightly20210416d3162da8dd","date":"2021-04-16","files":["aix-ppc64","headers","linux-arm64","linux-ppc64le","linux-s390x","linux-x64","osx-arm64-tar","osx-x64-pkg","osx-x64-tar","src","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"npm":"7.9.0","v8":"9.0.257.17","uv":"1.41.0","zlib":"1.2.11","openssl":"1.1.1k+quic","modules":"93","lts":false,"security":false},
|
||||||
|
{"version":"v16.0.0-nightly20210415c3a5e15ebe","date":"2021-04-15","files":["aix-ppc64","headers","linux-arm64","linux-ppc64le","linux-s390x","linux-x64","osx-arm64-tar","osx-x64-pkg","osx-x64-tar","src","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"npm":"7.9.0","v8":"9.0.257.17","uv":"1.41.0","zlib":"1.2.11","openssl":"1.1.1k+quic","modules":"93","lts":false,"security":false},
|
||||||
|
|
||||||
|
|
||||||
|
{"version":"v15.0.0-nightly2020102011f1ad939f","date":"2020-10-20","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-x64-pkg","osx-x64-tar","src","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"npm":"7.0.2","v8":"8.6.395.16","uv":"1.40.0","zlib":"1.2.11","openssl":"1.1.1g","modules":"88","lts":false,"security":false},
|
||||||
|
{"version":"v15.0.0-nightly20201019c55f661551","date":"2020-10-19","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-x64-pkg","osx-x64-tar","src","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"npm":"7.0.2","v8":"8.6.395.16","uv":"1.40.0","zlib":"1.2.11","openssl":"1.1.1g","modules":"88","lts":false,"security":false},
|
||||||
|
{"version":"v14.0.0-nightly20200421c3554307c6","date":"2020-04-21","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-x64-pkg","osx-x64-tar","src","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"npm":"6.14.4","v8":"8.1.307.30","uv":"1.37.0","zlib":"1.2.11","openssl":"1.1.1f","modules":"83","lts":false,"security":false},
|
||||||
|
{"version":"v14.0.0-nightly202004204af0598134","date":"2020-04-20","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-x64-pkg","osx-x64-tar","src","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"npm":"6.14.4","v8":"8.1.307.26","uv":"1.37.0","zlib":"1.2.11","openssl":"1.1.1f","modules":"83","lts":false,"security":false},
|
||||||
|
|
||||||
|
{"version":"v13.13.1-nightly20200415947ddec091","date":"2020-04-15","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-x64-pkg","osx-x64-tar","src","sunos-x64","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"npm":"6.14.4","v8":"7.9.317.25","uv":"1.35.0","zlib":"1.2.11","openssl":"1.1.1f","modules":"79","lts":false,"security":false},
|
||||||
|
{"version":"v13.11.1-nightly2020032628e298f219","date":"2020-03-26","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-x64-pkg","osx-x64-tar","src","sunos-x64","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"npm":"6.14.3","v8":"7.9.317.25","uv":"1.35.0","zlib":"1.2.11","openssl":"1.1.1e","modules":"79","lts":false,"security":false},
|
||||||
|
|
||||||
|
{"version":"v13.10.2-nightly202003056122620832","date":"2020-03-05","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-x64-pkg","osx-x64-tar","src","sunos-x64","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"npm":"6.13.7","v8":"7.9.317.25","uv":"1.34.2","zlib":"1.2.11","openssl":"1.1.1d","modules":"79","lts":false,"security":false},
|
||||||
|
{"version":"v13.9.1-nightly202003041bca7b6c70","date":"2020-03-04","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-x64-pkg","osx-x64-tar","src","sunos-x64","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"npm":"6.13.7","v8":"7.9.317.25","uv":"1.34.2","zlib":"1.2.11","openssl":"1.1.1d","modules":"79","lts":false,"security":false},
|
||||||
|
{"version":"v13.0.0-nightly201908175e3b4d6ed9","date":"2019-08-17","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-x64-pkg","osx-x64-tar","src","sunos-x64","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"npm":"6.10.2","v8":"7.6.303.28","uv":"1.31.0","zlib":"1.2.11","openssl":"1.1.1c","modules":"77","lts":false,"security":true},
|
||||||
|
{"version":"v13.0.0-nightly2019081671b5ce5885","date":"2019-08-16","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-x64-pkg","osx-x64-tar","src","sunos-x64","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"npm":"6.10.2","v8":"7.6.303.28","uv":"1.31.0","zlib":"1.2.11","openssl":"1.1.1c","modules":"77","lts":false,"security":true},
|
||||||
|
{"version":"v13.0.0-nightly2019072962a809fa54","date":"2019-07-29","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-x64-pkg","osx-x64-tar","src","sunos-x64","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"npm":"6.10.0","v8":"7.5.288.22","uv":"1.30.1","zlib":"1.2.11","openssl":"1.1.1c","modules":"74","lts":false,"security":false}
|
||||||
|
|
||||||
|
]
|
28
__tests__/data/node-rc-index.json
Normal file
28
__tests__/data/node-rc-index.json
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
[
|
||||||
|
{"version":"v19.0.0-rc.2","date":"2022-10-14","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-arm64-tar","osx-x64-pkg","osx-x64-tar","src","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"v8":"","uv":"","zlib":null,"openssl":null,"modules":null,"lts":false,"security":false},
|
||||||
|
{"version":"v19.0.0-rc.1","date":"2022-10-04","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-arm64-tar","osx-x64-pkg","osx-x64-tar","src","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"v8":"","uv":"","zlib":null,"openssl":null,"modules":null,"lts":false,"security":false},
|
||||||
|
{"version":"v17.0.0-rc.1","date":"2021-10-05","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-arm64-tar","osx-x64-pkg","osx-x64-tar","src","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"v8":"","uv":"","zlib":null,"openssl":null,"modules":null,"lts":false,"security":false},
|
||||||
|
{"version":"v17.0.0-rc.0","date":"2021-09-21","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-arm64-tar","osx-x64-pkg","osx-x64-tar","src","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"v8":"","uv":"","zlib":null,"openssl":null,"modules":null,"lts":false,"security":false},
|
||||||
|
{"version":"v16.17.0-rc.1","date":"2022-08-06","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-arm64-tar","osx-x64-pkg","osx-x64-tar","src","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"v8":"","uv":"","zlib":null,"openssl":null,"modules":null,"lts":false,"security":false},
|
||||||
|
{"version":"v16.0.0-rc.2","date":"2021-04-07","files":["headers","linux-arm64","linux-ppc64le","linux-x64","osx-x64-pkg","osx-x64-tar","src"],"v8":"","uv":"","zlib":null,"openssl":null,"modules":null,"lts":false,"security":false},
|
||||||
|
{"version":"v16.0.0-rc.1","date":"2021-03-30","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-x64-pkg","osx-x64-tar","src","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"v8":"","uv":"","zlib":null,"openssl":null,"modules":null,"lts":false,"security":false},
|
||||||
|
{"version":"v16.0.0-rc.0","date":"2021-03-19","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-x64-pkg","osx-x64-tar","src","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"v8":"","uv":"","zlib":null,"openssl":null,"modules":null,"lts":false,"security":false},
|
||||||
|
{"version":"v14.19.0-rc.0","date":"2022-01-25","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-x64-pkg","osx-x64-tar","src","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"v8":"","uv":"","zlib":null,"openssl":null,"modules":null,"lts":false,"security":false},
|
||||||
|
{"version":"v14.18.0-rc.0","date":"2021-09-08","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-x64-pkg","osx-x64-tar","src","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"v8":"","uv":"","zlib":null,"openssl":null,"modules":null,"lts":false,"security":false},
|
||||||
|
{"version":"v14.17.4-rc.0","date":"2021-07-20","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-x64-pkg","osx-x64-tar","src","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"v8":"","uv":"","zlib":null,"openssl":null,"modules":null,"lts":false,"security":false},
|
||||||
|
{"version":"v14.17.1-rc.0","date":"2021-06-11","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-x64-pkg","osx-x64-tar","src","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"v8":"","uv":"","zlib":null,"openssl":null,"modules":null,"lts":false,"security":false},
|
||||||
|
{"version":"v14.16.0-rc.0","date":"2021-02-22","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-x64-pkg","osx-x64-tar","src","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"v8":"","uv":"","zlib":null,"openssl":null,"modules":null,"lts":false,"security":false},
|
||||||
|
{"version":"v14.15.5-rc.1","date":"2021-02-08","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-x64-pkg","osx-x64-tar","src","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"v8":"","uv":"","zlib":null,"openssl":null,"modules":null,"lts":false,"security":false},
|
||||||
|
{"version":"v14.15.5-rc.0","date":"2021-01-27","files":["headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-x64-pkg","osx-x64-tar","src","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"v8":"","uv":"","zlib":null,"openssl":null,"modules":null,"lts":false,"security":false},
|
||||||
|
{"version":"v14.15.2-rc.0","date":"2020-12-14","files":["headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-x64-tar","src","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"v8":"","uv":"","zlib":null,"openssl":null,"modules":null,"lts":false,"security":false},
|
||||||
|
{"version":"v14.7.0-rc.1","date":"2020-07-29","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-x64-pkg","osx-x64-tar","src","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"v8":"","uv":"","zlib":null,"openssl":null,"modules":null,"lts":false,"security":false},
|
||||||
|
{"version":"v13.11.0-rc.1","date":"2020-03-11","files":["headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-x64","osx-x64-pkg","osx-x64-tar","src","sunos-x64","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"v8":"","uv":"","zlib":null,"openssl":null,"modules":null,"lts":false,"security":false},
|
||||||
|
{"version":"v13.11.0-rc.0","date":"2020-03-10","files":["headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-x64","osx-x64-pkg","src","sunos-x64","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip"],"v8":"","uv":"","zlib":null,"openssl":null,"modules":null,"lts":false,"security":false},
|
||||||
|
{"version":"v13.10.1-rc.0","date":"2020-03-04","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-x64-pkg","osx-x64-tar","src","sunos-x64","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip"],"v8":"","uv":"","zlib":null,"openssl":null,"modules":null,"lts":false,"security":false},
|
||||||
|
{"version":"v13.4.0-rc.0","date":"2019-12-13","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-x64-pkg","osx-x64-tar","src","sunos-x64","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"v8":"","uv":"","zlib":null,"openssl":null,"modules":null,"lts":false,"security":false},
|
||||||
|
{"version":"v13.0.1-rc.0","date":"2019-10-23","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-x64-pkg","osx-x64-tar","src","sunos-x64","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"v8":"","uv":"","zlib":null,"openssl":null,"modules":null,"lts":false,"security":false},
|
||||||
|
{"version":"v13.0.0-rc.3","date":"2019-10-21","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-x64-pkg","osx-x64-tar","src","sunos-x64","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"v8":"","uv":"","zlib":null,"openssl":null,"modules":null,"lts":false,"security":false},
|
||||||
|
{"version":"v13.0.0-rc.2","date":"2019-10-15","files":["headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-x64-pkg","osx-x64-tar","src","sunos-x64","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"v8":"","uv":"","zlib":null,"openssl":null,"modules":null,"lts":false,"security":false},
|
||||||
|
{"version":"v13.0.0-rc.1","date":"2019-10-01","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-x64-pkg","osx-x64-tar","src","sunos-x64","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"v8":"","uv":"","zlib":null,"openssl":null,"modules":null,"lts":false,"security":false},
|
||||||
|
{"version":"v13.0.0-rc.0","date":"2019-09-25","files":["aix-ppc64","headers","linux-arm64","linux-armv7l","linux-ppc64le","linux-s390x","linux-x64","osx-x64-pkg","osx-x64-tar","src","sunos-x64","win-x64-7z","win-x64-exe","win-x64-msi","win-x64-zip","win-x86-7z","win-x86-exe","win-x86-msi","win-x86-zip"],"v8":"","uv":"","zlib":null,"openssl":null,"modules":null,"lts":false,"security":false}
|
||||||
|
]
|
@ -4,6 +4,7 @@ import * as tc from '@actions/tool-cache';
|
|||||||
import * as exec from '@actions/exec';
|
import * as exec from '@actions/exec';
|
||||||
import * as im from '../src/installer';
|
import * as im from '../src/installer';
|
||||||
import * as cache from '@actions/cache';
|
import * as cache from '@actions/cache';
|
||||||
|
import * as httpm from '@actions/http-client';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import cp from 'child_process';
|
import cp from 'child_process';
|
||||||
import osm from 'os';
|
import osm from 'os';
|
||||||
@ -12,8 +13,10 @@ import each from 'jest-each';
|
|||||||
import * as main from '../src/main';
|
import * as main from '../src/main';
|
||||||
import * as auth from '../src/authutil';
|
import * as auth from '../src/authutil';
|
||||||
|
|
||||||
let nodeTestManifest = require('./data/versions-manifest.json');
|
const nodeTestManifest = require('./data/versions-manifest.json');
|
||||||
let nodeTestDist = require('./data/node-dist-index.json');
|
const nodeTestDist = require('./data/node-dist-index.json');
|
||||||
|
const nodeTestDistNightly = require('./data/node-nightly-index.json');
|
||||||
|
const nodeTestDistRc = require('./data/node-rc-index.json');
|
||||||
|
|
||||||
describe('setup-node', () => {
|
describe('setup-node', () => {
|
||||||
let inputs = {} as any;
|
let inputs = {} as any;
|
||||||
@ -21,6 +24,7 @@ describe('setup-node', () => {
|
|||||||
|
|
||||||
let inSpy: jest.SpyInstance;
|
let inSpy: jest.SpyInstance;
|
||||||
let findSpy: jest.SpyInstance;
|
let findSpy: jest.SpyInstance;
|
||||||
|
let findAllVersionsSpy: jest.SpyInstance;
|
||||||
let cnSpy: jest.SpyInstance;
|
let cnSpy: jest.SpyInstance;
|
||||||
let logSpy: jest.SpyInstance;
|
let logSpy: jest.SpyInstance;
|
||||||
let warningSpy: jest.SpyInstance;
|
let warningSpy: jest.SpyInstance;
|
||||||
@ -41,6 +45,7 @@ describe('setup-node', () => {
|
|||||||
let parseNodeVersionSpy: jest.SpyInstance;
|
let parseNodeVersionSpy: jest.SpyInstance;
|
||||||
let isCacheActionAvailable: jest.SpyInstance;
|
let isCacheActionAvailable: jest.SpyInstance;
|
||||||
let getExecOutputSpy: jest.SpyInstance;
|
let getExecOutputSpy: jest.SpyInstance;
|
||||||
|
let getJsonSpy: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
// @actions/core
|
// @actions/core
|
||||||
@ -61,6 +66,7 @@ describe('setup-node', () => {
|
|||||||
|
|
||||||
// @actions/tool-cache
|
// @actions/tool-cache
|
||||||
findSpy = jest.spyOn(tc, 'find');
|
findSpy = jest.spyOn(tc, 'find');
|
||||||
|
findAllVersionsSpy = jest.spyOn(tc, 'findAllVersions');
|
||||||
dlSpy = jest.spyOn(tc, 'downloadTool');
|
dlSpy = jest.spyOn(tc, 'downloadTool');
|
||||||
exSpy = jest.spyOn(tc, 'extractTar');
|
exSpy = jest.spyOn(tc, 'extractTar');
|
||||||
cacheSpy = jest.spyOn(tc, 'cacheDir');
|
cacheSpy = jest.spyOn(tc, 'cacheDir');
|
||||||
@ -68,6 +74,9 @@ describe('setup-node', () => {
|
|||||||
getDistSpy = jest.spyOn(im, 'getVersionsFromDist');
|
getDistSpy = jest.spyOn(im, 'getVersionsFromDist');
|
||||||
parseNodeVersionSpy = jest.spyOn(im, 'parseNodeVersionFile');
|
parseNodeVersionSpy = jest.spyOn(im, 'parseNodeVersionFile');
|
||||||
|
|
||||||
|
// http-client
|
||||||
|
getJsonSpy = jest.spyOn(httpm.HttpClient.prototype, 'getJson');
|
||||||
|
|
||||||
// io
|
// io
|
||||||
whichSpy = jest.spyOn(io, 'which');
|
whichSpy = jest.spyOn(io, 'which');
|
||||||
existsSpy = jest.spyOn(fs, 'existsSync');
|
existsSpy = jest.spyOn(fs, 'existsSync');
|
||||||
@ -84,7 +93,30 @@ describe('setup-node', () => {
|
|||||||
getManifestSpy.mockImplementation(
|
getManifestSpy.mockImplementation(
|
||||||
() => <tc.IToolRelease[]>nodeTestManifest
|
() => <tc.IToolRelease[]>nodeTestManifest
|
||||||
);
|
);
|
||||||
getDistSpy.mockImplementation(() => <im.INodeVersion>nodeTestDist);
|
|
||||||
|
getDistSpy.mockImplementation(version => {
|
||||||
|
const initialUrl = im.getNodejsDistUrl(version);
|
||||||
|
if (initialUrl.endsWith('/rc')) {
|
||||||
|
return <im.INodeVersion>nodeTestDistRc;
|
||||||
|
} else if (initialUrl.endsWith('/nightly')) {
|
||||||
|
return <im.INodeVersion>nodeTestDistNightly;
|
||||||
|
} else {
|
||||||
|
return <im.INodeVersion>nodeTestDist;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
getJsonSpy.mockImplementation(url => {
|
||||||
|
let res: any;
|
||||||
|
if (url.includes('/rc')) {
|
||||||
|
res = <im.INodeVersion>nodeTestDistRc;
|
||||||
|
} else if (url.includes('/nightly')) {
|
||||||
|
res = <im.INodeVersion>nodeTestDistNightly;
|
||||||
|
} else {
|
||||||
|
res = <im.INodeVersion>nodeTestDist;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {result: res};
|
||||||
|
});
|
||||||
|
|
||||||
// writes
|
// writes
|
||||||
cnSpy = jest.spyOn(process.stdout, 'write');
|
cnSpy = jest.spyOn(process.stdout, 'write');
|
||||||
@ -359,6 +391,18 @@ describe('setup-node', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('acquires specified architecture of node', async () => {
|
it('acquires specified architecture of node', async () => {
|
||||||
|
getJsonSpy.mockImplementation(url => {
|
||||||
|
let res: any;
|
||||||
|
if (url.includes('/rc')) {
|
||||||
|
res = <im.INodeVersion>nodeTestDistRc;
|
||||||
|
} else if (url.includes('/nightly')) {
|
||||||
|
res = <im.INodeVersion>nodeTestDistNightly;
|
||||||
|
} else {
|
||||||
|
res = <im.INodeVersion>nodeTestDist;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {result: res};
|
||||||
|
});
|
||||||
for (const {arch, version, osSpec} of [
|
for (const {arch, version, osSpec} of [
|
||||||
{arch: 'x86', version: '12.16.2', osSpec: 'win32'},
|
{arch: 'x86', version: '12.16.2', osSpec: 'win32'},
|
||||||
{arch: 'x86', version: '14.0.0', osSpec: 'win32'}
|
{arch: 'x86', version: '14.0.0', osSpec: 'win32'}
|
||||||
@ -399,6 +443,20 @@ describe('setup-node', () => {
|
|||||||
}, 100000);
|
}, 100000);
|
||||||
|
|
||||||
describe('check-latest flag', () => {
|
describe('check-latest flag', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
getJsonSpy.mockImplementation(url => {
|
||||||
|
let res: any;
|
||||||
|
if (url.includes('/rc')) {
|
||||||
|
res = <im.INodeVersion>nodeTestDistRc;
|
||||||
|
} else if (url.includes('/nightly')) {
|
||||||
|
res = <im.INodeVersion>nodeTestDistNightly;
|
||||||
|
} else {
|
||||||
|
res = <im.INodeVersion>nodeTestDist;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {result: res};
|
||||||
|
});
|
||||||
|
});
|
||||||
it('use local version and dont check manifest if check-latest is not specified', async () => {
|
it('use local version and dont check manifest if check-latest is not specified', async () => {
|
||||||
os.platform = 'linux';
|
os.platform = 'linux';
|
||||||
os.arch = 'x64';
|
os.arch = 'x64';
|
||||||
@ -897,10 +955,323 @@ describe('setup-node', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('rc versions', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
getJsonSpy.mockImplementation(url => {
|
||||||
|
let res: any;
|
||||||
|
if (url.includes('/rc')) {
|
||||||
|
res = <im.INodeVersion>nodeTestDistRc;
|
||||||
|
} else if (url.includes('/nightly')) {
|
||||||
|
res = <im.INodeVersion>nodeTestDistNightly;
|
||||||
|
} else {
|
||||||
|
res = <im.INodeVersion>nodeTestDist;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {result: res};
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it.each([
|
||||||
|
[
|
||||||
|
'13.10.1-rc.0',
|
||||||
|
'13.10.1-rc.0',
|
||||||
|
'https://nodejs.org/download/rc/v13.10.1-rc.0/node-v13.10.1-rc.0-linux-x64.tar.gz'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'14.15.5-rc.1',
|
||||||
|
'14.15.5-rc.1',
|
||||||
|
'https://nodejs.org/download/rc/v14.15.5-rc.1/node-v14.15.5-rc.1-linux-x64.tar.gz'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'16.17.0-rc.1',
|
||||||
|
'16.17.0-rc.1',
|
||||||
|
'https://nodejs.org/download/rc/v16.17.0-rc.1/node-v16.17.0-rc.1-linux-x64.tar.gz'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'17.0.0-rc.1',
|
||||||
|
'17.0.0-rc.1',
|
||||||
|
'https://nodejs.org/download/rc/v17.0.0-rc.1/node-v17.0.0-rc.1-linux-x64.tar.gz'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'19.0.0-rc.2',
|
||||||
|
'19.0.0-rc.2',
|
||||||
|
'https://nodejs.org/download/rc/v19.0.0-rc.2/node-v19.0.0-rc.2-linux-x64.tar.gz'
|
||||||
|
]
|
||||||
|
])(
|
||||||
|
'finds the versions in the index.json and installs it',
|
||||||
|
async (input, expectedVersion, expectedUrl) => {
|
||||||
|
const toolPath = path.normalize(`/cache/node/${expectedVersion}/x64`);
|
||||||
|
|
||||||
|
findSpy.mockImplementation(() => '');
|
||||||
|
findAllVersionsSpy.mockImplementation(() => []);
|
||||||
|
dlSpy.mockImplementation(async () => '/some/temp/path');
|
||||||
|
exSpy.mockImplementation(async () => '/some/other/temp/path');
|
||||||
|
cacheSpy.mockImplementation(async () => toolPath);
|
||||||
|
|
||||||
|
inputs['node-version'] = input;
|
||||||
|
os['arch'] = 'x64';
|
||||||
|
os['platform'] = 'linux';
|
||||||
|
// act
|
||||||
|
await main.run();
|
||||||
|
|
||||||
|
// assert
|
||||||
|
expect(logSpy).toHaveBeenCalledWith(
|
||||||
|
`Attempting to download ${input}...`
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(logSpy).toHaveBeenCalledWith(
|
||||||
|
`Acquiring ${expectedVersion} - ${os.arch} from ${expectedUrl}`
|
||||||
|
);
|
||||||
|
expect(logSpy).toHaveBeenCalledWith('Extracting ...');
|
||||||
|
expect(logSpy).toHaveBeenCalledWith('Adding to the cache ...');
|
||||||
|
expect(cnSpy).toHaveBeenCalledWith(
|
||||||
|
`::add-path::${path.join(toolPath, 'bin')}${osm.EOL}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
it.each([
|
||||||
|
['13.10.1-rc.0', '13.10.1-rc.0'],
|
||||||
|
['14.15.5-rc.1', '14.15.5-rc.1'],
|
||||||
|
['16.17.0-rc.1', '16.17.0-rc.1'],
|
||||||
|
['17.0.0-rc.1', '17.0.0-rc.1']
|
||||||
|
])(
|
||||||
|
'finds the %s version in the hostedToolcache',
|
||||||
|
async (input, expectedVersion) => {
|
||||||
|
const toolPath = path.normalize(`/cache/node/${expectedVersion}/x64`);
|
||||||
|
findSpy.mockReturnValue(toolPath);
|
||||||
|
|
||||||
|
inputs['node-version'] = input;
|
||||||
|
os['arch'] = 'x64';
|
||||||
|
os['platform'] = 'linux';
|
||||||
|
|
||||||
|
// act
|
||||||
|
await main.run();
|
||||||
|
|
||||||
|
// assert
|
||||||
|
expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`);
|
||||||
|
expect(cnSpy).toHaveBeenCalledWith(
|
||||||
|
`::add-path::${path.join(toolPath, 'bin')}${osm.EOL}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
it('throws an error if version is not found', async () => {
|
||||||
|
const versionSpec = '19.0.0-rc.3';
|
||||||
|
|
||||||
|
findSpy.mockImplementation(() => '');
|
||||||
|
findAllVersionsSpy.mockImplementation(() => []);
|
||||||
|
dlSpy.mockImplementation(async () => '/some/temp/path');
|
||||||
|
exSpy.mockImplementation(async () => '/some/other/temp/path');
|
||||||
|
|
||||||
|
inputs['node-version'] = versionSpec;
|
||||||
|
os['arch'] = 'x64';
|
||||||
|
os['platform'] = 'linux';
|
||||||
|
// act
|
||||||
|
await main.run();
|
||||||
|
|
||||||
|
// assert
|
||||||
|
expect(logSpy).toHaveBeenCalledWith(
|
||||||
|
`Attempting to download ${versionSpec}...`
|
||||||
|
);
|
||||||
|
expect(cnSpy).toHaveBeenCalledWith(
|
||||||
|
`::error::Unable to find Node version '${versionSpec}' for platform ${os.platform} and architecture ${os.arch}.${osm.EOL}`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('nightly versions', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
getJsonSpy.mockImplementation(url => {
|
||||||
|
let res: any;
|
||||||
|
if (url.includes('/rc')) {
|
||||||
|
res = <im.INodeVersion>nodeTestDistRc;
|
||||||
|
} else if (url.includes('/nightly')) {
|
||||||
|
res = <im.INodeVersion>nodeTestDistNightly;
|
||||||
|
} else {
|
||||||
|
res = <im.INodeVersion>nodeTestDist;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {result: res};
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it.each([
|
||||||
|
[
|
||||||
|
'17.5.0-nightly',
|
||||||
|
'17.5.0-nightly20220209e43808936a',
|
||||||
|
'https://nodejs.org/download/nightly/v17.5.0-nightly20220209e43808936a/node-v17.5.0-nightly20220209e43808936a-linux-x64.tar.gz'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'17-nightly',
|
||||||
|
'17.5.0-nightly20220209e43808936a',
|
||||||
|
'https://nodejs.org/download/nightly/v17.5.0-nightly20220209e43808936a/node-v17.5.0-nightly20220209e43808936a-linux-x64.tar.gz'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'18.0.0-nightly',
|
||||||
|
'18.0.0-nightly20220419bde889bd4e',
|
||||||
|
'https://nodejs.org/download/nightly/v18.0.0-nightly20220419bde889bd4e/node-v18.0.0-nightly20220419bde889bd4e-linux-x64.tar.gz'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'18-nightly',
|
||||||
|
'18.0.0-nightly20220419bde889bd4e',
|
||||||
|
'https://nodejs.org/download/nightly/v18.0.0-nightly20220419bde889bd4e/node-v18.0.0-nightly20220419bde889bd4e-linux-x64.tar.gz'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'20.0.0-nightly',
|
||||||
|
'20.0.0-nightly2022101987cdf7d412',
|
||||||
|
'https://nodejs.org/download/nightly/v20.0.0-nightly2022101987cdf7d412/node-v20.0.0-nightly2022101987cdf7d412-linux-x64.tar.gz'
|
||||||
|
]
|
||||||
|
])(
|
||||||
|
'finds the versions in the index.json and installs it',
|
||||||
|
async (input, expectedVersion, expectedUrl) => {
|
||||||
|
const toolPath = path.normalize(`/cache/node/${expectedVersion}/x64`);
|
||||||
|
|
||||||
|
findSpy.mockImplementation(() => '');
|
||||||
|
findAllVersionsSpy.mockImplementation(() => []);
|
||||||
|
dlSpy.mockImplementation(async () => '/some/temp/path');
|
||||||
|
exSpy.mockImplementation(async () => '/some/other/temp/path');
|
||||||
|
cacheSpy.mockImplementation(async () => toolPath);
|
||||||
|
|
||||||
|
inputs['node-version'] = input;
|
||||||
|
os['arch'] = 'x64';
|
||||||
|
os['platform'] = 'linux';
|
||||||
|
// act
|
||||||
|
await main.run();
|
||||||
|
|
||||||
|
// assert
|
||||||
|
expect(logSpy).toHaveBeenCalledWith(
|
||||||
|
`Attempting to download ${input}...`
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(logSpy).toHaveBeenCalledWith(
|
||||||
|
`Acquiring ${expectedVersion} - ${os.arch} from ${expectedUrl}`
|
||||||
|
);
|
||||||
|
expect(logSpy).toHaveBeenCalledWith('Extracting ...');
|
||||||
|
expect(logSpy).toHaveBeenCalledWith('Adding to the cache ...');
|
||||||
|
expect(cnSpy).toHaveBeenCalledWith(
|
||||||
|
`::add-path::${path.join(toolPath, 'bin')}${osm.EOL}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
it.each([
|
||||||
|
['17.5.0-nightly', '17.5.0-nightly20220209e43808936a'],
|
||||||
|
['17-nightly', '17.5.0-nightly20220209e43808936a'],
|
||||||
|
['20.0.0-nightly', '20.0.0-nightly2022101987cdf7d412']
|
||||||
|
])(
|
||||||
|
'finds the %s version in the hostedToolcache',
|
||||||
|
async (input, expectedVersion) => {
|
||||||
|
const toolPath = path.normalize(`/cache/node/${expectedVersion}/x64`);
|
||||||
|
findSpy.mockReturnValue(toolPath);
|
||||||
|
findAllVersionsSpy.mockReturnValue([
|
||||||
|
'17.5.0-nightly20220209e43808936a',
|
||||||
|
'17.5.0-nightly20220209e43808935a',
|
||||||
|
'20.0.0-nightly2022101987cdf7d412',
|
||||||
|
'20.0.0-nightly2022101987cdf7d411'
|
||||||
|
]);
|
||||||
|
|
||||||
|
inputs['node-version'] = input;
|
||||||
|
os['arch'] = 'x64';
|
||||||
|
os['platform'] = 'linux';
|
||||||
|
|
||||||
|
// act
|
||||||
|
await main.run();
|
||||||
|
|
||||||
|
// assert
|
||||||
|
expect(findAllVersionsSpy).toHaveBeenCalled();
|
||||||
|
expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`);
|
||||||
|
expect(cnSpy).toHaveBeenCalledWith(
|
||||||
|
`::add-path::${path.join(toolPath, 'bin')}${osm.EOL}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
it.each([
|
||||||
|
[
|
||||||
|
'17.5.0-nightly',
|
||||||
|
'17.5.0-nightly20220209e43808936a',
|
||||||
|
'17.0.0-nightly202110193f11666dc7',
|
||||||
|
'https://nodejs.org/download/nightly/v17.5.0-nightly20220209e43808936a/node-v17.5.0-nightly20220209e43808936a-linux-x64.tar.gz'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'17-nightly',
|
||||||
|
'17.5.0-nightly20220209e43808936a',
|
||||||
|
'17.0.0-nightly202110193f11666dc7',
|
||||||
|
'https://nodejs.org/download/nightly/v17.5.0-nightly20220209e43808936a/node-v17.5.0-nightly20220209e43808936a-linux-x64.tar.gz'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'18.0.0-nightly',
|
||||||
|
'18.0.0-nightly20220419bde889bd4e',
|
||||||
|
'18.0.0-nightly202204180699150267',
|
||||||
|
'https://nodejs.org/download/nightly/v18.0.0-nightly20220419bde889bd4e/node-v18.0.0-nightly20220419bde889bd4e-linux-x64.tar.gz'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'18-nightly',
|
||||||
|
'18.0.0-nightly20220419bde889bd4e',
|
||||||
|
'18.0.0-nightly202204180699150267',
|
||||||
|
'https://nodejs.org/download/nightly/v18.0.0-nightly20220419bde889bd4e/node-v18.0.0-nightly20220419bde889bd4e-linux-x64.tar.gz'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'20.0.0-nightly',
|
||||||
|
'20.0.0-nightly2022101987cdf7d412',
|
||||||
|
'20.0.0-nightly2022101987cdf7d411',
|
||||||
|
'https://nodejs.org/download/nightly/v20.0.0-nightly2022101987cdf7d412/node-v20.0.0-nightly2022101987cdf7d412-linux-x64.tar.gz'
|
||||||
|
]
|
||||||
|
])(
|
||||||
|
'get %s version from dist if check-latest is true',
|
||||||
|
async (input, expectedVersion, foundVersion, expectedUrl) => {
|
||||||
|
const foundToolPath = path.normalize(`/cache/node/${foundVersion}/x64`);
|
||||||
|
const toolPath = path.normalize(`/cache/node/${expectedVersion}/x64`);
|
||||||
|
|
||||||
|
inputs['node-version'] = input;
|
||||||
|
inputs['check-latest'] = 'true';
|
||||||
|
os['arch'] = 'x64';
|
||||||
|
os['platform'] = 'linux';
|
||||||
|
|
||||||
|
findSpy.mockReturnValue(foundToolPath);
|
||||||
|
findAllVersionsSpy.mockReturnValue([
|
||||||
|
'17.0.0-nightly202110193f11666dc7',
|
||||||
|
'18.0.0-nightly202204180699150267',
|
||||||
|
'20.0.0-nightly2022101987cdf7d411'
|
||||||
|
]);
|
||||||
|
dlSpy.mockImplementation(async () => '/some/temp/path');
|
||||||
|
exSpy.mockImplementation(async () => '/some/other/temp/path');
|
||||||
|
cacheSpy.mockImplementation(async () => toolPath);
|
||||||
|
|
||||||
|
// act
|
||||||
|
await main.run();
|
||||||
|
|
||||||
|
// assert
|
||||||
|
expect(findAllVersionsSpy).toHaveBeenCalled();
|
||||||
|
expect(logSpy).toHaveBeenCalledWith(
|
||||||
|
`Acquiring ${expectedVersion} - ${os.arch} from ${expectedUrl}`
|
||||||
|
);
|
||||||
|
expect(logSpy).toHaveBeenCalledWith('Extracting ...');
|
||||||
|
expect(logSpy).toHaveBeenCalledWith('Adding to the cache ...');
|
||||||
|
expect(cnSpy).toHaveBeenCalledWith(
|
||||||
|
`::add-path::${path.join(toolPath, 'bin')}${osm.EOL}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
describe('latest alias syntax', () => {
|
describe('latest alias syntax', () => {
|
||||||
it.each(['latest', 'current', 'node'])(
|
it.each(['latest', 'current', 'node'])(
|
||||||
'download the %s version if alias is provided',
|
'download the %s version if alias is provided',
|
||||||
async inputVersion => {
|
async inputVersion => {
|
||||||
|
getJsonSpy.mockImplementation(url => {
|
||||||
|
let res: any;
|
||||||
|
if (url.includes('/rc')) {
|
||||||
|
res = <im.INodeVersion>nodeTestDistRc;
|
||||||
|
} else if (url.includes('/nightly')) {
|
||||||
|
res = <im.INodeVersion>nodeTestDistNightly;
|
||||||
|
} else {
|
||||||
|
res = <im.INodeVersion>nodeTestDist;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {result: res};
|
||||||
|
});
|
||||||
// Arrange
|
// Arrange
|
||||||
inputs['node-version'] = inputVersion;
|
inputs['node-version'] = inputVersion;
|
||||||
|
|
||||||
@ -927,6 +1298,18 @@ describe('setup-node', () => {
|
|||||||
it.each(['latest', 'current', 'node'])(
|
it.each(['latest', 'current', 'node'])(
|
||||||
'download the %s version if alias is provided',
|
'download the %s version if alias is provided',
|
||||||
async inputVersion => {
|
async inputVersion => {
|
||||||
|
getJsonSpy.mockImplementation(url => {
|
||||||
|
let res: any;
|
||||||
|
if (url.includes('/rc')) {
|
||||||
|
res = <im.INodeVersion>nodeTestDistRc;
|
||||||
|
} else if (url.includes('/nightly')) {
|
||||||
|
res = <im.INodeVersion>nodeTestDistNightly;
|
||||||
|
} else {
|
||||||
|
res = <im.INodeVersion>nodeTestDist;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {result: res};
|
||||||
|
});
|
||||||
// Arrange
|
// Arrange
|
||||||
inputs['node-version'] = inputVersion;
|
inputs['node-version'] = inputVersion;
|
||||||
const expectedVersion = nodeTestDist[0];
|
const expectedVersion = nodeTestDist[0];
|
||||||
|
7
dist/setup/index.js
vendored
7
dist/setup/index.js
vendored
@ -73428,10 +73428,10 @@ function evaluateNightlyVersions(versions, versionSpec) {
|
|||||||
const rawVersion = isValidVersion ? raw : semver.coerce(raw);
|
const rawVersion = isValidVersion ? raw : semver.coerce(raw);
|
||||||
if (rawVersion) {
|
if (rawVersion) {
|
||||||
if (prerelease !== 'nightly') {
|
if (prerelease !== 'nightly') {
|
||||||
range = `${rawVersion}+${prerelease.replace('nightly', 'nightly.')}`;
|
range = `${rawVersion}-${prerelease.replace('nightly', 'nightly.')}`;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
range = semver.validRange(`^${rawVersion}`);
|
range = `${semver.validRange(`^${rawVersion}-0`)}-0`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (range) {
|
if (range) {
|
||||||
@ -73443,7 +73443,7 @@ function evaluateNightlyVersions(versions, versionSpec) {
|
|||||||
});
|
});
|
||||||
for (let i = versions.length - 1; i >= 0; i--) {
|
for (let i = versions.length - 1; i >= 0; i--) {
|
||||||
const potential = versions[i];
|
const potential = versions[i];
|
||||||
const satisfied = semver.satisfies(potential.replace('-nightly', '+nightly.'), range);
|
const satisfied = semver.satisfies(potential.replace('-nightly', '-nightly.'), range, { includePrerelease: true });
|
||||||
if (satisfied) {
|
if (satisfied) {
|
||||||
version = potential;
|
version = potential;
|
||||||
break;
|
break;
|
||||||
@ -73499,6 +73499,7 @@ function getNodejsDistUrl(version) {
|
|||||||
return 'https://nodejs.org/download/rc';
|
return 'https://nodejs.org/download/rc';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
exports.getNodejsDistUrl = getNodejsDistUrl;
|
||||||
function queryDistForMatch(versionSpec, arch = os.arch(), nodeVersions) {
|
function queryDistForMatch(versionSpec, arch = os.arch(), nodeVersions) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let osPlat = os.platform();
|
let osPlat = os.platform();
|
||||||
|
@ -376,9 +376,9 @@ function evaluateNightlyVersions(
|
|||||||
const rawVersion = isValidVersion ? raw : semver.coerce(raw);
|
const rawVersion = isValidVersion ? raw : semver.coerce(raw);
|
||||||
if (rawVersion) {
|
if (rawVersion) {
|
||||||
if (prerelease !== 'nightly') {
|
if (prerelease !== 'nightly') {
|
||||||
range = `${rawVersion}+${prerelease.replace('nightly', 'nightly.')}`;
|
range = `${rawVersion}-${prerelease.replace('nightly', 'nightly.')}`;
|
||||||
} else {
|
} else {
|
||||||
range = semver.validRange(`^${rawVersion}`);
|
range = `${semver.validRange(`^${rawVersion}-0`)}-0`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,8 +392,9 @@ function evaluateNightlyVersions(
|
|||||||
for (let i = versions.length - 1; i >= 0; i--) {
|
for (let i = versions.length - 1; i >= 0; i--) {
|
||||||
const potential: string = versions[i];
|
const potential: string = versions[i];
|
||||||
const satisfied: boolean = semver.satisfies(
|
const satisfied: boolean = semver.satisfies(
|
||||||
potential.replace('-nightly', '+nightly.'),
|
potential.replace('-nightly', '-nightly.'),
|
||||||
range
|
range,
|
||||||
|
{includePrerelease: true}
|
||||||
);
|
);
|
||||||
if (satisfied) {
|
if (satisfied) {
|
||||||
version = potential;
|
version = potential;
|
||||||
@ -444,7 +445,7 @@ function evaluateVersions(versions: string[], versionSpec: string): string {
|
|||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNodejsDistUrl(version: string) {
|
export function getNodejsDistUrl(version: string) {
|
||||||
const prerelease = semver.prerelease(version);
|
const prerelease = semver.prerelease(version);
|
||||||
if (version.includes('nightly')) {
|
if (version.includes('nightly')) {
|
||||||
return 'https://nodejs.org/download/nightly';
|
return 'https://nodejs.org/download/nightly';
|
||||||
|
Loading…
Reference in New Issue
Block a user