3
3
4
4
// Karma configuration
5
5
6
- const credentialsPromise = require ( '@aws-sdk/credential-provider-node' ) . defaultProvider ( ) ( )
6
+ const credentialsPromise =
7
+ require ( '@aws-sdk/credential-provider-node' ) . defaultProvider ( ) ( )
8
+ const webpack = require ( 'webpack' )
7
9
8
10
module . exports = function ( config ) {
9
11
process . on ( 'infrastructure_error' , ( error ) => {
@@ -20,62 +22,72 @@ module.exports = function (config) {
20
22
21
23
config . set ( {
22
24
basePath : '' ,
23
- frameworks : [ 'mocha' , 'chai' ] ,
25
+ frameworks : [ 'mocha' , 'chai' , 'webpack '] ,
24
26
files : [
25
- 'modules/*-browser/test/**/*.ts' ,
26
- 'modules/web-crypto-backend/test/**/*.ts' ,
27
+ 'modules/*-browser/build/module/test/*.js' ,
28
+ 'modules/material-management/build/module/test/*.js' ,
29
+ 'modules/raw-keyring/build/module/test/*.js' ,
30
+ 'modules/kms-keyring/build/module/test/*.js' ,
31
+ // 'modules/cache-material/build/module/test/*.js',
32
+ 'modules/serialize/build/module/test/*.js' ,
33
+ 'modules/web-crypto-backend/build/module/test/*.js' ,
27
34
] ,
28
35
preprocessors : {
29
- 'modules/*-browser/test/**/*.ts' : [ 'webpack' , 'credentials' ] ,
30
- 'modules/web-crypto-backend/test/**/*.ts' : [ 'webpack' , 'credentials' ] ,
36
+ 'modules/**/build/module/test/*.js' : [ 'webpack' , 'credentials' ] ,
31
37
} ,
32
38
webpack : {
33
39
resolve : {
34
- extensions : [ '.ts' , '. js'] ,
40
+ extensions : [ '.js' ] ,
35
41
} ,
36
42
mode : 'development' ,
37
43
module : {
38
44
rules : [
39
45
{
40
- test : / \. t s x ? $ / ,
41
- use : [
42
- {
43
- loader : 'ts-loader' ,
44
- options : {
45
- logInfoToStdOut : true ,
46
- projectReferences : true ,
47
- configFile : `${ __dirname } /tsconfig.module.json` ,
48
- } ,
49
- } ,
50
- ] ,
51
- exclude : / n o d e _ m o d u l e s / ,
46
+ // yauzl is only used in the node cli for browser integration
47
+ test : / y a u z l / ,
48
+ use : 'null-loader' ,
52
49
} ,
53
50
{
54
- test : / \. t s $ / ,
55
- exclude : [ / \/ t e s t \/ / ] ,
56
- enforce : 'post' ,
51
+ test : / \. j s / ,
52
+ // msrcrypto.js is are outside dependances
53
+ // and should not be intremented or impact code coverage.
54
+ // fixtures.js is a test file, not an entry point
55
+ exclude : / ( n o d e _ m o d u l e s ) | ( m s r c r y p t o .j s ) | ( f i x t u r e s .j s ) / ,
57
56
use : {
58
- loader : 'istanbul-instrumenter-loader' ,
59
- options : { esModules : true } ,
60
- } ,
61
- } ,
57
+ loader : "@jsdevtools/coverage-istanbul-loader" ,
58
+ options : {
59
+ // produceSourceMap: true
60
+ }
61
+ }
62
+ }
62
63
] ,
63
64
} ,
65
+ plugins : [
66
+ new webpack . ProvidePlugin ( {
67
+ Buffer : [ 'buffer' , 'Buffer' ] ,
68
+ } ) ,
69
+ ] ,
64
70
stats : {
65
71
colors : true ,
66
72
modules : true ,
67
73
reasons : true ,
68
74
errorDetails : true ,
69
75
} ,
70
- devtool : 'inline-source-map' ,
71
- node : {
72
- fs : 'empty' ,
76
+ devtool : 'source-map' ,
77
+ resolve : {
78
+ fallback : {
79
+ fs : false ,
80
+ crypto : false ,
81
+ } ,
73
82
} ,
74
83
} ,
75
84
coverageIstanbulReporter : {
76
85
reports : [ 'json' ] ,
77
- dir : '.karma_output' ,
86
+ combineBrowserReports : true ,
78
87
fixWebpackSourcePaths : true ,
88
+ dir : '.karma_output' ,
89
+ skipFilesWithNoCoverage : true ,
90
+ // verbose: true,
79
91
} ,
80
92
plugins : [
81
93
{
0 commit comments