1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-06 00:13:28 +00:00

Migrate cli to jest (#2759)

* Migrate cli to jest

* Remove jasmine from browser

* Remove coverage from browser since it's in the root gitignore
This commit is contained in:
Oscar Hinton
2022-05-31 16:29:10 +02:00
committed by GitHub
parent f57f97fcdc
commit 579cee3364
13 changed files with 4704 additions and 318 deletions

16
apps/cli/jest.config.js Normal file
View File

@@ -0,0 +1,16 @@
const { pathsToModuleNameMapper } = require("ts-jest");
const { compilerOptions } = require("./tsconfig");
module.exports = {
preset: "ts-jest",
testMatch: ["**/+(*.)+(spec).+(ts)"],
setupFilesAfterEnv: ["<rootDir>/spec/test.ts"],
collectCoverage: true,
coverageReporters: ["html", "lcov"],
coverageDirectory: "coverage",
moduleNameMapper: pathsToModuleNameMapper(compilerOptions?.paths || {}, {
prefix: "<rootDir>/",
}),
modulePathIgnorePatterns: ["jslib"],
};

File diff suppressed because it is too large Load Diff

View File

@@ -39,8 +39,9 @@
"dist:mac": "npm run build:prod && npm run clean && npm run package:mac",
"dist:lin": "npm run build:prod && npm run clean && npm run package:lin",
"publish:npm": "npm run build:prod && npm publish --access public",
"test": "jasmine-ts -r tsconfig-paths/register -P spec/tsconfig.json",
"test:watch": "nodemon -w ./spec -w ./src -w ./jslib --ext \"ts,js,mjs,json\" --exec jasmine-ts -r tsconfig-paths/register -P spec/tsconfig.json"
"test": "jest",
"test:watch": "jest --watch",
"test:watch:all": "jest --watchAll"
},
"bin": {
"bw": "build/bw.js"
@@ -51,7 +52,7 @@
"devDependencies": {
"@fluffy-spoon/substitute": "^1.208.0",
"@types/inquirer": "^7.3.1",
"@types/jasmine": "^3.7.0",
"@types/jest": "^27.5.1",
"@types/jsdom": "^16.2.10",
"@types/koa": "^2.13.4",
"@types/koa__multer": "^2.0.4",
@@ -71,12 +72,10 @@
"clean-webpack-plugin": "^4.0.0",
"copy-webpack-plugin": "^10.2.0",
"cross-env": "^7.0.3",
"jasmine": "^3.7.0",
"jasmine-core": "^3.7.1",
"jasmine-ts": "^0.4.0",
"jasmine-ts-console-reporter": "^3.1.1",
"jest": "^27.5.1",
"pkg": "5.7.0",
"rimraf": "^3.0.2",
"ts-jest": "^27.1.5",
"ts-loader": "^8.2.0",
"ts-node": "^10.4.0",
"tsconfig-paths": "^3.12.0",

View File

@@ -1,3 +1,3 @@
describe("bw", () => {
it("is a placeholder test");
test.todo("is a placeholder test");
});

View File

@@ -1,4 +0,0 @@
// eslint-disable-next-line
const TSConsoleReporter = require("jasmine-ts-console-reporter");
jasmine.getEnv().clearReporters(); // Clear default console reporter
jasmine.getEnv().addReporter(new TSConsoleReporter());

View File

@@ -1,7 +0,0 @@
{
"spec_dir": "spec",
"spec_files": ["**/*[sS]pec.ts"],
"helpers": ["helpers.ts"],
"stopSpecOnExpectationFailure": false,
"random": true
}

0
apps/cli/spec/test.ts Normal file
View File

View File

@@ -1,7 +0,0 @@
{
"extends": "../tsconfig",
"include": ["src", "spec"],
"compilerOptions": {
"module": "commonjs"
}
}

View File

@@ -0,0 +1,3 @@
{
"extends": "./tsconfig.json"
}