Permalink
Browse files

Get tests and lints working again under monorepo, out from under each

individual site dir.
  • Loading branch information...
1 parent 72a9a02 commit e979fa375ea3b946659c137e8cc8f742761a14ec @brev brev committed Dec 14, 2016
Showing with 492 additions and 487 deletions.
  1. +4 −0 .babelrc
  2. +1 −1 {packages/numenta.org → }/.eslintignore
  3. +3 −0 .eslintrc.json
  4. +3 −1 .gitignore
  5. 0 {packages/numenta.org → }/.jestrc.json
  6. +1 −0 {packages/numenta.com → }/.stylelintignore
  7. +2 −1 {packages/numenta.org → }/__tests__/__mocks__/configMock.js
  8. 0 {packages/numenta.org → }/__tests__/__mocks__/fileMock.js
  9. +7 −0 {packages/numenta.com → }/__tests__/__mocks__/reactContextMock.js
  10. 0 {packages/numenta.org → }/__tests__/__mocks__/styleMock.js
  11. 0 {packages/numenta.org → }/__tests__/__setup.js
  12. +62 −1 package.json
  13. 0 packages/{numenta.com → }/.eslintignore
  14. +1 −0 packages/components/Disqus/__tests__/__snapshots__/index.unit.test.jsx.snap
  15. +1 −1 packages/components/Footer/__tests__/index.unit.test.jsx
  16. +8 −134 packages/components/Glance/__tests__/__snapshots__/index.unit.test.jsx.snap
  17. +18 −2 packages/components/Glance/__tests__/index.unit.test.jsx
  18. +8 −23 packages/components/Glance/index.jsx
  19. +76 −0 packages/components/Header/__tests__/__snapshots__/index.unit.test.jsx.snap
  20. +14 −13 packages/components/Header/__tests__/index.unit.test.jsx
  21. +16 −14 packages/components/Header/index.jsx
  22. +1 −1 packages/components/Image/index.jsx
  23. +1 −1 packages/components/ImageLink/index.jsx
  24. +8 −0 packages/components/Logo/__tests__/__snapshots__/index.unit.test.jsx.snap
  25. +8 −8 packages/components/Logo/__tests__/index.unit.test.jsx
  26. +8 −0 packages/components/LogoMark/__tests__/__snapshots__/index.unit.test.jsx.snap
  27. +9 −9 packages/components/LogoMark/__tests__/index.unit.test.jsx
  28. +1 −1 packages/components/Markdown/index.jsx
  29. +1 −1 packages/components/Pingdom/__tests__/index.unit.test.jsx
  30. +1 −1 packages/components/PostListItem/__tests__/index.unit.test.jsx
  31. +34 −0 packages/components/Quote/__tests__/__snapshots__/index.unit.test.jsx.snap
  32. +58 −0 packages/components/Search/__tests__/__snapshots__/index.unit.test.jsx.snap
  33. +14 −9 packages/components/Search/__tests__/index.unit.test.jsx
  34. +4 −4 packages/components/Search/index.jsx
  35. +1 −0 packages/components/SearchResult/__tests__/__snapshots__/index.unit.test.jsx.snap
  36. +18 −14 packages/components/SearchResult/__tests__/index.unit.test.jsx
  37. +1 −0 packages/components/SearchResult/index.jsx
  38. +1 −1 packages/components/Section/__tests__/index.unit.test.jsx
  39. +1 −1 packages/components/Section/index.jsx
  40. +1 −1 packages/components/SocialMedia/__tests__/index.unit.test.jsx
  41. +3 −3 packages/components/TextLink/index.jsx
  42. +17 −0 packages/components/Video/__tests__/__snapshots__/index.unit.test.jsx.snap
  43. +16 −16 packages/components/Video/__tests__/index.unit.test.jsx
  44. +1 −0 packages/components/Video/index.jsx
  45. +7 −15 packages/components/package.json
  46. +0 −20 packages/numenta.com/.jestrc.json
  47. +0 −13 packages/numenta.com/__tests__/__mocks__/configMock.js
  48. +0 −7 packages/numenta.com/__tests__/__mocks__/fileMock.js
  49. +0 −10 packages/numenta.com/__tests__/__mocks__/styleMock.js
  50. +0 −1 packages/numenta.com/__tests__/__setup.js
  51. +1 −1 packages/numenta.com/__tests__/wrappers/html.unit.test.jsx
  52. +1 −1 packages/numenta.com/__tests__/wrappers/json.unit.test.jsx
  53. +1 −1 packages/numenta.com/__tests__/wrappers/md.unit.test.jsx
  54. +1 −1 packages/numenta.com/components/Layout/__tests__/index.unit.test.jsx
  55. +1 −1 packages/numenta.com/components/PostListRow/__tests__/index.unit.test.jsx
  56. +1 −1 packages/numenta.com/html.jsx
  57. +17 −54 packages/numenta.com/package.json
  58. +1 −1 packages/numenta.com/pages/_template.jsx
  59. +1 −0 packages/numenta.com/pages/htm-studio/index.jsx
  60. +0 −4 packages/numenta.org/.stylelintignore
  61. +0 −30 packages/numenta.org/__tests__/__mocks__/reactContextMock.js
  62. +1 −1 packages/numenta.org/__tests__/wrappers/html.unit.test.jsx
  63. +1 −1 packages/numenta.org/__tests__/wrappers/json.unit.test.jsx
  64. +1 −1 packages/numenta.org/__tests__/wrappers/md.unit.test.jsx
  65. +1 −1 packages/numenta.org/components/Header/__tests__/index.unit.test.jsx
  66. +1 −1 packages/numenta.org/components/Layout/__tests__/index.unit.test.jsx
  67. +1 −1 packages/numenta.org/components/PostListRow/__tests__/index.unit.test.jsx
  68. +1 −1 packages/numenta.org/html.jsx
  69. +17 −54 packages/numenta.org/package.json
  70. +1 −1 packages/numenta.org/pages/_template.jsx
  71. +1 −1 packages/utils/package.json
  72. +1 −1 packages/utils/shared.js
View
@@ -0,0 +1,4 @@
+{
+ "presets": ["react", "es2015", "stage-0"],
+ "plugins": ["add-module-exports", "transform-class-properties"]
+}
@@ -1,4 +1,4 @@
coverage/
node_modules/
public/
-static/tools/
+stats/
View
@@ -32,6 +32,9 @@
"jsx": "never"
}],
"import/no-extraneous-dependencies": [0],
+ "import/no-unresolved": [2, {
+ "ignore": ["^__tests__", "^config", "^gatsby-helpers"]
+ }],
"import/prefer-default-export": [0],
"jsx-a11y/html-has-lang": [0],
"max-len": [2, 80],
View
@@ -1,5 +1,7 @@
+coverage/
+node_modules/
+
.DS_Store
.gatsby-context.js
lerna-debug.log
-node_modules
npm-debug.log
File renamed without changes.
@@ -1,3 +1,4 @@
coverage/
node_modules/
public/
+stats/
@@ -1,7 +1,8 @@
import {parse} from 'toml'
import {readFileSync} from 'fs'
-const file = readFileSync(`${process.cwd()}/config.toml`)
+const cwd = process.cwd()
+const file = readFileSync(`${cwd}/packages/numenta.com/config.toml`)
const config = parse(file)
@@ -2,6 +2,13 @@ import config from './configMock'
const context = {
config,
+ manifest: {
+ repository: {
+ type: 'git',
+ url: 'https://github.com/numenta/numenta-web',
+ },
+ version: '0.0.1',
+ },
route: {
page: {
data: {},
View
@@ -1,6 +1,6 @@
{
"name": "numenta-web-site-base",
- "version": "0.0.0",
+ "version": "0.2.1",
"description": "Numenta Web Platform Site Base",
"license": "MIT",
"main": false,
@@ -15,11 +15,72 @@
"email": "info@numenta.com"
},
"dependencies": {
+ "babel-core": "6.20.0",
+ "babel-plugin-add-module-exports": "0.2.1",
+ "babel-plugin-transform-class-properties": "6.19.0",
+ "babel-preset-es2015": "6.18.0",
+ "babel-preset-react": "6.16.0",
+ "babel-preset-react-hmre": "1.1.1",
+ "babel-preset-stage-0": "6.16.0",
+ "browser-size": "0.1.0",
+ "classnames": "2.2.5",
+ "gatsby": "0.11.7",
+ "lunr": "0.7.2",
+ "moment": "2.17.1",
+ "react": "15.4.1",
+ "react-dom": "15.4.1",
+ "react-highlighter": "0.3.3",
+ "react-icons": "2.2.1",
+ "react-modal": "1.6.3",
+ "react-router": "2.8.1",
+ "react-youtube": "7.3.0",
+ "superagent": "3.2.1",
+ "toml": "2.3.0",
+ "xss-filters": "1.2.7"
},
"devDependencies": {
+ "babel-eslint": "7.1.1",
+ "babel-jest": "17.0.2",
+ "babel-polyfill": "6.20.0",
+ "broken-link-checker": "0.7.3",
+ "eslint": "3.12.1",
+ "eslint-config-airbnb": "13.0.0",
+ "eslint-plugin-import": "2.2.0",
+ "eslint-plugin-jasmine": "2.2.0",
+ "eslint-plugin-jsx-a11y": "2.2.3",
+ "eslint-plugin-react": "6.8.0",
+ "identity-obj-proxy": "3.0.0",
+ "jasmine-expect": "3.0.1",
+ "jest-cli": "17.0.3",
+ "lerna": "2.0.0-beta.30",
+ "open-url": "2.0.2",
+ "react-addons-test-utils": "15.4.1",
+ "react-stub-context": "0.7.0",
+ "react-test-renderer": "15.4.1",
+ "shx": "0.2.1",
+ "stylelint": "7.6.0",
+ "stylelint-config-standard": "15.0.0"
},
"repository": {
"type": "git",
"url": "https://github.com/numenta/numenta-web"
+ },
+ "scripts": {
+ "clean": "npm run clean:test && npm run clean:lerna && npm run clean:npm",
+ "clean:lerna": "lerna clean",
+ "clean:npm": "shx rm -rf node_modules/ && npm prune && npm cache clear && npm cache clean",
+ "clean:test": "shx rm -rf coverage/",
+ "postinstall": "lerna bootstrap",
+ "lint": "npm run lint:css && npm run lint:js",
+ "lint:css": "stylelint --config=.stylelintrc \"**/*.css\"",
+ "lint:js": "eslint --config=.eslintrc.json --ext=js --ext=jsx .",
+ "pretest": "npm run clean:test",
+ "test": "npm run test:unit",
+ "test:links": "blc --exclude \"amazon.com/On-Intel\" --exclude \"linkedin.com/company/numenta\" --get --ordered --recursive",
+ "test:links:local": "npm run test:links -- http://0.0.0.0:8000",
+ "test:unit": "jest --config .jestrc.json \"unit.test\"",
+ "test:unit:cover": "npm run test:unit -- --coverage && open-url file://$(shx pwd)/coverage/lcov-report/index.html",
+ "test:unit:update": "npm run test:unit -- -u",
+ "test:unit:watch": "npm run test:unit -- --watch"
}
}
File renamed without changes.
@@ -1,4 +1,5 @@
exports[`Disqus React component Renders correctly 1`] = `
<div
+ className="disqus"
id="disqus_thread" />
`;
@@ -2,7 +2,7 @@ import React from 'react'
import renderer from 'react-test-renderer'
import stubContext from 'react-stub-context'
-import context from '../../../__tests__/__mocks__/reactContextMock'
+import context from '__tests__/__mocks__/reactContextMock'
import Footer from '../../Footer'
@@ -1,154 +1,28 @@
exports[`Glance React component Renders correctly 1`] = `
<aside
className="glance">
- <div
- className="logo">
- <img
- alt="Numenta Logo"
- className="image"
- onClick={undefined}
- src="filename.ext"
- title="Numenta" />
+ <div>
+ <h2>
+ Glance Header
+ </h2>
</div>
<dl
className="defineList horizontal">
<dt
className="defineTitle horizontal">
- About
+ Title
</dt>
<dd
className="defineItem horizontal">
- Developing a neocortical theory for biological and machine intelligence.
+ Definition
</dd>
<dt
className="defineTitle horizontal">
- Established
+ Another
</dt>
<dd
className="defineItem horizontal">
- <span>
- Feb 4, 2005
- <span
- className="spacer">
- •
- </span>
- Redwood City, CA
- </span>
- </dd>
- <dt
- className="defineTitle horizontal">
- Employees
- </dt>
- <dd
- className="defineItem horizontal">
- 15 — 20
- </dd>
- <dt
- className="defineTitle horizontal">
- Business
- </dt>
- <dd
- className="defineItem horizontal">
- <a
- className="textlink"
- href="/assets/pdf/apps/licensing-guide.pdf"
- onClick={[Function]}
- target={undefined}>
- Licensing
- </a>
- </dd>
- <dt
- className="defineTitle horizontal">
- Content
- </dt>
- <dd
- className="defineItem horizontal">
- <span>
- <a
- className="textlink"
- href={undefined}
- onClick={[Function]}
- style={Object {}}
- target={undefined}>
- Blog
- </a>
- <span
- className="spacer">
- •
- </span>
- <a
- className="textlink"
- href={undefined}
- onClick={[Function]}
- style={Object {}}
- target={undefined}>
- Newsletter
- </a>
- </span>
- </dd>
- <dt
- className="defineTitle horizontal">
- Press
- </dt>
- <dd
- className="defineItem horizontal">
- <span>
- <a
- className="textlink"
- href={undefined}
- onClick={[Function]}
- style={Object {}}
- target={undefined}>
- Releases
- </a>
- <span
- className="spacer">
- •
- </span>
- <a
- className="textlink"
- href={undefined}
- onClick={[Function]}
- style={Object {}}
- target={undefined}>
- Links
- </a>
- </span>
- </dd>
- <dt
- className="defineTitle horizontal">
- Events
- </dt>
- <dd
- className="defineItem horizontal">
- <a
- className="textlink"
- href={undefined}
- onClick={[Function]}
- style={Object {}}
- target={undefined}>
- Events
- </a>
- </dd>
- <dt
- className="defineTitle horizontal">
- Latest
- </dt>
- <dd
- className="defineItem horizontal">
- <a
- className="textlink"
- href={undefined}
- onClick={[Function]}
- style={Object {}}
- target={undefined}>
- Why did we overhaul our web design? The story behind our new look.
-
- <span
- className="tag">
- New
- </span>
- </a>
+ Last
</dd>
</dl>
</aside>
@@ -2,8 +2,10 @@ import React from 'react'
import renderer from 'react-test-renderer'
import stubContext from 'react-stub-context'
-import context from '../../../__tests__/__mocks__/reactContextMock'
+import context from '__tests__/__mocks__/reactContextMock'
+import DefineItem from '../../DefineItem'
+import DefineTitle from '../../DefineTitle'
import Glance from '../../Glance'
@@ -12,7 +14,21 @@ describe('Glance React component', () => {
it('Renders correctly', () => {
const GlanceStubbed = stubContext(Glance, context)
const component = renderer.create(
- <GlanceStubbed />
+ <GlanceStubbed head={<h2>Glance Header</h2>}>
+ <DefineTitle>
+ Title
+ </DefineTitle>
+ <DefineItem>
+ Definition
+ </DefineItem>
+
+ <DefineTitle>
+ Another
+ </DefineTitle>
+ <DefineItem>
+ Last
+ </DefineItem>
+ </GlanceStubbed>
)
const tree = component.toJSON()
expect(tree).toMatchSnapshot()
@@ -3,38 +3,23 @@
// Copyright © 2005—2017 Numenta <http://numenta.com>
import React from 'react'
-import {trims} from 'numenta-web-shared-utils/shared'
-import DefineItem from '../DefineItem'
import DefineList from '../DefineList'
-import DefineTitle from '../DefineTitle'
-import Spacer from '../Spacer'
-import Tag from '../Tag'
-import TextLink from '../TextLink'
import styles from './index.css'
/**
* At-A-Glance React view component. Quick Details about the company/site.
*/
-const Glance = ({children, head}, context) => {
- const {config} = context
- const {links} = config
-
- return (
- <aside className={styles.glance}>
- <div>{head}</div>
- <DefineList direction="horizontal">
- {children}
- </DefineList>
- </aside>
- )
-}
-
-Glance.contextTypes = {
- config: React.PropTypes.object,
-}
+const Glance = ({children, head}) => (
+ <aside className={styles.glance}>
+ <div>{head}</div>
+ <DefineList direction="horizontal">
+ {children}
+ </DefineList>
+ </aside>
+)
Glance.propTypes = {
children: React.PropTypes.array.isRequired,
Oops, something went wrong.

0 comments on commit e979fa3

Please sign in to comment.