forked from microsoft/ApplicationInsights-JS
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gruntfile.js
119 lines (116 loc) · 4.52 KB
/
gruntfile.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
116
117
118
119
module.exports = function (grunt) {
grunt.initConfig({
ts: {
tsconfig: true,
options: {
comments: true
},
default: {
src: [
'JavaScript/JavaScriptSDK.Interfaces/*.ts',
'JavaScript/JavaScriptSDK/*.ts',
],
out: 'bundle/ai.js',
},
module: {
src: [
'JavaScript/JavaScriptSDK.Interfaces/*.ts',
'JavaScript/JavaScriptSDK.Module/*.ts',
],
out: 'bundle/ai.module.js'
},
types: {
src: [
'JavaScript/JavaScriptSDK.Tests/DefinitionTypes/*.ts'
],
out: 'bundle/test/ai.types.js'
},
test: {
src: [
'JavaScript/JavaScriptSDK.Tests/Selenium/*.ts'
],
out: 'JavaScript/JavaScriptSDK.Tests/Selenium/ai.tests.js'
},
testE2E: {
files: [
{
src: 'JavaScript/JavaScriptSDK.Tests/E2ETests/DisableTelemetry.tests.ts',
dest: 'bundle/test/e2e/DisableTelemetry.tests.js'
},
{
src: 'JavaScript/JavaScriptSDK.Tests/E2ETests/PublicApi.tests.ts',
dest: 'bundle/test/e2e/PublicApiTests.tests.js'
},
{
src: 'JavaScript/JavaScriptSDK.Tests/E2ETests/SanitizerE2E.tests.ts',
dest: 'bundle/test/e2e/SanitizerE2E.tests.js'
},
{
src: 'JavaScript/JavaScriptSDK.Tests/E2ETests/SenderE2E.tests.ts',
dest: 'bundle/test/e2e/SenderE2E.tests.js'
},
{
src: 'JavaScript/JavaScriptSDK.Tests/E2ETests/Snippet.tests.ts',
dest: 'bundle/test/e2e/Snippet.tests.js'
},
{
src: 'JavaScript/JavaScriptSDK.Tests/E2ETests/ValidateApi.tests.ts',
dest: 'bundle/test/e2e/ValidateApi.tests.js'
}
],
outDir: 'bundle/test/e2e'
}
},
uglify: {
ai: {
files: {
'bundle/ai.0.js': ['bundle/ai.js'],
},
options: {
sourceMap: true,
sourceMapIncludeSources: true,
sourceMapIn: 'bundle/ai.js.map',
compress: {
ie8: true
},
mangle: {
ie8: true
}
},
},
snippet: {
files: {
'bundle/snippet/snippet.min.js': ['JavaScript/JavaScriptSDK/snippet.js']
}
}
},
qunit: {
all: {
options: {
urls: [
'JavaScript/JavaScriptSDK.Tests/Selenium/Tests.html',
'JavaScript/JavaScriptSDK.Tests/E2ETests/E2E.DisableTelemetry.tests.htm',
'JavaScript/JavaScriptSDK.Tests/E2ETests/E2E.PublicApi.tests.htm',
'JavaScript/JavaScriptSDK.Tests/E2ETests/E2E.SanitizerE2E.tests.htm',
'JavaScript/JavaScriptSDK.Tests/E2ETests/E2E.Sender.tests.htm',
'JavaScript/JavaScriptSDK.Tests/E2ETests/E2E.snippetTests.htm',
'JavaScript/JavaScriptSDK.Tests/E2ETests/E2E.ValidateApi.tests.htm'
],
timeout: 300 * 1000, // 5 min
console: false,
summaryOnly: true,
'--web-security': 'false' // we need this to allow CORS requests in PhantomJS
}
}
}
});
grunt.event.on('qunit.testStart', function (name) {
grunt.log.ok('Running test: ' + name);
});
grunt.loadNpmTasks("grunt-ts");
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.registerTask("default", ["ts:default", "uglify:ai", "uglify:snippet"]);
grunt.registerTask("module", ["ts:module"]);
grunt.registerTask("test", ["ts:default", "ts:test", "ts:testE2E", "ts:types", "qunit"]);
};