spyne 0.20.2 → 0.20.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ npm run build && npm run build:esm
package/karma.conf.js CHANGED
@@ -1,62 +1,32 @@
1
- const webpackConfigs = require('./webpack.config');
1
+ const replace = require('@rollup/plugin-replace');
2
+ const dotenv = require('dotenv');
3
+ dotenv.config();
2
4
 
3
- // Since webpack.config.js exports an array [esmConfig, umdConfig],
4
- // we'll grab the second one (UMD) to use in Karma.
5
- const [esmConfig, umdConfig] = webpackConfigs || [];
6
-
7
- // Make a shallow clone of the UMD config so we can tweak it for Karma:
8
- const karmaWebpackConfig = {
9
- ...umdConfig,
10
-
11
- // Force a "neutral" mode so Webpack doesn't minify or do env-specific optimizations
12
- mode: 'none',
13
-
14
- // Karma manages watching/rebuilding on its own, so we typically disable watch from Webpack
15
- watch: true,
16
-
17
- // Remove the library entry/output so that Karma can inline test files
18
- entry: undefined,
19
- output: undefined
5
+ module.exports = function (config) {
6
+ // ...
7
+ // Use process.env.IS_PUBLIC as needed
8
+ // ...
20
9
  };
21
- karmaWebpackConfig.externals = [];
22
- // Optionally inject any test-specific loaders/rules, e.g. coverage instrumentation:
23
- karmaWebpackConfig.module.rules.push({
24
- test: /\.js$/,
25
- exclude: /node_modules/,
26
- // If you use Babel or another coverage tool, you can add it here
27
- // For example:
28
- // use: {
29
- // loader: 'babel-loader',
30
- // options: {
31
- // plugins: ['istanbul'] // coverage plugin
32
- // }
33
- // }
34
- });
35
10
 
36
11
  module.exports = function (config) {
37
- // If you need Travis CI logic:
12
+
38
13
  if (process.env.TRAVIS) {
39
14
  config.browsers = ['ChromeHeadlessNoSandbox'];
40
15
  }
41
16
 
42
17
  config.set({
43
- // Base path that will be used to resolve all patterns (eg. files, exclude)
44
- basePath: '',
45
-
46
- // Test frameworks
47
- frameworks: ['webpack', 'mocha', 'chai'],
18
+ frameworks: ['mocha', 'chai'],
48
19
 
20
+ // Load these plugins so Karma recognizes 'rollup' as a preprocessor
49
21
  plugins: [
50
- 'karma-webpack',
51
22
  'karma-mocha',
52
23
  'karma-chai',
53
- 'karma-coverage',
54
- 'karma-chrome-launcher'
24
+ 'karma-chrome-launcher',
25
+ 'karma-rollup-preprocessor'
55
26
  ],
56
27
 
57
- // List of files / patterns to load in the browser
58
28
  files: [
59
- // External deps you might need:
29
+ // Test files
60
30
  { pattern: './node_modules/ramda/dist/ramda.min.js', watched: false },
61
31
  { pattern: './node_modules/rxjs/**/*.js', included: false, watched: false },
62
32
 
@@ -64,57 +34,46 @@ module.exports = function (config) {
64
34
  { pattern: './src/tests/index.test.js', watched: true },
65
35
  { pattern: './src/tests/spyne-app.test.js', watched: true },
66
36
  { pattern: './src/tests/package-json.spec.test.js', watched: true },
67
- { pattern: './src/tests/spyne-plugin.test.js', watched: true },
68
37
  { pattern: './src/tests/channels/*.test.js', watched: true },
69
38
  { pattern: './src/tests/utils/*.test.js', watched: true },
70
- { pattern: './src/tests/views/*.test.js', watched: true }
71
- ],
39
+ { pattern: './src/tests/views/*.test.js', watched: true } ],
72
40
 
73
- // Preprocessors so that the files are processed by Webpack + coverage
74
41
  preprocessors: {
75
- './src/tests/*.test.js': ['webpack', 'coverage'],
76
- './src/tests/channels/*.test.js': ['webpack', 'coverage'],
77
- './src/tests/utils/*.test.js': ['webpack', 'coverage'],
78
- './src/tests/views/*.test.js': ['webpack', 'coverage']
42
+ // We want to run Rollup on our test files (and any imports they pull in)
43
+ './src/tests/*.test.js': ['rollup'],
44
+ './src/tests/channels/*.test.js': ['rollup'],
45
+ './src/tests/utils/*.test.js': ['rollup'],
46
+ './src/tests/views/*.test.js': ['rollup']
79
47
  },
80
48
 
81
- // Use our customized Webpack config
82
- webpack: karmaWebpackConfig,
83
-
84
- // Quiet the Webpack output in the Karma logs
85
- webpackMiddleware: { noInfo: true },
86
-
87
- // Report results with coverage
88
- reporters: ['progress', 'coverage'],
89
-
90
- coverageReporter: {
91
- reporters: [
92
- { type: 'lcovonly', subdir: '.' }, // ./coverage/lcov.info
93
- { type: 'json', subdir: '.' } // ./coverage/coverage-final.json
49
+ rollupPreprocessor: {
50
+ output: {
51
+ format: 'iife',
52
+ name: 'SpyneTest',
53
+ sourcemap: 'inline'
54
+ },
55
+ plugins: [
56
+ replace({
57
+ // The replacement you want to do:
58
+ 'process.env.IS_PUBLIC': JSON.stringify(process.env.IS_PUBLIC === 'true'),
59
+ // Or if you'd rather fallback to 'false' if not set:
60
+ // 'process.env.IS_PUBLIC': JSON.stringify(process.env.IS_PUBLIC ?? 'false'),
61
+
62
+ preventAssignment: true
63
+ }),
64
+
65
+ require('@rollup/plugin-node-resolve').default(),
66
+ require('@rollup/plugin-commonjs')({
67
+ transformMixedEsModules: true
68
+ }),
69
+ require('@rollup/plugin-json')()
94
70
  ]
95
71
  },
96
72
 
97
- port: 9876,
98
- colors: true,
99
- logLevel: config.LOG_DEBUG,
100
-
101
- // autoWatch: if true, re-run tests on file changes
102
- autoWatch: true,
103
-
104
- customLaunchers: {
105
- ChromeHeadlessNoSandbox: {
106
- base: 'ChromeHeadless',
107
- flags: ['--no-sandbox']
108
- }
109
- },
110
-
111
- // Browsers to start (choose your launcher)
73
+ // Browsers
112
74
  browsers: ['Chrome'],
113
75
 
114
- // If true, Karma runs tests once and exits
115
- singleRun: false,
116
-
117
- // Concurrency level
118
- concurrency: Infinity
76
+ // run once and exit or watch
77
+ singleRun: true
119
78
  });
120
79
  };