forked from canalplus/rx-player
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack-tests.config.js
115 lines (110 loc) · 3.37 KB
/
webpack-tests.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/* eslint-env node */
const webpack = require("webpack");
const coverageIsWanted = !!process.env.RXP_COVERAGE;
const config = {
mode: "development",
entry: "./tests/integration/index.js",
resolve: {
extensions: [".ts", ".tsx", ".js", ".jsx", ".json"],
},
output: {
library: "RxPlayer",
libraryTarget: "umd",
},
module: {
rules: [
{
test: /\.tsx?$/,
use: "ts-loader",
},
],
},
plugins: [
new webpack.DefinePlugin({
"__TEST_CONTENT_SERVER__": {
URL: "\"127.0.0.1\"",
PORT: "\"3000\"",
},
"__FEATURES__": {
BIF_PARSER: true,
DASH: true,
DIRECTFILE: true,
EME: true,
HTML_SAMI: true,
HTML_SRT: true,
HTML_TTML: true,
HTML_VTT: true,
LOCAL_MANIFEST: true,
METAPLAYLIST: true,
NATIVE_SAMI: true,
NATIVE_SRT: true,
NATIVE_TTML: true,
NATIVE_VTT: true,
SMOOTH: true,
},
// Path relative to src/features where optional features are implemented
__RELATIVE_PATH__: {
BIF_PARSER: JSON.stringify("../parsers/images/bif.ts"),
DASH: JSON.stringify("../transports/dash/index.ts"),
DIRECTFILE: JSON.stringify("../core/init/initialize_directfile.ts"),
EME_MANAGER: JSON.stringify("../core/eme/index.ts"),
HTML_SAMI: JSON.stringify("../parsers/texttracks/sami/html.ts"),
HTML_SRT: JSON.stringify("../parsers/texttracks/srt/html.ts"),
HTML_TEXT_BUFFER: JSON.stringify("../custom_source_buffers/text/html/index.ts"),
HTML_TTML: JSON.stringify("../parsers/texttracks/ttml/html/index.ts"),
HTML_VTT: JSON.stringify("../parsers/texttracks/webvtt/html/index.ts"),
IMAGE_BUFFER: JSON.stringify("../custom_source_buffers/image/index.ts"),
LOCAL_MANIFEST: JSON.stringify("../transports/local/index.ts"),
MEDIA_ELEMENT_TRACK_CHOICE_MANAGER: JSON.stringify("../core/api/media_element_track_choice_manager.ts"),
METAPLAYLIST: JSON.stringify("../transports/metaplaylist/index.ts"),
NATIVE_SAMI: JSON.stringify("../parsers/texttracks/sami/native.ts"),
NATIVE_SRT: JSON.stringify("../parsers/texttracks/srt/native.ts"),
NATIVE_TEXT_BUFFER: JSON.stringify("../custom_source_buffers/text/native/index.ts"),
NATIVE_TTML: JSON.stringify("../parsers/texttracks/ttml/native/index.ts"),
NATIVE_VTT: JSON.stringify("../parsers/texttracks/webvtt/native/index.ts"),
SMOOTH: JSON.stringify("../transports/smooth/index.ts"),
},
__DEV__: true,
__LOGGER_LEVEL__: "\"NONE\"",
"process.env": {
NODE_ENV: JSON.stringify("development"),
},
}),
],
node: {
console: false,
global: true,
process: false,
Buffer: false,
__filename: false,
__dirname: false,
setImmediate: false,
},
};
if (coverageIsWanted) {
config.devtool = "inline-source-map";
config.module.rules = [
{
test: /\.tsx?$/,
use: [{
loader: "ts-loader",
options: {
compilerOptions: {
// needed for istanbul accuracy
sourceMap: true,
},
},
}],
},
{
test: /\.ts$/,
exclude: [/__tests__/],
enforce: "post",
use: {
loader: "istanbul-instrumenter-loader",
options: { esModules: true },
},
},
];
}
module.exports = config;