Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit 3d12d89

Browse files
cnishinajuliemr
authored andcommitted
chore(built): adding gulp prepublish and gulp pretest tasks
1 parent 65920fd commit 3d12d89

File tree

9 files changed

+86
-47
lines changed

9 files changed

+86
-47
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
built/
12
node_modules/
23
selenium/
34
testapp/inbrowsertest/

Diff for: .npmignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
debugging/
22
docs/
3+
lib/
34
scripts/
45
spec/
56
stress/

Diff for: bin/protractor

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
process.env.NODE_ENV = process.env.NODE_ENV || 'test';
44

5-
require('../lib/cli.js');
5+
require('../built/cli.js');

Diff for: gulpfile.js

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
'use strict';
2+
3+
var gulp = require('gulp');
4+
var runSequence = require('run-sequence');
5+
var spawnSync = require('child_process').spawnSync;
6+
7+
gulp.task('built:copy', function() {
8+
var srcFiles = ['lib/**/*'];
9+
var dist = 'built/';
10+
return gulp.src(srcFiles).pipe(gulp.dest(dist));
11+
});
12+
13+
gulp.task('webdriver:update', function() {
14+
var child = spawnSync('bin/webdriver-manager', ['update']);
15+
if (child.stdout != null) {
16+
console.log(child.stdout.toString());
17+
}
18+
if (child.status !== 0) {
19+
throw new Error('webdriver-manager update: child error');
20+
}
21+
});
22+
23+
gulp.task('jslint', function() {
24+
var child = spawnSync('./node_modules/.bin/jshint', ['lib','spec', 'scripts']);
25+
if (child != null && child.stdout != null ) {
26+
console.log(child.stdout.toString());
27+
}
28+
if (child.status !== 0) {
29+
throw new Error('jslint: child error');
30+
}
31+
});
32+
33+
gulp.task('pretest', function() {
34+
runSequence(
35+
['webdriver:update', 'jslint'],
36+
'built:copy'
37+
);
38+
});
39+
gulp.task('prepublish', ['built:copy']);

Diff for: package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@
2727
"expect.js": "~0.3.1",
2828
"chai": "~3.4.1",
2929
"chai-as-promised": "~5.2.0",
30+
"gulp": "^3.9.1",
3031
"jshint": "2.9.1",
3132
"mocha": "2.3.4",
3233
"express": "~4.13.3",
3334
"body-parser": "1.14.2",
3435
"rimraf": "~2.5.0",
36+
"run-sequence": "^1.1.5",
3537
"lodash": "^2.4.1",
3638
"marked": "^0.3.3"
3739
},
@@ -45,7 +47,8 @@
4547
},
4648
"main": "lib/protractor.js",
4749
"scripts": {
48-
"pretest": "./scripts/pretest.sh",
50+
"prepublish": "gulp prepublish",
51+
"pretest": "gulp pretest",
4952
"test": "node scripts/test.js",
5053
"start": "node testapp/scripts/web-server.js"
5154
},

Diff for: scripts/interactive_tests/interactive_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var env = require('../../spec/environment.js');
22
var InteractiveTest = require('./interactive_test_util').InteractiveTest;
33
var port = env.interactiveTestPort;
4-
var test = new InteractiveTest('node lib/cli.js --elementExplorer true', port);
4+
var test = new InteractiveTest('node built/cli.js --elementExplorer true', port);
55

66
// Check state persists.
77
test.addCommandExpectation('var x = 3');

Diff for: scripts/interactive_tests/with_base_url.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var env = require('../../spec/environment.js');
22
var InteractiveTest = require('./interactive_test_util').InteractiveTest;
33
var port = env.interactiveTestPort;
44
var test = new InteractiveTest(
5-
'node lib/cli.js --baseUrl http://localhost:' + env.webServerDefaultPort +
5+
'node built/cli.js --baseUrl http://localhost:' + env.webServerDefaultPort +
66
'/ng1 --elementExplorer true', port);
77

88
// Check we automatically go to to baseUrl.

Diff for: scripts/pretest.sh

-5
This file was deleted.

Diff for: scripts/test.js

+38-38
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,35 @@
33
var Executor = require('./test/test_util').Executor;
44

55
var passingTests = [
6-
'node lib/cli.js spec/basicConf.js',
7-
'node lib/cli.js spec/multiConf.js',
8-
'node lib/cli.js spec/altRootConf.js',
9-
'node lib/cli.js spec/onCleanUpAsyncReturnValueConf.js',
10-
'node lib/cli.js spec/onCleanUpNoReturnValueConf.js',
11-
'node lib/cli.js spec/onCleanUpSyncReturnValueConf.js',
12-
'node lib/cli.js spec/onPrepareConf.js',
13-
'node lib/cli.js spec/onPrepareFileConf.js',
14-
'node lib/cli.js spec/onPreparePromiseConf.js',
15-
'node lib/cli.js spec/onPreparePromiseFileConf.js',
16-
'node lib/cli.js spec/mochaConf.js',
17-
'node lib/cli.js spec/withLoginConf.js',
18-
'node lib/cli.js spec/suitesConf.js --suite okmany',
19-
'node lib/cli.js spec/suitesConf.js --suite okspec',
20-
'node lib/cli.js spec/suitesConf.js --suite okmany,okspec',
21-
'node lib/cli.js spec/plugins/smokeConf.js',
22-
'node lib/cli.js spec/plugins/multiPluginConf.js',
23-
'node lib/cli.js spec/plugins/jasminePostTestConf.js',
24-
'node lib/cli.js spec/plugins/mochaPostTestConf.js',
25-
'node lib/cli.js spec/plugins/browserGetSyncedConf.js',
26-
'node lib/cli.js spec/plugins/browserGetUnsyncedConf.js',
27-
'node lib/cli.js spec/plugins/waitForAngularConf.js',
28-
'node lib/cli.js spec/interactionConf.js',
29-
'node lib/cli.js spec/directConnectConf.js',
30-
'node lib/cli.js spec/restartBrowserBetweenTestsConf.js',
31-
'node lib/cli.js spec/getCapabilitiesConf.js',
32-
'node lib/cli.js spec/controlLockConf.js',
33-
'node lib/cli.js spec/customFramework.js',
34-
'node lib/cli.js spec/angular2Conf.js',
6+
'node built/cli.js spec/basicConf.js',
7+
'node built/cli.js spec/multiConf.js',
8+
'node built/cli.js spec/altRootConf.js',
9+
'node built/cli.js spec/onCleanUpAsyncReturnValueConf.js',
10+
'node built/cli.js spec/onCleanUpNoReturnValueConf.js',
11+
'node built/cli.js spec/onCleanUpSyncReturnValueConf.js',
12+
'node built/cli.js spec/onPrepareConf.js',
13+
'node built/cli.js spec/onPrepareFileConf.js',
14+
'node built/cli.js spec/onPreparePromiseConf.js',
15+
'node built/cli.js spec/onPreparePromiseFileConf.js',
16+
'node built/cli.js spec/mochaConf.js',
17+
'node built/cli.js spec/withLoginConf.js',
18+
'node built/cli.js spec/suitesConf.js --suite okmany',
19+
'node built/cli.js spec/suitesConf.js --suite okspec',
20+
'node built/cli.js spec/suitesConf.js --suite okmany,okspec',
21+
'node built/cli.js spec/plugins/smokeConf.js',
22+
'node built/cli.js spec/plugins/multiPluginConf.js',
23+
'node built/cli.js spec/plugins/jasminePostTestConf.js',
24+
'node built/cli.js spec/plugins/mochaPostTestConf.js',
25+
'node built/cli.js spec/plugins/browserGetSyncedConf.js',
26+
'node built/cli.js spec/plugins/browserGetUnsyncedConf.js',
27+
'node built/cli.js spec/plugins/waitForAngularConf.js',
28+
'node built/cli.js spec/interactionConf.js',
29+
'node built/cli.js spec/directConnectConf.js',
30+
'node built/cli.js spec/restartBrowserBetweenTestsConf.js',
31+
'node built/cli.js spec/getCapabilitiesConf.js',
32+
'node built/cli.js spec/controlLockConf.js',
33+
'node built/cli.js spec/customFramework.js',
34+
'node built/cli.js spec/angular2Conf.js',
3535
'node scripts/attachSession.js',
3636
'node scripts/interactive_tests/interactive_test.js',
3737
'node scripts/interactive_tests/with_base_url.js',
@@ -51,28 +51,28 @@ passingTests.forEach(function(passing_test) {
5151
*************************/
5252

5353
// assert stacktrace shows line of failure
54-
executor.addCommandlineTest('node lib/cli.js spec/errorTest/singleFailureConf.js')
54+
executor.addCommandlineTest('node built/cli.js spec/errorTest/singleFailureConf.js')
5555
.expectExitCode(1)
5656
.expectErrors({
5757
stackTrace: 'single_failure_spec1.js:5:32'
5858
});
5959

6060
// assert timeout works
61-
executor.addCommandlineTest('node lib/cli.js spec/errorTest/timeoutConf.js')
61+
executor.addCommandlineTest('node built/cli.js spec/errorTest/timeoutConf.js')
6262
.expectExitCode(1)
6363
.expectErrors({
6464
message: 'Timeout - Async callback was not invoked within timeout ' +
6565
'specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.'
6666
})
6767
.expectTestDuration(0, 100);
6868

69-
executor.addCommandlineTest('node lib/cli.js spec/errorTest/afterLaunchChangesExitCodeConf.js')
69+
executor.addCommandlineTest('node built/cli.js spec/errorTest/afterLaunchChangesExitCodeConf.js')
7070
.expectExitCode(11)
7171
.expectErrors({
7272
message: 'Expected \'Hiya\' to equal \'INTENTIONALLY INCORRECT\'.'
7373
});
7474

75-
executor.addCommandlineTest('node lib/cli.js spec/errorTest/multiFailureConf.js')
75+
executor.addCommandlineTest('node built/cli.js spec/errorTest/multiFailureConf.js')
7676
.expectExitCode(1)
7777
.expectErrors([{
7878
message: 'Expected \'Hiya\' to equal \'INTENTIONALLY INCORRECT\'.',
@@ -82,7 +82,7 @@ executor.addCommandlineTest('node lib/cli.js spec/errorTest/multiFailureConf.js'
8282
stacktrace: 'single_failure_spec2.js:5:32'
8383
}]);
8484

85-
executor.addCommandlineTest('node lib/cli.js spec/errorTest/shardedFailureConf.js')
85+
executor.addCommandlineTest('node built/cli.js spec/errorTest/shardedFailureConf.js')
8686
.expectExitCode(1)
8787
.expectErrors([{
8888
message: 'Expected \'Hiya\' to equal \'INTENTIONALLY INCORRECT\'.',
@@ -92,14 +92,14 @@ executor.addCommandlineTest('node lib/cli.js spec/errorTest/shardedFailureConf.j
9292
stacktrace: 'single_failure_spec2.js:5:32'
9393
}]);
9494

95-
executor.addCommandlineTest('node lib/cli.js spec/errorTest/mochaFailureConf.js')
95+
executor.addCommandlineTest('node built/cli.js spec/errorTest/mochaFailureConf.js')
9696
.expectExitCode(1)
9797
.expectErrors([{
9898
message: 'expected \'My AngularJS App\' to equal \'INTENTIONALLY INCORRECT\'',
9999
stacktrace: 'mocha_failure_spec.js:11:20'
100100
}]);
101101

102-
executor.addCommandlineTest('node lib/cli.js spec/errorTest/pluginsFailingConf.js')
102+
executor.addCommandlineTest('node built/cli.js spec/errorTest/pluginsFailingConf.js')
103103
.expectExitCode(1)
104104
.expectErrors([
105105
{message: 'Expected true to be false'},
@@ -109,7 +109,7 @@ executor.addCommandlineTest('node lib/cli.js spec/errorTest/pluginsFailingConf.j
109109
{message: 'from teardown'}
110110
]);
111111

112-
executor.addCommandlineTest('node lib/cli.js spec/errorTest/slowHttpAndTimeoutConf.js')
112+
executor.addCommandlineTest('node built/cli.js spec/errorTest/slowHttpAndTimeoutConf.js')
113113
.expectExitCode(1)
114114
.expectErrors([
115115
{message: 'The following tasks were pending[\\s\\S]*\\$http: slowcall'},
@@ -119,7 +119,7 @@ executor.addCommandlineTest('node lib/cli.js spec/errorTest/slowHttpAndTimeoutCo
119119
'*}'}
120120
]);
121121

122-
executor.addCommandlineTest('node lib/cli.js spec/errorTest/slowHttpAndTimeoutConf.js ' +
122+
executor.addCommandlineTest('node built/cli.js spec/errorTest/slowHttpAndTimeoutConf.js ' +
123123
'--untrackOutstandingTimeouts true')
124124
.expectExitCode(1)
125125
.expectErrors([

0 commit comments

Comments
 (0)