diff --git a/.circleci/config.yml b/.circleci/config.yml index 3bf986cca..13d339892 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,17 +2,23 @@ # # Check https://circleci.com/docs/2.0/language-javascript/ for more details # -version: 2 +version: 2.1 + +orbs: + node: circleci/node@3.0.0 + jobs: build: docker: - - image: circleci/node:16.10.0 - - image: circleci/mongo:4.4 + - image: cimg/node:16.11.0 + - image: mongo:4.4 - working_directory: ~/repo + working_directory: ~/homebrewery + executor: node/default steps: - - checkout + - checkout: + path: ~/homebrewery # Download and cache dependencies - restore_cache: @@ -21,12 +27,48 @@ jobs: # fallback to using the latest cache if no exact match is found - v1-dependencies- - - run: npm install + - node/install-npm + - node/install-packages: + app-dir: ~/homebrewery + cache-path: node_modules + override-ci-command: npm i - save_cache: paths: - node_modules key: v1-dependencies-{{ checksum "package.json" }} + - persist_to_workspace: + root: . + paths: + - . + + test: + docker: + - image: cimg/node:16.11.0 + + working_directory: ~/homebrewery + parallelism: 4 + + steps: + - attach_workspace: + at: . + # run tests! - - run: npm run circleci + - run: + name: Test - Basic + command: npm run test:basic + - run: + name: Test - Mustache Spans + command: npm run test:mustache-span + - run: + name: Test - Routes + command: npm run test:route + +workflows: + build_and_test: + jobs: + - build + - test: + requires: + - build \ No newline at end of file diff --git a/client/homebrew/homebrew.jsx b/client/homebrew/homebrew.jsx index 54dcf2206..094b96744 100644 --- a/client/homebrew/homebrew.jsx +++ b/client/homebrew/homebrew.jsx @@ -32,11 +32,14 @@ const Homebrew = createClass({ } }; }, - componentWillMount : function() { - global.account = this.props.account; + + getInitialState : function(){ global.version = this.props.version; + global.account = this.props.account; global.enable_v3 = this.props.enable_v3; + return {}; }, + render : function (){ return ( diff --git a/client/homebrew/navbar/navbar.jsx b/client/homebrew/navbar/navbar.jsx index b3255db45..7929bb5e2 100644 --- a/client/homebrew/navbar/navbar.jsx +++ b/client/homebrew/navbar/navbar.jsx @@ -14,12 +14,10 @@ const Navbar = createClass({ }; }, - componentDidMount : function() { - //const isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor); - this.setState({ - //showNonChromeWarning : !isChrome, - ver : window.version - }); + getInitialState : function() { + return { + ver : global.version + }; }, /* diff --git a/package.json b/package.json index 88ab6b494..2f95cea2a 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,9 @@ "verify": "npm run lint && npm test", "test": "jest", "test:dev": "jest --verbose --watch", + "test:basic": "jest tests/markdown/basic.test.js --verbose", + "test:mustache-span": "jest tests/markdown/mustache-span.test.js --verbose", + "test:route": "jest tests/routes/static-pages.test.js --verbose", "phb": "node scripts/phb.js", "prod": "set NODE_ENV=production && npm run build", "postinstall": "npm run buildall", @@ -31,6 +34,7 @@ "build/*" ], "jest": { + "testTimeout" : 15000, "modulePaths": [ "mode_modules", "shared",