Skip to content

Commit

Permalink
update version checks for v16 (#1522)
Browse files Browse the repository at this point in the history
* update version checks for v16

Ref: nodejs/node#40504

* add test to check old ESM Loader Hooks API on v16.11.1

* fix wrong version number
  • Loading branch information
shrujalshah28 committed Oct 21, 2021
1 parent 3b40365 commit b16134b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/continuous-integration.yml
Expand Up @@ -48,7 +48,7 @@ jobs:
matrix:
os: [ubuntu, windows]
# Don't forget to add all new flavors to this list!
flavor: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
flavor: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
include:
# Node 12.15
# TODO Add comments about why we test 12.15; I think git blame says it's because of an ESM behavioral change that happened at 12.16
Expand Down Expand Up @@ -94,26 +94,33 @@ jobs:
typescript: next
typescriptFlag: next
# Node 16
# Node 16.11.1
# Earliest version that supports old ESM Loader Hooks API: https://github.com/TypeStrong/ts-node/pull/1522
- flavor: 8
node: 16.11.1
nodeFlag: 16_11_1
typescript: latest
typescriptFlag: latest
- flavor: 9
node: 16
nodeFlag: 16
typescript: latest
typescriptFlag: latest
downgradeNpm: true
- flavor: 9
- flavor: 10
node: 16
nodeFlag: 16
typescript: 2.7
typescriptFlag: 2_7
downgradeNpm: true
- flavor: 10
- flavor: 11
node: 16
nodeFlag: 16
typescript: next
typescriptFlag: next
downgradeNpm: true
# Node nightly
- flavor: 11
- flavor: 12
node: nightly
nodeFlag: nightly
typescript: latest
Expand Down
4 changes: 2 additions & 2 deletions src/esm.ts
Expand Up @@ -54,10 +54,10 @@ export function createEsmHooks(tsNodeService: Service) {
});

// The hooks API changed in node version X so we need to check for backwards compatibility.
// TODO: When the new API is backported to v12, v14, v16, update these version checks accordingly.
// TODO: When the new API is backported to v12, v14, update these version checks accordingly.
const newHooksAPI =
versionGteLt(process.versions.node, '17.0.0') ||
versionGteLt(process.versions.node, '16.999.999', '17.0.0') ||
versionGteLt(process.versions.node, '16.12.0', '17.0.0') ||
versionGteLt(process.versions.node, '14.999.999', '15.0.0') ||
versionGteLt(process.versions.node, '12.999.999', '13.0.0');

Expand Down

0 comments on commit b16134b

Please sign in to comment.