Skip to content

Commit

Permalink
Merge pull request #946 from marmelab/remove_grunt
Browse files Browse the repository at this point in the history
[RFR] Remove grunt
  • Loading branch information
fzaninotto committed Mar 2, 2016
2 parents b3f4c0c + 8e6d701 commit e2b527e
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 82 deletions.
69 changes: 0 additions & 69 deletions Gruntfile.js

This file was deleted.

15 changes: 12 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,19 @@ build:
@cp -Rf build examples/blog/
@echo "Files build/ng-admin.min.css and build/ng-admin.min.js updated (with minification)"

test: test-unit test-e2e

test-unit:
@./node_modules/.bin/karma start src/javascripts/test/karma.conf.js --single-run

test-e2e:
@./node_modules/.bin/grunt test:e2e
test-e2e: prepare-test-e2e
@./node_modules/.bin/protractor src/javascripts/test/protractor.conf.js

test: test-unit test-e2e
prepare-test-e2e:
@echo "Preparing files for e2e tests"
@NODE_ENV=test ./node_modules/webpack/bin/webpack.js -p --optimize-minimize --optimize-occurence-order --optimize-dedupe
@cp examples/blog/*.js src/javascripts/test/fixtures/examples/blog
@cp examples/blog/*.html src/javascripts/test/fixtures/examples/blog
@sed -i.bak 's|http://localhost:8000/|/|g' src/javascripts/test/fixtures/examples/blog/index.html
@cp node_modules/fakerest/dist/FakeRest.min.js src/javascripts/test/fixtures/examples/blog/build/fakerest.js
@cp node_modules/sinon/pkg/sinon-server-1.14.1.js src/javascripts/test/fixtures/examples/blog/build/sinon-server.js
7 changes: 1 addition & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,12 @@
"fakerest": "^1.1.4",
"file-loader": "^0.8.1",
"font-awesome": "^4.3.0",
"grunt": "~0.4.4",
"grunt-cli": "^0.1.13",
"grunt-contrib-connect": "^0.8.0",
"grunt-contrib-copy": "^0.6.0",
"grunt-exec": "^0.4.6",
"grunt-protractor-runner": "~3.0.0",
"html-loader": "^0.3.0",
"humane-js": "^3.2.2",
"jasmine": "~2.4.1",
"jasmine-core": "~2.4.1",
"jshint-stylish": "~0.1.3",
"json-server": "~0.8.8",
"jsonlint": "^1.6.2",
"karma": "~0.12.14",
"karma-chrome-launcher": "^0.2.0",
Expand Down
38 changes: 35 additions & 3 deletions src/javascripts/test/protractor.conf.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,36 @@
/*global browser*/
var jsonServer = require('json-server');
var path = require('path');

var server = function() {
const server = jsonServer.create();

server.use(jsonServer.defaults({
static: path.join(__dirname, '/fixtures/examples/blog'),
logger: false
}));

server.listen(8001);

return server;
}

var beforeLaunch = function () {
global.server = server();
};

var onPrepare = function () {
browser.executeScript('window.name = "NG_ENABLE_DEBUG_INFO"');
}

var afterLaunch = function () {
if (!global.server || !global.server.close) {
return;
}

global.server.close();
};

exports.config = {
sauceUser: process.env.SAUCE_USERNAME,
sauceKey: process.env.SAUCE_ACCESS_KEY,
Expand All @@ -23,7 +55,7 @@ exports.config = {
defaultTimeoutInterval: 360000
},

onPrepare: function () {
browser.executeScript('window.name = "NG_ENABLE_DEBUG_INFO"');
}
beforeLaunch: beforeLaunch,
onPrepare: onPrepare,
afterLaunch: afterLaunch,
};
5 changes: 4 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ module.exports = {
'ng-admin': getEntrySources(ngAdminAndVendorSources),
'ng-admin-only': getEntrySources(ngAdminSources)
},
output: {
output: process.env.NODE_ENV === 'test' ? {
path: './src/javascripts/test/fixtures/examples/blog/',
filename: "build/[name].min.js"
} : {
publicPath: "http://localhost:8000/",
filename: "build/[name].min.js"
},
Expand Down

0 comments on commit e2b527e

Please sign in to comment.