mirror of
https://github.com/yldio/copilot.git
synced 2024-11-28 14:10:04 +02:00
enable tests on ui
This commit is contained in:
parent
eefaf1d625
commit
a9a19e4476
6
Makefile
6
Makefile
@ -10,8 +10,12 @@ test-cloudapi-graphql:
|
|||||||
test-frontend:
|
test-frontend:
|
||||||
$(MAKE) -C frontend test
|
$(MAKE) -C frontend test
|
||||||
|
|
||||||
|
.PHONY: test-ui
|
||||||
|
test-ui:
|
||||||
|
$(MAKE) -C ui test
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test: test-cloudapi-graphql test-frontend
|
test: test-cloudapi-graphql test-frontend test-ui
|
||||||
|
|
||||||
.PHONY: install-cloudapi-graphql
|
.PHONY: install-cloudapi-graphql
|
||||||
install-cloudapi-graphql:
|
install-cloudapi-graphql:
|
||||||
|
10
ui/.babelrc
10
ui/.babelrc
@ -12,5 +12,15 @@
|
|||||||
["transform-object-rest-spread", {
|
["transform-object-rest-spread", {
|
||||||
"useBuiltIns": true
|
"useBuiltIns": true
|
||||||
}]
|
}]
|
||||||
|
],
|
||||||
|
"env": {
|
||||||
|
"test": {
|
||||||
|
"plugins": [
|
||||||
|
["babel-plugin-webpack-loaders", {
|
||||||
|
"config": "${CONFIG}",
|
||||||
|
"verbose": true
|
||||||
|
}]
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
7
ui/Makefile
Normal file
7
ui/Makefile
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
.PHONY: test
|
||||||
|
test:
|
||||||
|
yarn run test
|
||||||
|
|
||||||
|
.PHONY: install
|
||||||
|
install:
|
||||||
|
yarn
|
@ -6,7 +6,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "webpack-dev-server --open --config webpack/index.js",
|
"start": "webpack-dev-server --open --config webpack/index.js",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"test": "NODE_ENV=test nyc ava test/*.js --verbose",
|
"test": "BABEL_DISABLE_CACHE=1 NODE_ENV=test CONFIG=$(pwd)/webpack/index.js nyc ava test/*.js --verbose",
|
||||||
"build": "NODE_ENV=production webpack --config webpack/index.js",
|
"build": "NODE_ENV=production webpack --config webpack/index.js",
|
||||||
"clean-static": "sh scripts/clean-static.sh",
|
"clean-static": "sh scripts/clean-static.sh",
|
||||||
"build-docs-static": "sh scripts/build-docs-static.sh"
|
"build-docs-static": "sh scripts/build-docs-static.sh"
|
||||||
@ -22,6 +22,7 @@
|
|||||||
"babel-plugin-add-module-exports": "^0.2.1",
|
"babel-plugin-add-module-exports": "^0.2.1",
|
||||||
"babel-plugin-syntax-async-functions": "^6.13.0",
|
"babel-plugin-syntax-async-functions": "^6.13.0",
|
||||||
"babel-plugin-transform-object-rest-spread": "^6.16.0",
|
"babel-plugin-transform-object-rest-spread": "^6.16.0",
|
||||||
|
"babel-plugin-webpack-loaders": "^0.8.0",
|
||||||
"babel-preset-es2015": "^6.16.0",
|
"babel-preset-es2015": "^6.16.0",
|
||||||
"babel-preset-react": "^6.16.0",
|
"babel-preset-react": "^6.16.0",
|
||||||
"babel-register": "^6.16.3",
|
"babel-register": "^6.16.3",
|
||||||
|
@ -6,20 +6,8 @@ const {
|
|||||||
shallow
|
shallow
|
||||||
} = enzyme;
|
} = enzyme;
|
||||||
|
|
||||||
test('renders <App> without exploding', (t) => {
|
test('renders <Button> without exploding', (t) => {
|
||||||
const App = require('../src/containers/app');
|
const Button = require('../src/button');
|
||||||
const wrapper = shallow(<App />);
|
const wrapper = shallow(<Button />);
|
||||||
t.deepEqual(wrapper.length, 1);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('renders <Home> without exploding', (t) => {
|
|
||||||
const Home = require('../src/containers/home');
|
|
||||||
const wrapper = shallow(<Home />);
|
|
||||||
t.deepEqual(wrapper.length, 1);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('renders <NotFound> without exploding', (t) => {
|
|
||||||
const NotFound = require('../src/containers/not-found');
|
|
||||||
const wrapper = shallow(<NotFound />);
|
|
||||||
t.deepEqual(wrapper.length, 1);
|
t.deepEqual(wrapper.length, 1);
|
||||||
});
|
});
|
||||||
|
@ -2,20 +2,13 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
|||||||
const webpack = require('webpack');
|
const webpack = require('webpack');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
module.exports = {
|
const plugins = {
|
||||||
context: path.join(__dirname, '../'),
|
'no-errors-plugin': new webpack.NoErrorsPlugin(),
|
||||||
output: {
|
'extract-text-plugin': new ExtractTextPlugin({
|
||||||
path: path.join(__dirname, '../static'),
|
|
||||||
publicPath: '/static/',
|
|
||||||
filename: '[name].js'
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
new webpack.NoErrorsPlugin(),
|
|
||||||
new ExtractTextPlugin({
|
|
||||||
filename: '[name].css',
|
filename: '[name].css',
|
||||||
allChunks: true
|
allChunks: true
|
||||||
}),
|
}),
|
||||||
new webpack.LoaderOptionsPlugin({
|
'loader-options-plugin': new webpack.LoaderOptionsPlugin({
|
||||||
options: {
|
options: {
|
||||||
postcss: {
|
postcss: {
|
||||||
plugins: () => {
|
plugins: () => {
|
||||||
@ -25,10 +18,24 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
'embed-markdown-loader': {
|
'embed-markdown-loader': {
|
||||||
// webpackConfigFullpath: path.join(__dirname, 'index.js') don't detach yet (has a bug in the production config)
|
// don't detach yet (has a bug in the production config)
|
||||||
|
// webpackConfigFullpath: path.join(__dirname, 'index.js')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
context: path.join(__dirname, '../'),
|
||||||
|
output: {
|
||||||
|
path: path.join(__dirname, '../static'),
|
||||||
|
publicPath: '/static/',
|
||||||
|
filename: '[name].js'
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
plugins['no-errors-plugin'],
|
||||||
|
plugins['extract-text-plugin'],
|
||||||
|
plugins['loader-options-plugin']
|
||||||
],
|
],
|
||||||
resolveLoader: {
|
resolveLoader: {
|
||||||
alias: {
|
alias: {
|
||||||
@ -74,3 +81,5 @@ module.exports = {
|
|||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports.__plugins = plugins;
|
||||||
|
19
ui/webpack/test.js
Normal file
19
ui/webpack/test.js
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
const config = require('./config');
|
||||||
|
const webpack = require('webpack');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
output: {
|
||||||
|
libraryTarget: 'commonjs2'
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
config.__plugins['no-errors-plugin'],
|
||||||
|
config.__plugins['loader-options-plugin']
|
||||||
|
],
|
||||||
|
module: {
|
||||||
|
loaders: [{
|
||||||
|
test: /\.css?$/,
|
||||||
|
loader: 'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss-loader'
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
};
|
6234
ui/yarn.lock
Normal file
6234
ui/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user