Updated testing environment

This commit is contained in:
Kir_Antipov 2022-11-29 13:12:43 +00:00
parent 95d25ac238
commit fc1a2a044b
5 changed files with 5288 additions and 11014 deletions

View file

@ -1,6 +1,5 @@
module.exports = { module.exports = {
presets: [ presets: [
["@babel/preset-env", { targets: { node: "current" } }], ["@babel/preset-env", { targets: { node: "current" } }],
"@babel/preset-typescript", ],
]
}; };

17
jest.config.cjs Normal file
View file

@ -0,0 +1,17 @@
module.exports = {
preset: "ts-jest/presets/js-with-ts-esm",
transform: {
"\\.ts$": ["ts-jest", {
useESM: true,
diagnostics: false,
isolatedModules: true,
}],
"\\.js$": "babel-jest",
},
testEnvironment: "node",
testMatch: ["**/tests/**/*/*.spec.ts"],
moduleNameMapper: {
"^@/(.*)$": "<rootDir>/src/$1",
},
transformIgnorePatterns: [],
};

View file

@ -1,11 +0,0 @@
module.exports = {
clearMocks: true,
moduleFileExtensions: ["js", "ts"],
testMatch: ["**/*.test.ts"],
transform: { ".(t|j)s$": "babel-jest" },
transformIgnorePatterns: ["/node_modules/(?!node-fetch|fetch-blob).+\\.js$"],
moduleNameMapper: {
"formdata-node/file-from-path": "<rootDir>node_modules/formdata-node/lib/cjs/fileFromPath"
},
verbose: true
};

16243
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -6,8 +6,9 @@
"scripts": { "scripts": {
"build": "ncc build --source-map --license license.txt && ncc run scripts/index.ts", "build": "ncc build --source-map --license license.txt && ncc run scripts/index.ts",
"test:lint": "eslint src/**/*.ts && eslint test/**/*.ts", "test:lint": "eslint src/**/*.ts && eslint test/**/*.ts",
"test:unit": "jest", "test:unit": "jest --testPathPattern=unit --watchAll=false",
"test": "npm run test:lint && npm run test:unit" "test:integration": "jest --testPathPattern=integration",
"test": "npm run test:lint && npm run test:unit && npm run test:integration"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -27,18 +28,21 @@
}, },
"homepage": "https://github.com/Kir-Antipov/mc-publish#readme", "homepage": "https://github.com/Kir-Antipov/mc-publish#readme",
"devDependencies": { "devDependencies": {
"@babel/preset-env": "^7.18.10", "@babel/preset-env": "^7.21.5",
"@babel/preset-typescript": "^7.18.6", "@types/jest": "^29.5.1",
"@types/node": "^18.7.8", "@types/mock-fs": "^4.13.1",
"@types/node": "^16.11.7",
"@types/node-fetch": "^2.6.2", "@types/node-fetch": "^2.6.2",
"@types/semver": "^7.3.13", "@types/semver": "^7.3.13",
"@types/yazl": "^2.4.2", "@types/yazl": "^2.4.2",
"@typescript-eslint/eslint-plugin": "^5.33.1", "@typescript-eslint/eslint-plugin": "^5.33.1",
"@typescript-eslint/parser": "^5.33.1", "@typescript-eslint/parser": "^5.33.1",
"@vercel/ncc": "^0.34.0", "@vercel/ncc": "^0.34.0",
"babel-jest": "^28.1.3", "babel-jest": "^29.5.0",
"eslint": "^8.22.0", "eslint": "^8.22.0",
"jest": "^28.1.3", "jest": "^29.5.0",
"mock-fs": "^5.2.0",
"ts-jest": "^29.1.0",
"typescript": "^4.7.4", "typescript": "^4.7.4",
"yazl": "^2.5.1" "yazl": "^2.5.1"
}, },