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
Closed
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
57 changes: 21 additions & 36 deletions spec/support/karma.conf.js → common/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
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'],

// 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 },
{ pattern: 'spec/**/*.spec.ts', watched: false },
],

// list of files to exclude
exclude: [
browsers: [
'Chrome'
],

// 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 @@ -48,17 +51,24 @@ module.exports = (config) => {
},

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

detectBrowsers: {
Hinton marked this conversation as resolved.
Show resolved Hide resolved
usePhantomJS: false,
postDetection: (availableBrowsers) => {
const result = availableBrowsers;
function removeBrowser(browser) {
if (availableBrowsers.length > 1 && availableBrowsers.indexOf(browser) > -1) {
result.splice(result.indexOf(browser), 1);
}
}

removeBrowser('IE');
removeBrowser('Opera');
removeBrowser('SafariTechPreview');

var githubAction = process.env.GITHUB_WORKFLOW != null && process.env.GITHUB_WORKFLOW !== '';
if (githubAction) {
removeBrowser('Firefox');
removeBrowser('Safari');
}

return result;
}
},
})
}
Loading