1+ const process = require ( 'process' ) ;
2+
3+ module . exports = function ( config ) {
4+ config . set ( {
5+ // Base path that will be used to resolve all patterns (eg. files, exclude)
6+ basePath : '../' ,
7+
8+ // Frameworks to use
9+ frameworks : [ 'mocha' , 'chai' ] ,
10+
11+ // List of files / patterns to load in the browser
12+ files : [
13+ // Include the built PubNub library
14+ 'dist/web/pubnub.js' ,
15+ // Include the shared worker file
16+ { pattern : 'dist/web/pubnub.worker.js' , included : false , served : true } ,
17+ // Include the test file
18+ 'test/integration/shared-worker/shared-worker.test.ts' ,
19+ ] ,
20+
21+ // List of files to exclude
22+ exclude : [ ] ,
23+
24+ // Preprocess matching files before serving them to the browser
25+ preprocessors : {
26+ 'test/**/*.ts' : [ 'webpack' , 'sourcemap' ] ,
27+ } ,
28+
29+ // Webpack configuration
30+ webpack : {
31+ mode : 'development' ,
32+ module : {
33+ rules : [
34+ {
35+ test : / \. t s $ / ,
36+ use : 'ts-loader' ,
37+ exclude : / n o d e _ m o d u l e s / ,
38+ } ,
39+ ] ,
40+ } ,
41+ resolve : {
42+ extensions : [ '.ts' , '.js' ] ,
43+ fallback : {
44+ "crypto" : false ,
45+ "stream" : false ,
46+ "buffer" : require . resolve ( "buffer" ) ,
47+ "util" : require . resolve ( "util/" ) ,
48+ "url" : false ,
49+ "querystring" : false ,
50+ "path" : false ,
51+ "fs" : false ,
52+ "net" : false ,
53+ "tls" : false ,
54+ "os" : false ,
55+ "process" : require . resolve ( "process/browser" ) ,
56+ } ,
57+ } ,
58+ plugins : [
59+ new ( require ( 'webpack' ) ) . ProvidePlugin ( {
60+ process : 'process/browser' ,
61+ Buffer : [ 'buffer' , 'Buffer' ] ,
62+ } ) ,
63+ ] ,
64+ devtool : 'inline-source-map' ,
65+ stats : 'errors-only' ,
66+ } ,
67+
68+ webpackMiddleware : {
69+ logLevel : 'error' ,
70+ } ,
71+
72+ // Test results reporter to use
73+ reporters : [ 'spec' ] ,
74+
75+ // Web server port
76+ port : 9876 ,
77+
78+ // Enable / disable colors in the output (reporters and logs)
79+ colors : true ,
80+
81+ // Level of logging
82+ logLevel : config . LOG_INFO ,
83+
84+ // Enable / disable watching file and executing tests whenever any file changes
85+ autoWatch : false ,
86+
87+ // Start these browsers
88+ browsers : [ 'Chrome_SharedWorker' ] ,
89+
90+ // Continuous Integration mode
91+ singleRun : true ,
92+
93+ // Browser disconnect timeout
94+ browserDisconnectTimeout : 30000 ,
95+
96+ // Browser no activity timeout
97+ browserNoActivityTimeout : 30000 ,
98+
99+ // Capture timeout
100+ captureTimeout : 30000 ,
101+
102+ // Custom launcher for shared worker testing
103+ customLaunchers : {
104+ Chrome_SharedWorker : {
105+ base : 'ChromeHeadless' ,
106+ flags : [
107+ '--disable-web-security' ,
108+ '--disable-features=VizDisplayCompositor' ,
109+ '--enable-shared-worker' ,
110+ '--allow-running-insecure-content' ,
111+ '--disable-background-timer-throttling' ,
112+ '--disable-renderer-backgrounding' ,
113+ '--disable-backgrounding-occluded-windows' ,
114+ '--no-sandbox' ,
115+ '--disable-setuid-sandbox' ,
116+ ] ,
117+ } ,
118+ } ,
119+
120+ // Client configuration
121+ client : {
122+ mocha : {
123+ timeout : 30000 , // Longer timeout for network tests
124+ reporter : 'spec' ,
125+ } ,
126+ captureConsole : true ,
127+ } ,
128+
129+ // Proxies for serving worker files
130+ proxies : {
131+ '/dist/' : '/base/dist/' ,
132+ } ,
133+ } ) ;
134+ } ;
0 commit comments