Skip to content
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.

Move tests to correct sub-package #576

Closed
wants to merge 14 commits into from
61 changes: 58 additions & 3 deletions angular/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions angular/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@bitwarden/jslib-common",
"name": "@bitwarden/jslib-angular",
"version": "0.0.0",
"description": "Common code used across Bitwarden JavaScript projects.",
"keywords": [
Expand All @@ -17,7 +17,9 @@
"build": "npm run clean && tsc",
"build:watch": "npm run clean && tsc -watch",
"lint": "tslint 'src/**/*.ts' 'spec/**/*.ts'",
"lint:fix": "tslint 'src/**/*.ts' 'spec/**/*.ts' --fix"
"lint:fix": "tslint 'src/**/*.ts' 'spec/**/*.ts' --fix",
"test": " ",
"test:node": " "
},
"devDependencies": {
"@types/duo_web_sdk": "^2.7.1",
Expand All @@ -36,6 +38,7 @@
"@angular/router": "^12.2.13",
"@bitwarden/jslib-common": "file:../common",
"duo_web_sdk": "git+https://github.com/duosecurity/duo_web_sdk.git",
"ngx-toastr": "14.1.4",
"rxjs": "^7.4.0",
"tldjs": "^2.3.1",
"zone.js": "0.11.4"
Expand Down
33 changes: 20 additions & 13 deletions spec/support/karma.conf.js → common/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
const path = require("path");
const webpack = require("webpack");

module.exports = (config) => {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: "../../",
basePath: "",

// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ["jasmine", "detectBrowsers"],
frameworks: ["jasmine", "webpack", "detectBrowsers"],

// list of files / patterns to load in the browser
files: [
{ pattern: "spec/utils.ts", watched: false },
{ pattern: "spec/common/**/*.ts", watched: false },
{ pattern: "spec/web/**/*.ts", watched: false },
],
files: [{ pattern: "spec/**/*.spec.ts", watched: false }],

// list of files to exclude
exclude: [],

// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
"spec/**/*.ts": "webpack",
"spec/**/*.ts": ["webpack", "sourcemap"],
},

// test results reporter to use
Expand All @@ -47,17 +46,27 @@ module.exports = (config) => {
},

webpack: {
mode: "development",
resolve: {
extensions: [".js", ".ts", ".tsx"],
fallback: {
util: require.resolve("util/"),
url: require.resolve("url/"),
},
alias: {
src: path.resolve(__dirname, "src/"),
},
},
plugins: [
new webpack.ProvidePlugin({
process: "process/browser",
}),
],
module: {
rules: [
{
test: /\.tsx?$/,
loader: "ts-loader",
options: {
compiler: "ttypescript",
},
},
],
},
Expand All @@ -67,9 +76,7 @@ module.exports = (config) => {
reasons: true,
errorDetails: true,
},
devtool: "inline-source-map",
},

detectBrowsers: {
usePhantomJS: false,
postDetection: (availableBrowsers) => {
Expand Down
Loading