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

chore(built): adding gulp prepublish and gulp pretest tasks #2919

Merged
merged 1 commit into from
Feb 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
built/
node_modules/
selenium/
testapp/inbrowsertest/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should we add lib/ to .npmignore as well, right? Or will TypeScript users need that for typing info?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Added lib/ to the .npmignore

Expand Down
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
debugging/
docs/
lib/
scripts/
spec/
stress/
Expand Down
2 changes: 1 addition & 1 deletion bin/protractor
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

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

require('../lib/cli.js');
require('../built/cli.js');
39 changes: 39 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
'use strict';

var gulp = require('gulp');
var runSequence = require('run-sequence');
var spawnSync = require('child_process').spawnSync;

gulp.task('built:copy', function() {
var srcFiles = ['lib/**/*'];
var dist = 'built/';
return gulp.src(srcFiles).pipe(gulp.dest(dist));
});

gulp.task('webdriver:update', function() {
var child = spawnSync('bin/webdriver-manager', ['update']);
if (child.stdout != null) {
console.log(child.stdout.toString());
}
if (child.status !== 0) {
throw new Error('webdriver-manager update: child error');
}
});

gulp.task('jslint', function() {
var child = spawnSync('./node_modules/.bin/jshint', ['lib','spec', 'scripts']);
if (child != null && child.stdout != null ) {
console.log(child.stdout.toString());
}
if (child.status !== 0) {
throw new Error('jslint: child error');
}
});

gulp.task('pretest', function() {
runSequence(
['webdriver:update', 'jslint'],
'built:copy'
);
});
gulp.task('prepublish', ['built:copy']);
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@
"expect.js": "~0.3.1",
"chai": "~3.4.1",
"chai-as-promised": "~5.2.0",
"gulp": "^3.9.1",
"jshint": "2.9.1",
"mocha": "2.3.4",
"express": "~4.13.3",
"body-parser": "1.14.2",
"rimraf": "~2.5.0",
"run-sequence": "^1.1.5",
"lodash": "^2.4.1",
"marked": "^0.3.3"
},
Expand All @@ -45,7 +47,8 @@
},
"main": "lib/protractor.js",
"scripts": {
"pretest": "./scripts/pretest.sh",
"prepublish": "gulp prepublish",
"pretest": "gulp pretest",
"test": "node scripts/test.js",
"start": "node testapp/scripts/web-server.js"
},
Expand Down
2 changes: 1 addition & 1 deletion scripts/interactive_tests/interactive_test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var env = require('../../spec/environment.js');
var InteractiveTest = require('./interactive_test_util').InteractiveTest;
var port = env.interactiveTestPort;
var test = new InteractiveTest('node lib/cli.js --elementExplorer true', port);
var test = new InteractiveTest('node built/cli.js --elementExplorer true', port);

// Check state persists.
test.addCommandExpectation('var x = 3');
Expand Down
2 changes: 1 addition & 1 deletion scripts/interactive_tests/with_base_url.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var env = require('../../spec/environment.js');
var InteractiveTest = require('./interactive_test_util').InteractiveTest;
var port = env.interactiveTestPort;
var test = new InteractiveTest(
'node lib/cli.js --baseUrl http://localhost:' + env.webServerDefaultPort +
'node built/cli.js --baseUrl http://localhost:' + env.webServerDefaultPort +
'/ng1 --elementExplorer true', port);

// Check we automatically go to to baseUrl.
Expand Down
5 changes: 0 additions & 5 deletions scripts/pretest.sh

This file was deleted.

76 changes: 38 additions & 38 deletions scripts/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,35 @@
var Executor = require('./test/test_util').Executor;

var passingTests = [
'node lib/cli.js spec/basicConf.js',
'node lib/cli.js spec/multiConf.js',
'node lib/cli.js spec/altRootConf.js',
'node lib/cli.js spec/onCleanUpAsyncReturnValueConf.js',
'node lib/cli.js spec/onCleanUpNoReturnValueConf.js',
'node lib/cli.js spec/onCleanUpSyncReturnValueConf.js',
'node lib/cli.js spec/onPrepareConf.js',
'node lib/cli.js spec/onPrepareFileConf.js',
'node lib/cli.js spec/onPreparePromiseConf.js',
'node lib/cli.js spec/onPreparePromiseFileConf.js',
'node lib/cli.js spec/mochaConf.js',
'node lib/cli.js spec/withLoginConf.js',
'node lib/cli.js spec/suitesConf.js --suite okmany',
'node lib/cli.js spec/suitesConf.js --suite okspec',
'node lib/cli.js spec/suitesConf.js --suite okmany,okspec',
'node lib/cli.js spec/plugins/smokeConf.js',
'node lib/cli.js spec/plugins/multiPluginConf.js',
'node lib/cli.js spec/plugins/jasminePostTestConf.js',
'node lib/cli.js spec/plugins/mochaPostTestConf.js',
'node lib/cli.js spec/plugins/browserGetSyncedConf.js',
'node lib/cli.js spec/plugins/browserGetUnsyncedConf.js',
'node lib/cli.js spec/plugins/waitForAngularConf.js',
'node lib/cli.js spec/interactionConf.js',
'node lib/cli.js spec/directConnectConf.js',
'node lib/cli.js spec/restartBrowserBetweenTestsConf.js',
'node lib/cli.js spec/getCapabilitiesConf.js',
'node lib/cli.js spec/controlLockConf.js',
'node lib/cli.js spec/customFramework.js',
'node lib/cli.js spec/angular2Conf.js',
'node built/cli.js spec/basicConf.js',
'node built/cli.js spec/multiConf.js',
'node built/cli.js spec/altRootConf.js',
'node built/cli.js spec/onCleanUpAsyncReturnValueConf.js',
'node built/cli.js spec/onCleanUpNoReturnValueConf.js',
'node built/cli.js spec/onCleanUpSyncReturnValueConf.js',
'node built/cli.js spec/onPrepareConf.js',
'node built/cli.js spec/onPrepareFileConf.js',
'node built/cli.js spec/onPreparePromiseConf.js',
'node built/cli.js spec/onPreparePromiseFileConf.js',
'node built/cli.js spec/mochaConf.js',
'node built/cli.js spec/withLoginConf.js',
'node built/cli.js spec/suitesConf.js --suite okmany',
'node built/cli.js spec/suitesConf.js --suite okspec',
'node built/cli.js spec/suitesConf.js --suite okmany,okspec',
'node built/cli.js spec/plugins/smokeConf.js',
'node built/cli.js spec/plugins/multiPluginConf.js',
'node built/cli.js spec/plugins/jasminePostTestConf.js',
'node built/cli.js spec/plugins/mochaPostTestConf.js',
'node built/cli.js spec/plugins/browserGetSyncedConf.js',
'node built/cli.js spec/plugins/browserGetUnsyncedConf.js',
'node built/cli.js spec/plugins/waitForAngularConf.js',
'node built/cli.js spec/interactionConf.js',
'node built/cli.js spec/directConnectConf.js',
'node built/cli.js spec/restartBrowserBetweenTestsConf.js',
'node built/cli.js spec/getCapabilitiesConf.js',
'node built/cli.js spec/controlLockConf.js',
'node built/cli.js spec/customFramework.js',
'node built/cli.js spec/angular2Conf.js',
'node scripts/attachSession.js',
'node scripts/interactive_tests/interactive_test.js',
'node scripts/interactive_tests/with_base_url.js',
Expand All @@ -51,28 +51,28 @@ passingTests.forEach(function(passing_test) {
*************************/

// assert stacktrace shows line of failure
executor.addCommandlineTest('node lib/cli.js spec/errorTest/singleFailureConf.js')
executor.addCommandlineTest('node built/cli.js spec/errorTest/singleFailureConf.js')
.expectExitCode(1)
.expectErrors({
stackTrace: 'single_failure_spec1.js:5:32'
});

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

executor.addCommandlineTest('node lib/cli.js spec/errorTest/afterLaunchChangesExitCodeConf.js')
executor.addCommandlineTest('node built/cli.js spec/errorTest/afterLaunchChangesExitCodeConf.js')
.expectExitCode(11)
.expectErrors({
message: 'Expected \'Hiya\' to equal \'INTENTIONALLY INCORRECT\'.'
});

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

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

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

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

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

executor.addCommandlineTest('node lib/cli.js spec/errorTest/slowHttpAndTimeoutConf.js ' +
executor.addCommandlineTest('node built/cli.js spec/errorTest/slowHttpAndTimeoutConf.js ' +
'--untrackOutstandingTimeouts true')
.expectExitCode(1)
.expectErrors([
Expand Down