Skip to content

Commit 248e5ba

Browse files
author
Bernie Zang
committed
feat(tooling): Added config to bypass Jest issue with node_modules.
1 parent a1c9faa commit 248e5ba

File tree

6 files changed

+32
-15
lines changed

6 files changed

+32
-15
lines changed

jest.config.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"testPathDirs": [
3+
"<rootDir>/packages/node_modules/@ciscospark/",
4+
"<rootDir>/src/"
5+
],
6+
"testPathIgnorePatterns": ["<rootDir>/node_modules/"],
7+
"transformIgnorePatterns": ["<rootDir>/node_modules/"],
8+
"moduleNameMapper": {
9+
"^.+\\.(css|less)$": "<rootDir>/test/style-mock.js",
10+
"^.+\\.(gif|ttf|eot|svg|png)$": "<rootDir>/test/file-mock.js"
11+
},
12+
"testRegex": ".test.js$",
13+
"moduleDirectories": [
14+
"<rootDir>/node_modules/",
15+
"<rootDir>/packages/node_modules/"
16+
],
17+
"haste": {
18+
"providesModuleNodeModules": [".*"]
19+
},
20+
"verbose": true
21+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"scripts": {
66
"build": "NODE_ENV=production babel-node --presets=stage-1,es2015 scripts/build-all.js",
77
"build:package": "NODE_ENV=production babel-node --presets=stage-1,es2015 scripts/build-package.js",
8-
"test": "echo \"Error: no test specified\" && exit 1",
8+
"test": "jest --config=jest.config.json",
99
"start": "webpack-dev-server --hot --inline --port 8000 --colors",
1010
"storybook": "start-storybook -p 9001 -c .storybook"
1111
},

scripts/webpack/webpack.base.babel.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ export default (options) => ({
5858
use: [
5959
{
6060
loader: `babel-loader`,
61-
options: options.babelQuery
61+
options: Object.assign({
62+
presets: [`react`, `es2015`]
63+
}, options.babelQuery)
6264
}
6365
]
6466
},

scripts/webpack/webpack.dev.babel.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,12 @@ const plugins = [
1010
})
1111
];
1212

13-
export default (options) => webpackConfigBase(Object.assign({
13+
export default webpackConfigBase({
1414
entry: `./index.js`,
1515
plugins,
1616
devtools: `cheap-module-eval-source-map`,
1717
postcss: [postcssReporter],
18-
babelQuery: {
19-
presets: [`es2015`, `react`]
20-
},
2118
babelInclude: [
2219
path.resolve(__dirname, `packages`, `node_modules`)
2320
]
24-
}, options));
21+
});

scripts/webpack/webpack.prod.babel.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,26 @@ import webpack from 'webpack';
44
import webpackBaseConfig from './webpack.base.babel';
55

66
const plugins = [
7+
// Setup uglify to compress and suppress warnings in logs
78
new webpack.optimize.UglifyJsPlugin({
89
sourceMap: true,
910
compress: {
1011
warnings: false
1112
}
1213
}),
14+
// Remove locales from moment, may need to add back in future
1315
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)
1416
];
1517

16-
const config = webpackBaseConfig({
17-
context: path.resolve(`./src`),
18+
export default webpackBaseConfig({
1819
entry: `./index.js`,
20+
// Full source maps for production debugging
1921
devtool: `source-map`,
2022
plugins,
23+
// Reset env values we don't want to see in bundles
2124
env: {
2225
CISCOSPARK_ACCESS_TOKEN: ``,
2326
TO_PERSON_EMAIL: ``,
2427
TO_PERSON_ID: ``
25-
},
26-
babelQuery: {
27-
presets: [`react`, `es2015`]
2828
}
2929
});
30-
console.log(`STUPID`);
31-
console.log(__dirname);
32-
export default config;

src/components.js

Whitespace-only changes.

0 commit comments

Comments
 (0)