1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-09-27 04:03:00 +02: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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 4704 additions and 318 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
node_modules/
**/coverage/

View File

@ -14,7 +14,6 @@ webfonts/
*.zip
build/
build.safariextension/
coverage/
xcuserdata/
*.hmap
!src/safari/safari/app/popup/index.html

View File

@ -50,8 +50,6 @@
"gulp-zip": "^5.1.0",
"html-loader": "^3.0.1",
"html-webpack-plugin": "^5.5.0",
"jasmine-core": "^3.7.1",
"jasmine-spec-reporter": "^7.0.0",
"jest-preset-angular": "^10.1.0",
"mini-css-extract-plugin": "^2.4.5",
"prettier": "^2.5.1",
@ -3569,15 +3567,6 @@
"integrity": "sha512-hUewv7oMjCp+wkBv5Rm0v87eJhq4woh5rSR+42YSQJKecCqgIqNkZ6lAlQms/BwHPJA5NKMRlpxPRv0n8HQW6g==",
"dev": true
},
"node_modules/colors": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz",
"integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==",
"dev": true,
"engines": {
"node": ">=0.1.90"
}
},
"node_modules/combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
@ -7306,21 +7295,6 @@
"url": "https://bevry.me/fund"
}
},
"node_modules/jasmine-core": {
"version": "3.10.1",
"resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.10.1.tgz",
"integrity": "sha512-ooZWSDVAdh79Rrj4/nnfklL3NQVra0BcuhcuWoAwwi+znLDoUeH87AFfeX8s+YeYi6xlv5nveRyaA1v7CintfA==",
"dev": true
},
"node_modules/jasmine-spec-reporter": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/jasmine-spec-reporter/-/jasmine-spec-reporter-7.0.0.tgz",
"integrity": "sha512-OtC7JRasiTcjsaCBPtMO0Tl8glCejM4J4/dNuOJdA8lBjz4PmWjYQ6pzb0uzpBNAWJMDudYuj9OdXJWqM2QTJg==",
"dev": true,
"dependencies": {
"colors": "1.4.0"
}
},
"node_modules/jest": {
"version": "27.5.1",
"resolved": "https://registry.npmjs.org/jest/-/jest-27.5.1.tgz",
@ -16717,12 +16691,6 @@
"integrity": "sha512-hUewv7oMjCp+wkBv5Rm0v87eJhq4woh5rSR+42YSQJKecCqgIqNkZ6lAlQms/BwHPJA5NKMRlpxPRv0n8HQW6g==",
"dev": true
},
"colors": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz",
"integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==",
"dev": true
},
"combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
@ -19621,21 +19589,6 @@
"textextensions": "^3.2.0"
}
},
"jasmine-core": {
"version": "3.10.1",
"resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.10.1.tgz",
"integrity": "sha512-ooZWSDVAdh79Rrj4/nnfklL3NQVra0BcuhcuWoAwwi+znLDoUeH87AFfeX8s+YeYi6xlv5nveRyaA1v7CintfA==",
"dev": true
},
"jasmine-spec-reporter": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/jasmine-spec-reporter/-/jasmine-spec-reporter-7.0.0.tgz",
"integrity": "sha512-OtC7JRasiTcjsaCBPtMO0Tl8glCejM4J4/dNuOJdA8lBjz4PmWjYQ6pzb0uzpBNAWJMDudYuj9OdXJWqM2QTJg==",
"dev": true,
"requires": {
"colors": "1.4.0"
}
},
"jest": {
"version": "27.5.1",
"resolved": "https://registry.npmjs.org/jest/-/jest-27.5.1.tgz",

View File

@ -43,8 +43,6 @@
"gulp-zip": "^5.1.0",
"html-loader": "^3.0.1",
"html-webpack-plugin": "^5.5.0",
"jasmine-core": "^3.7.1",
"jasmine-spec-reporter": "^7.0.0",
"jest-preset-angular": "^10.1.0",
"mini-css-extract-plugin": "^2.4.5",
"prettier": "^2.5.1",

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"
}