diff --git a/.eslintrc b/.eslintrc index 34a116f..44d8bea 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,6 +1,14 @@ { "extends": "@terascope", + "parserOptions": { + "ecmaVersion": "latest", + "sourceType": "module" + }, "rules": { - "@typescript-eslint/naming-convention": "off" - } + "@typescript-eslint/naming-convention": "off", + "@typescript-eslint/no-duplicate-enum-values": "warn", + "import/extensions": "off", + "import/no-import-module-exports": "off" + }, + "ignorePatterns":[] } diff --git a/jest.config.js b/jest.config.js index 999c346..06a3893 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,6 +1,4 @@ -'use strict'; - -module.exports = { +export default { verbose: true, testEnvironment: 'node', setupFilesAfterEnv: ['jest-extended/all'], @@ -18,13 +16,19 @@ module.exports = { '/test/**/*-spec.{ts,js}', '/test/*-spec.{ts,js}', ], + moduleNameMapper: { + '^(\\.{1,2}/.*)\\.js$': '$1' + }, preset: 'ts-jest', + extensionsToTreatAsEsm: ['.ts'], globals: { 'ts-jest': { tsconfig: './tsconfig.json', diagnostics: true, + useESM: true }, ignoreDirectories: ['dist'], - availableExtensions: ['.js', '.ts'] - } + availableExtensions: ['.js', '.ts', '.mjs'] + }, + testTimeout: 60 * 1000 }; diff --git a/package.json b/package.json index 8294ad0..de206de 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ }, "version": "0.8.11", "description": "Download a specific release from github", + "type": "module", "files": [ "dist/src/**/*", "bin/*" @@ -17,10 +18,10 @@ "lint": "eslint --ignore-path .gitignore --ext .js,.ts .", "lint:fix": "yarn lint --fix", "setup": "yarn && yarn build", - "test": "jest", - "test:cov": "jest --collectCoverage", - "test:watch": "jest --coverage=false --notify --watch --onlyChanged", - "test:debug": "env DEBUG=\"${DEBUG:-*teraslice*}\" jest --detectOpenHandles --coverage=false --runInBand", + "test": "NODE_OPTIONS='--experimental-vm-modules' jest", + "test:cov": "NODE_OPTIONS='--experimental-vm-modules' jest --collectCoverage", + "test:watch": "NODE_OPTIONS='--experimental-vm-modules' jest --coverage=false --notify --watch --onlyChanged", + "test:debug": "NODE_OPTIONS='--experimental-vm-modules' env DEBUG=\"${DEBUG:-*teraslice*}\" jest --detectOpenHandles --coverage=false --runInBand", "check": "yarn run lint && yarn run test", "clean": "rimraf dist coverage", "prepublishOnly": "yarn run clean && yarn run build" @@ -52,6 +53,7 @@ "devDependencies": { "@terascope/eslint-config": "^0.8.0", "@types/jest": "^27.0.2", + "@types/multi-progress": "^2.0.6", "@types/node": "^18.14.2", "@types/stream-buffers": "^3.0.4", "@types/tmp": "^0.2.1", diff --git a/tsconfig.json b/tsconfig.json index 0128ef1..5fd5f31 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,9 +2,9 @@ "compilerOptions": { "rootDir": ".", "outDir": "dist", - "module": "commonjs", + "module": "ESNext", "moduleResolution": "node", - "target": "es2019", + "target": "ESNext", "skipLibCheck": true, "experimentalDecorators": true, "declaration": true, diff --git a/yarn.lock b/yarn.lock index 8050374..efcda7b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -969,6 +969,14 @@ dependencies: "@types/node" "*" +"@types/multi-progress@^2.0.6": + version "2.0.6" + resolved "https://registry.yarnpkg.com/@types/multi-progress/-/multi-progress-2.0.6.tgz#caf9c1de2f8dadfd9af4d33e0ced7f3f31bb2015" + integrity sha512-S+DW6NQdvwJ6liFUmGNbGtUwFwHm/qx2D2hrlX5HY5f55hRpteS1F1pHfrC2AoCvPNAeVuFVlZTDyIkPssMujg== + dependencies: + "@types/node" "*" + "@types/progress" "*" + "@types/node@*": version "20.12.12" resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.12.tgz#7cbecdf902085cec634fdb362172dfe12b8f2050" @@ -988,6 +996,13 @@ resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.4.1.tgz#e1303048d5389563e130f5bdd89d37a99acb75eb" integrity sha512-Fo79ojj3vdEZOHg3wR9ksAMRz4P3S5fDB5e/YWZiFnyFQI1WY2Vftu9XoXVVtJfxB7Bpce/QTqWSSntkz2Znrw== +"@types/progress@*": + version "2.0.7" + resolved "https://registry.yarnpkg.com/@types/progress/-/progress-2.0.7.tgz#798b309935ef1cf5bef3b3f7bb8da7b0335bc67e" + integrity sha512-iadjw02vte8qWx7U0YM++EybBha2CQLPGu9iJ97whVgJUT5Zq9MjAPYUnbfRI2Kpehimf1QjFJYxD0t8nqzu5w== + dependencies: + "@types/node" "*" + "@types/responselike@^1.0.0": version "1.0.3" resolved "https://registry.yarnpkg.com/@types/responselike/-/responselike-1.0.3.tgz#cc29706f0a397cfe6df89debfe4bf5cea159db50" @@ -4810,16 +4825,7 @@ string-length@^4.0.1: char-regex "^1.0.2" strip-ansi "^6.0.0" -"string-width-cjs@npm:string-width@^4.2.0": - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -4899,14 +4905,7 @@ string.prototype.trimstart@^1.0.8: define-properties "^1.2.1" es-object-atoms "^1.0.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -5335,16 +5334,7 @@ word-wrap@~1.2.3: resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - -wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==