refactor: update imports to use ES module syntax and improve test structure (#1350)

- Changed import statements across multiple files to use the .js extension for ES module compatibility.
- Refactored test files to utilize jest's unstable_mockModule for mocking core actions.
- Removed unnecessary spy instances in tests, replacing them with direct mocked function calls.
- Updated TypeScript configuration to target ES2022 and use NodeNext module resolution.
- Removed the tsconfig.spec.json file and adjusted the main tsconfig.json to exclude test files.
This commit is contained in:
Chiranjib Swain
2026-07-23 15:39:34 -05:00
committed by GitHub
parent 1e223db275
commit eaf9131fae
122 changed files with 67910 additions and 55239 deletions
+34 -35
View File
@@ -1,20 +1,21 @@
{
"name": "stale-action",
"version": "10.4.0",
"version": "11.0.0",
"private": true,
"type": "module",
"description": "Marks old issues and PRs as stale",
"main": "lib/main.js",
"scripts": {
"build": "tsc --project tsconfig.app.json && ncc build",
"format": "prettier --no-error-on-unmatched-pattern --config ./.prettierrc.js --write \"**/*.{ts,yml,yaml}\"",
"format-check": "prettier --no-error-on-unmatched-pattern --config ./.prettierrc.js --check \"**/*.{ts,yml,yaml}\"",
"lint": "eslint --config ./.eslintrc.js \"**/*.ts\"",
"lint:fix": "eslint --config ./.eslintrc.js \"**/*.ts\" --fix",
"build": "tsc --project tsconfig.app.json && ncc build lib/main.js",
"format": "prettier --no-error-on-unmatched-pattern --write \"**/*.{ts,yml,yaml}\"",
"format-check": "prettier --no-error-on-unmatched-pattern --check \"**/*.{ts,yml,yaml}\"",
"lint": "eslint \"**/*.ts\"",
"lint:fix": "eslint \"**/*.ts\" --fix",
"lint:all": "npm run format-check && npm run lint",
"lint:all:fix": "npm run format && npm run lint:fix",
"test": "jest --config ./jest.config.js",
"test:only-errors": "jest --reporters jest-silent-reporter --silent",
"test:watch": "jest --watch --notify --expand",
"test": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --runInBand",
"test:only-errors": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --reporters jest-silent-reporter --silent",
"test:watch": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --watch --notify --expand",
"all": "npm run format && npm run lint && npm run build && npm test",
"all:ci": "npm run format && npm run lint && npm run build && npm run test:only-errors",
"prerelease": "npm run build",
@@ -37,38 +38,36 @@
"author": "GitHub",
"license": "MIT",
"dependencies": {
"@actions/cache": "^5.0.5",
"@actions/core": "^2.0.3",
"@actions/github": "^7.0.0",
"@octokit/core": "^5.2.2",
"@octokit/plugin-retry": "^6.1.0",
"lodash.deburr": "^4.1.0",
"semver": "^7.7.4"
"@actions/cache": "^6.1.0",
"@actions/core": "^3.0.1",
"@actions/github": "^9.1.1",
"@octokit/core": "^7.0.6",
"@octokit/plugin-retry": "^8.1.0",
"lodash.deburr": "^4.1.0"
},
"overrides": {
"undici": "6.27.0"
},
"devDependencies": {
"@types/jest": "^29.5.14",
"@eslint/js": "^10.0.1",
"@jest/globals": "^30.4.1",
"@types/lodash.deburr": "^4.1.6",
"@types/node": "^24.3.1",
"@types/semver": "^7.5.0",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"@vercel/ncc": "^0.36.1",
"ansi-styles": "5.2.0",
"eslint": "^8.56.0",
"@types/node": "^24.13.3",
"@typescript-eslint/eslint-plugin": "^8.62.1",
"@typescript-eslint/parser": "^8.62.1",
"@vercel/ncc": "^0.44.1",
"ansi-styles": "^6.2.3",
"eslint": "^10.7.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-jest": "^27.7.0",
"eslint-plugin-node": "^11.1.0",
"jest": "^29.6.2",
"jest-circus": "^29.5.0",
"jest-silent-reporter": "^0.5.0",
"js-yaml": "^4.1.1",
"prettier": "^2.8.7",
"standard-version": "^9.3.1",
"terminal-link": "^2.1.1",
"ts-jest": "^29.2.5",
"typescript": "^5.2.2"
"eslint-plugin-jest": "^29.15.4",
"eslint-plugin-n": "^18.2.1",
"globals": "^17.7.0",
"jest": "^30.4.2",
"jest-silent-reporter": "^0.6.0",
"prettier": "^3.9.4",
"standard-version": "^9.5.0",
"terminal-link": "^5.0.0",
"ts-jest": "^29.4.11",
"typescript": "^6.0.3"
}
}