GithubHelp home page GithubHelp logo

kentcdodds / testing-workshop Goto Github PK

View Code? Open in Web Editor NEW
1.4K 43.0 704.0 3.86 MB

A workshop for learning how to test JavaScript applications

Home Page: http://git.io/testing-workshop

JavaScript 94.84% HTML 0.52% Shell 0.23% CSS 4.41%
workshop javascript testing unit-testing integration-testing end-to-end-testing e2e-tests kcd-edu

testing-workshop's Introduction

Testing Workshop

๐Ÿ‘‹ hi there! My name is Kent C. Dodds! This is a workshop repo to teach you about testing JavaScript applications.

NOTICE: If you're coming here from my Frontend Masters 2017 workshop, I recommend you watch the updated 2018 workshop instead. If you'd rather follow the 2017 workshop, then please go to the fem branch to make sure you're looking at the accurate information for your workshop.

chat-badge Build Status AppVeyor Build Status Code Coverage License All Contributors

PRs Welcome Code of Conduct Watch on GitHub Star on GitHub Tweet

Table of Contents

Topics covered

  1. Unit Testing with Jest
  2. Integration Testing with Jest
  3. End to End (E2E) Testing with Cypress

We'll mention other forms of testing, but these are the types we'll focus on and learn in this workshop. Learn more about the course goals and specific topics covered in the INSTRUCTIONS.md file.

NOTE: This repository is meant for instructional purposes. While you'll probably learn a great deal looking through this project, remember that it's not necessarily a recommendation to test your apps this way. Some code is "over covered" by unit, integration, and end-to-end tests simply to demonstrate the differences. In a real application it would be unnecessary to be this extensive in coverage.

Branches

This project has been used to teach about testing in various settings. You may want to switch to the appropriate branch for this workshop. Otherwise the code you're looking at may not be exactly the same as the code used in the setting you're working with.

  • Frontend Masters 2017 fem

System Requirements

  • git v2.14.1 or greater
  • NodeJS v8.9.4 or greater
  • npm v5.6.0 or greater

All of these must be available in your PATH. To verify things are set up properly, you can run this:

git --version
node --version
npm --version

If you have trouble with any of these, learn more about the PATH environment variable and how to fix it here for windows or mac/linux.

Setup

After you've made sure to have the correct things (and versions) installed, you should be able to just run a few commands to get set up:

git clone https://github.com/kentcdodds/testing-workshop.git
cd testing-workshop
npm run setup --silent

This may take a few minutes. It will ask you for your email. This is optional and just automatically adds your email to the links in the project to make filling out some forms easier If you get any errors, please read through them and see if you can find out what the problem is. You may also want to look at Troubleshooting. If you can't work it out on your own then please file an issue and provide all the output from the commands you ran (even if it's a lot).

Running the app

To get the app up and running (and really see if it worked), run:

npm run dev

This will start the api server, and the client server in development mode at the same time. Your browser should open up automatically to http://localhost:3000 (if it doesn't, just open that yourself) and you should be able to start messing around with the app.

Here's what you should be looking at:

App Screenshot

If this fails at any point for you, please take a minute to read through any error messages you see and try to troubleshoot the issue. If you can't work it out, feel free to open an issue.

About the app

This app is based on the Hashrocket project called Today I Learned. It's a real working application but has been simplified to help us focus on learning testing rather than worrying about distracting ourselves with setting up the project. For example the database is actually just a simple JavaScript file. Every time you start the app, all the data is reset (and in development mode, data is randomly generated).

Continuous Integration

We're using two CI services:

  • Travis (Linux): find config in .travis.yml
  • AppVeyor (Windows): find config in appveyor.yml

Hosting

The backend code is deployed to now.sh: til.now.sh. Try hitting one of the unauthenticated endpoints like /api/posts (note: it's using the open source free tier, so it may take a while to respond as it warms up). The Travis build is responsible for deploying the backend to now.sh.

The frontend code is deployed using netlify: til.netlify.com. We could host the frontend code on now as well, except Netlify has some pretty awesome features with GitHub integration, and I want to show those off (and benefit from them as well). The frontend code is deployed to netlify using Netlify's integration with GitHub.

Register and Login

If you want to login, go ahead and register a new account and login with that one.

To stop all the servers, hit Ctrl + C.

Troubleshooting

"npm run setup" command not working

Here's what the setup script does. If it fails, try doing each of these things individually yourself:

# verify your environment will work with the project
node ./scripts/verify

# install dependencies in the root of the repo
npm install

# install dependencies in the shared directory
npm install --prefix shared

# install dependencies in the server directory
npm install --prefix server

# install dependencies in the client directory
npm install --prefix client

# verify the project is ready to run
npm run lint
npm run test:coverage
npm run test:e2e:run

If any of those scripts fail, please try to work out what went wrong by the error message you get. If you still can't work it out, feel free to open an issue with all the output from that script. I will try to help if I can.

"npm run dev" command not working

If it doesn't work for you, you can start each of these individually yourself (in separate terminals):

cd server
npm run dev
cd client
npm run dev

If any of those scripts fail, please try to work out what went wrong by the error message you get. If you still can't work it out, feel free to open an issue with all the output from that script. I will try to help if I can.

"npm test" command not working; "./jest" command not working

When attempting to run Jest in watch mode, you may encounter an error that says something like:

`fsevents` unavailable (this watcher can only be used on Darwin)'

Jest watch mode has a dependency on a tool called watchman, which needs to be installed globally on your machine.

To fix this error, please make sure you have watchman installed for your preferred operating system.

NOTE: installing watchman via npm installs an outdated version of the package. To get the latest version of watchman, it is preferred that you install through your operating system's package manager instead.

Structure

This project has a bit of a unique setup. Normally you'll have just a single package.json at the root of your repository, but to simplify setup I've included both the server and client projects in a single repository. The root of the project has a package.json as does server, and client. While you'll be working in the source code and tests in these folders, you should be able to leave you command line in the root directory for the whole workshop.

Contributors

Thanks goes to these wonderful people (emoji key):


Kent C. Dodds

๐Ÿ’ป ๐Ÿ“– ๐Ÿš‡ โš ๏ธ

Osama Jandali

๐Ÿ’ป ๐ŸŽจ

Stefan Ivic

๐Ÿ›

Nick Klepinger

๐Ÿ›

Abinav Seelan

๐Ÿ›

Philip Sotirov

๐Ÿ›

Austin Wood

๐Ÿ“–

WK

๐Ÿ›

Richard Perkins

โš ๏ธ

This project follows the all-contributors specification. Contributions of any kind welcome!

LICENSE

This material is available for private, non-commercial use under the GPL version 3. If you would like to use this material to conduct your own workshop, please contact me at [email protected]

testing-workshop's People

Contributors

allcontributors[bot] avatar asbrettisay avatar edm00se avatar euzebe avatar framini avatar hozefaj avatar huchenme avatar kentcdodds avatar leeroyjenks avatar meatpawcreations avatar ooade avatar osamajandali avatar paulfalgout avatar rjperkins avatar romarioraffington avatar rphuber avatar sasharevzin avatar saylerb avatar stmoreau avatar timdoubleu avatar vinspee avatar weiklr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

testing-workshop's Issues

Login.step-4.todo missing in repo

Environment info:

  • node version (node --version): 8.11.4
  • npm version (npm --version): 6.4.1
  • yarn version (yarn --version): 1.9.4

Problem description:
I'm on master and the file Login.step-4.todo is missing, see screen grab. Also, many of the files seem to have changed since the video was recorded.

I tried to complete the task in this video: https://frontendmasters.com/courses/testing-react/snapshot-testing-exercise/

Suggested solution:

Perhaps something was removed from repo by mistake?
screen shot 2018-09-23 at 10 06 27

Tests not running, because babel could find "es2015" preset

Environment info:

  • node version (node --version): 8.11.3
  • npm version (npm --version): 6.4.1
  • yarn version (yarn --version): 1.9.4

Problem description:
When I try to run tests in the client directory, I get the following error:

โ— Test suite failed to run

Couldn't find preset "es2015" relative to directory "/Users/pavelshermayster"

  at ../node_modules/babel-core/lib/transformation/file/options/option-manager.js:293:19
      at Array.map (<anonymous>)
  at OptionManager.resolvePresets (../node_modules/babel-core/lib/transformation/file/options/option-manager.js:275:20)
  at OptionManager.mergePresets (../node_modules/babel-core/lib/transformation/file/options/option-manager.js:264:10)
  at OptionManager.mergeOptions (../node_modules/babel-core/lib/transformation/file/options/option-manager.js:249:14)
  at OptionManager.init (../node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
  at File.initOptions (../node_modules/babel-core/lib/transformation/file/index.js:212:65)
  at new File (../node_modules/babel-core/lib/transformation/file/index.js:135:24)
  at Pipeline.transform (../node_modules/babel-core/lib/transformation/pipeline.js:46:16)

scripts/load-database.js fails to load database on Windows.

Windows doesn't interpretate ./ and errors: '.' is not recognized as an internal or external command, operable program or batch file.

const babelNode = './node_modules/.bin/babel-node'
const generateCommand = `cd api && ${babelNode} scripts/generate`

Possible fix:
Filter line 45 with path.normalize function. Code below is break down into 2 lines to prevent eslint maximum line length of 80 error.

      const generateCommand = path.normalize(
        `cd api && ${babelNode} scripts/generate`)

Regards and yes I'm Windows user :trollface:

Launch app without any articles and tags

Environment info:

  • mongo version (mongod --version): v3.0.3
  • node version (node --version): v7.6.0
  • npm version (npm --version): 4.1.2
  • yarn version (yarn --version): 0.22.0

Problem description:

  1. run npm start dev without any error
  2. launch http://localhost:8080/#/ successfully, but the content of the website is as below:

Image of Screen
https://github.com/fengcj/weewikipaint/blob/master/screen.png

  1. check the response of /api/articles?limit=10&offset=0 as below:
    {"articles":[],"articlesCount":0}

I guess this might be the DB issue.

@kentcdodds , please give me some suggestion.

Error: Cannot find module './other/db-db-test-utils'

Environment info:
Max OS

  • node version (node --version): 8.4.0
  • npm version (npm --version): 5.6.0
  • yarn version (yarn --version): 1.3.2

Problem description:

On both npm run dev from project folder or npm run dev from server folder I get the following error message. (Also get if I run the command as sudo):

oes-iMac:testing-workshop joe$ npm run dev

[email protected] dev /Users/joe/Dropbox/Programming/testing-workshop
as-a DEV concurrently --names "server,client" --prefix "[{name}]" --prefix-colors "bgCyan.reset.bold,bgGreen.reset.bold" "npm run dev:server --silent" "npm run dev:client --silent"

[server] module.js:491
[server] throw err;
[server] ^
[server]
[server] Error: Cannot find module './other/db-db-test-utils'
[server] at Function.Module._resolveFilename (module.js:489:15)
[server] at Function.Module._load (module.js:439:25)
[server] at Module.require (module.js:517:17)
[server] at require (internal/module.js:11:18)
[server] at Object. (/Users/joe/Dropbox/Programming/testing-workshop/server/dev.js:2:1)
[server] at Module._compile (module.js:573:30)
[server] at Object.Module._extensions..js (module.js:584:10)
[server] at Module.load (module.js:507:32)
[server] at tryModuleLoad (module.js:470:12)
[server] at Function.Module._load (module.js:462:3)

Searched for the db-db-test-utils on mac and did not find anything.

Deleted node_modules under server and did a npm install and the same error occurred on npm run dev.

Thanks,
Joe.

wrong app

I was trying to follow your older frontend masters course because I don't use React. The app is Today I Learned rather than the one shown in the video which is Conduit.

npm run dev fails in /calculator

Environment info:

  • node version (node --version): v8.11.3
  • npm version (npm --version): v6.1.0
  • yarn version (yarn --version): none

Problem description:
I'm using the 'master' branch.
While following along with the videos I ran into a build issue during video 5 'Configuring Jest & Babel'.
When running 'npm run dev' in the '/calculator' directory I get:

ERROR in ./src/index.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
ReferenceError: Unknown plugin "syntax-dynamic-import" specified in "/Users/jmuhle/github/testing-workshop/other/configuration/calculator/.babelrc.js" at 0, attempted to resolve relative to "/Users/jmuhle/github/testing-workshop/other/configuration/calculator" (While processing preset: "/Users/jmuhle/github/testing-workshop/other/configuration/calculator/.babelrc.js")
    at /Users/jmuhle/github/testing-workshop/other/configuration/calculator/node_modules/babel-core/lib/transformation/file/options/option-manager.js:180:17
    at Array.map (<anonymous>)
    at Function.normalisePlugins (/Users/jmuhle/github/testing-workshop/other/configuration/calculator/node_modules/babel-core/lib/transformation/file/options/option-manager.js:158:20)
    at OptionManager.mergeOptions (/Users/jmuhle/github/testing-workshop/other/configuration/calculator/node_modules/babel-core/lib/transformation/file/options/option-manager.js:234:36)
    at /Users/jmuhle/github/testing-workshop/other/configuration/calculator/node_modules/babel-core/lib/transformation/file/options/option-manager.js:265:14
    at /Users/jmuhle/github/testing-workshop/other/configuration/calculator/node_modules/babel-core/lib/transformation/file/options/option-manager.js:323:22
    at Array.map (<anonymous>)
    at OptionManager.resolvePresets (/Users/jmuhle/github/testing-workshop/other/configuration/calculator/node_modules/babel-core/lib/transformation/file/options/option-manager.js:275:20)
    at OptionManager.mergePresets (/Users/jmuhle/github/testing-workshop/other/configuration/calculator/node_modules/babel-core/lib/transformation/file/options/option-manager.js:264:10)
    at OptionManager.mergeOptions (/Users/jmuhle/github/testing-workshop/other/configuration/calculator/node_modules/babel-core/lib/transformation/file/options/option-manager.js:249:14)
 @ multi (webpack)-dev-server/client?http://localhost:8080 ./src/index.js main[1]

If I remove "syntax-dynamic-import" from .babelrc I run into syntax errors in the code. I tried to install that babel plugin with npm and that led to more build errors. My './calculator/package.json' is the same as what I see in the video and the 'npm run setup --silent' script was successful during setup.

Cypress.addParentCommand no longer works in Cypress 0.20.0 or above

Environment info:
Cypress version: 0.20.3

Problem description:
package.json referenced an older version of Cypress but the version number included the "^" which meant that a later version was installed which contained a difference API for adding a command. I ran into an error when running the tests in Cypress.

Suggested solution:
In the following file '/testing-workshop/cypress/support/index.js' I fixed this by changing this line:

Cypress.addParentCommand({visitApp})

To this line:

Cypress.Commands.add('visitApp', visitApp)

Not sure if I should submit this as a pull request as it may or may not affect other people depending on what version they have installed. If this command was changed in the actual project whilst someone was using a pre-version-0.20 of Cypress they could run into issues.

Windows: Symlink requires elevated prompt

Environment info:

  • Operating system : Windows 10 Pro, Version 1709, OS Build : 16299.192.
  • Windows insiders : No. Running on stable builds.
  • node version (node --version): v8.9.4
  • npm version (npm --version): v5.6.0
  • yarn version (yarn --version): v1.3.2

Problem description:

Reference: #49

Running the setup script will fail because symlink requires elevated permission on Windows.

C:\Users\night\Development\testing-workshop>npm run setup --silent
๐ŸŽ‰  Congrats! Your system is setup properly
You should be good to install and run things.
fs.js:1014
  return binding.symlink(preprocessSymlinkDestination(target, type, path),
                 ^

Error: EPERM: operation not permitted, symlink 'C:\Users\night\Development\testing-workshop\shared' -> 'C:\Users\night\Development\testing-workshop\client\other\shared'
    at Object.fs.symlinkSync (fs.js:1014:18)
    at symlinkDir (C:\Users\night\Development\testing-workshop\scripts\ensure-symlinks.js:20:8)
    at Object.<anonymous> (C:\Users\night\Development\testing-workshop\scripts\ensure-symlinks.js:9:1)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)

Suggested solution:

This is just a heads up as this could be solved by running the prompt as an Administrator.
Maybe we can add this to the Troubleshoot/Readme, or check if the user is running in elevated mode before starting the script.

Error trying to setup project in fem branch

Environment info:

  • node version (node --version): v9.11.1
  • npm version (npm --version): 6.0.0
  • yarn version (yarn --version): 1.6.0

Problem description:

I'm doing the workshop over at Frontend Masters. Following a long I'm trying to setup the project but it does not work. See output below.

git clone -b fem [email protected]:kentcdodds/testing-workshop.git
cd cd testing-workshop
npm run setup --silent

Outputs:

๐ŸŽ‰  Congrats! Your system is setup properly
You should be good to install and run things.
๐Ÿ“ฆ  Installing dependencies via yarn --force --ignore-platform --ignore-engines
๐Ÿ”‘  starting install in /Users/kevinsjoberg/code/testing-workshop
yarn install v1.6.0
[1/4] ๐Ÿ”  Resolving packages...
[2/4] ๐Ÿšš  Fetching packages...
[3/4] ๐Ÿ”—  Linking dependencies...
warning "eslint-config-kentcdodds > [email protected]" has unmet peer dependency "babel-core@^6.0.0".
[4/4] ๐Ÿ“ƒ  Rebuilding all packages...
success Saved lockfile.
โœจ  Done in 10.04s.
๐ŸŽ‰  finished installing dependencies in "/Users/kevinsjoberg/code/testing-workshop"
๐Ÿ”‘  starting install in /Users/kevinsjoberg/code/testing-workshop/api
yarn install v1.6.0
[1/4] ๐Ÿ”  Resolving packages...
[2/4] ๐Ÿšš  Fetching packages...
[3/4] ๐Ÿ”—  Linking dependencies...
[4/4] ๐Ÿ“ƒ  Rebuilding all packages...
success Saved lockfile.
โœจ  Done in 8.91s.
๐ŸŽ‰  finished installing dependencies in "/Users/kevinsjoberg/code/testing-workshop/api"
๐Ÿ”‘  starting install in /Users/kevinsjoberg/code/testing-workshop/client
yarn install v1.6.0
[1/4] ๐Ÿ”  Resolving packages...
[2/4] ๐Ÿšš  Fetching packages...
[3/4] ๐Ÿ”—  Linking dependencies...
warning "glamorous > [email protected]" has unmet peer dependency "html-element-attributes@^1.0.0".
warning " > [email protected]" has unmet peer dependency "eslint@^3.3.0".
warning "eslint-config-fb-strict > [email protected]" has unmet peer dependency "eslint@^3.11.1".
warning "eslint-config-fb-strict > [email protected]" has unmet peer dependency "eslint-plugin-flowtype@^2.28.0".
warning "eslint-config-fb-strict > [email protected]" has unmet peer dependency "eslint-plugin-jasmine@^2.1.0".
warning "eslint-config-fb-strict > [email protected]" has unmet peer dependency "eslint-plugin-prefer-object-spread@^1.1.0".
warning "eslint-config-fb-strict > [email protected]" has unmet peer dependency "eslint-plugin-react@^6.7.1".
warning "eslint-config-fb-strict > [email protected]" has unmet peer dependency "eslint@>=3.0.0".
warning " > [email protected]" has unmet peer dependency "eslint@>=3.6".
[4/4] ๐Ÿ“ƒ  Rebuilding all packages...
success Saved lockfile.
$ nps postinstall
nps executing: echo "removing client copy of eslint (will use root repo's version)" && node node_modules/rimraf/bin.js node_modules/eslint
removing client copy of eslint (will use root repo's version)
โœจ  Done in 12.44s.
๐ŸŽ‰  finished installing dependencies in "/Users/kevinsjoberg/code/testing-workshop/client"
๐Ÿ‘  all dependencies installed
stopping mongod with `mongo admin --eval "db.shutdownServer()" --port 27017 &>/dev/null` (in case it is running)
starting mongod with `mongod --dbpath /Users/kevinsjoberg/code/testing-workshop/.mongo-db --port 27017 &>/dev/null`
generating and inserting data with `cd api && ./node_modules/.bin/babel-node scripts/generate`
/bin/sh: line 0: cd: api: No such file or directory
stopping mongod process with `mongo admin --eval "db.shutdownServer()" --port 27017 &>/dev/null`
nps executing: nps lint && node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold,bgGreen.bold" --prefix "[{name}]" --names "split.api.verify,split.client.verify,split.e2e.verify" 'nps split.api.verify' 'nps split.client.verify' 'nps split.e2e.verify'
nps executing: eslint . --cache
[split.api.verify] nps executing: node node_modules/rimraf/bin.js api-final && split-guide generate --no-clean --templates-dir other/templates/api --exercises-dir node_modules/.tmp/api --exercises-final-dir api && node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold" --prefix "[{name}]" --names "api.test,api.demo" 'nps api.test' 'nps api.demo' && nps split.api
[split.client.verify] nps executing: node node_modules/rimraf/bin.js client-final && split-guide generate --no-clean --templates-dir other/templates/client --exercises-dir node_modules/.tmp/client --exercises-final-dir client && node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold" --prefix "[{name}]" --names "client.test,client.demo" 'nps client.test' 'nps client.demo' && nps split.client
[split.e2e.verify] nps executing: node node_modules/rimraf/bin.js cypress-final && split-guide generate --no-clean --templates-dir other/templates/cypress --exercises-dir node_modules/.tmp/cypress --exercises-final-dir cypress && nps e2e && nps split.e2e
[split.e2e.verify] Saved 4 files:
[split.e2e.verify] /Users/kevinsjoberg/code/testing-workshop/node_modules/.tmp/cypress/.eslintrc
[split.e2e.verify] /Users/kevinsjoberg/code/testing-workshop/cypress/.eslintrc
[split.e2e.verify] /Users/kevinsjoberg/code/testing-workshop/node_modules/.tmp/cypress/e2e/users_spec.js
[split.e2e.verify] /Users/kevinsjoberg/code/testing-workshop/cypress/e2e/users_spec.js
[split.client.verify] Saved 17 files:
[split.client.verify] /Users/kevinsjoberg/code/testing-workshop/node_modules/.tmp/client/.eslintrc
[split.client.verify] /Users/kevinsjoberg/code/testing-workshop/client/.eslintrc
[split.client.verify] /Users/kevinsjoberg/code/testing-workshop/node_modules/.tmp/client/demo/unit/__tests__/customer-list.js
[split.client.verify] /Users/kevinsjoberg/code/testing-workshop/client/demo/unit/__tests__/customer-list.js
[split.client.verify] /Users/kevinsjoberg/code/testing-workshop/node_modules/.tmp/client/demo/unit/__tests__/toggle.js
[split.client.verify] /Users/kevinsjoberg/code/testing-workshop/client/demo/unit/__tests__/toggle.js
[split.client.verify] /Users/kevinsjoberg/code/testing-workshop/node_modules/.tmp/client/src/reducers/__tests__/article.js
[split.client.verify] /Users/kevinsjoberg/code/testing-workshop/client/src/reducers/__tests__/article.js
[split.client.verify] /Users/kevinsjoberg/code/testing-workshop/node_modules/.tmp/client/src/screens/__tests__/__snapshots__/editor.js.snap
[split.client.verify] /Users/kevinsjoberg/code/testing-workshop/client/src/screens/__tests__/__snapshots__/editor.js.snap
[split.client.verify] /Users/kevinsjoberg/code/testing-workshop/node_modules/.tmp/client/src/screens/__tests__/editor.js
[split.client.verify] /Users/kevinsjoberg/code/testing-workshop/client/src/screens/__tests__/editor.js
[split.client.verify] /Users/kevinsjoberg/code/testing-workshop/client/tests/integration/__mocks__/axios.js
[split.client.verify] /Users/kevinsjoberg/code/testing-workshop/node_modules/.tmp/client/tests/integration/login.test.js
[split.client.verify] /Users/kevinsjoberg/code/testing-workshop/client/tests/integration/login.test.js
[split.client.verify] /Users/kevinsjoberg/code/testing-workshop/node_modules/.tmp/client/tests/integration/register.test.js
[split.client.verify] /Users/kevinsjoberg/code/testing-workshop/client/tests/integration/register.test.js
[split.api.verify] Saved 28 files:
[split.api.verify] /Users/kevinsjoberg/code/testing-workshop/node_modules/.tmp/api/.eslintrc
[split.api.verify] /Users/kevinsjoberg/code/testing-workshop/api/.eslintrc
[split.api.verify] /Users/kevinsjoberg/code/testing-workshop/node_modules/.tmp/api/demo/integration/__tests__/users.js
[split.api.verify] /Users/kevinsjoberg/code/testing-workshop/api/demo/integration/__tests__/users.js
[split.api.verify] /Users/kevinsjoberg/code/testing-workshop/node_modules/.tmp/api/demo/unit/__tests__/get-age.js
[split.api.verify] /Users/kevinsjoberg/code/testing-workshop/api/demo/unit/__tests__/get-age.js
[split.api.verify] /Users/kevinsjoberg/code/testing-workshop/node_modules/.tmp/api/demo/unit/__tests__/make-me-a-sandwich.js
[split.api.verify] /Users/kevinsjoberg/code/testing-workshop/api/demo/unit/__tests__/make-me-a-sandwich.js
[split.api.verify] /Users/kevinsjoberg/code/testing-workshop/node_modules/.tmp/api/demo/unit/__tests__/sum.js
[split.api.verify] /Users/kevinsjoberg/code/testing-workshop/api/demo/unit/__tests__/sum.js
[split.api.verify] /Users/kevinsjoberg/code/testing-workshop/node_modules/.tmp/api/demo/unit/get-age.js
[split.api.verify] /Users/kevinsjoberg/code/testing-workshop/api/demo/unit/get-age.js
[split.api.verify] /Users/kevinsjoberg/code/testing-workshop/node_modules/.tmp/api/demo/unit/sum.js
[split.api.verify] /Users/kevinsjoberg/code/testing-workshop/api/demo/unit/sum.js
[split.api.verify] /Users/kevinsjoberg/code/testing-workshop/node_modules/.tmp/api/src/models/__tests__/user.js
[split.api.verify] /Users/kevinsjoberg/code/testing-workshop/api/src/models/__tests__/user.js
[split.api.verify] /Users/kevinsjoberg/code/testing-workshop/node_modules/.tmp/api/src/models/user.js
[split.api.verify] /Users/kevinsjoberg/code/testing-workshop/api/src/models/user.js
[split.api.verify] /Users/kevinsjoberg/code/testing-workshop/node_modules/.tmp/api/src/routes/utils/__tests__/arrayify.js
[split.api.verify] /Users/kevinsjoberg/code/testing-workshop/api/src/routes/utils/__tests__/arrayify.js
[split.api.verify] /Users/kevinsjoberg/code/testing-workshop/node_modules/.tmp/api/src/routes/utils/__tests__/get-token-from-header.js
[split.api.verify] /Users/kevinsjoberg/code/testing-workshop/api/src/routes/utils/__tests__/get-token-from-header.js
[split.api.verify] /Users/kevinsjoberg/code/testing-workshop/node_modules/.tmp/api/src/routes/utils/arrayify.js
[split.api.verify] /Users/kevinsjoberg/code/testing-workshop/api/src/routes/utils/arrayify.js
[split.api.verify] /Users/kevinsjoberg/code/testing-workshop/node_modules/.tmp/api/src/routes/utils/get-token-from-header.js
[split.api.verify] /Users/kevinsjoberg/code/testing-workshop/api/src/routes/utils/get-token-from-header.js
[split.api.verify] /Users/kevinsjoberg/code/testing-workshop/node_modules/.tmp/api/tests/integration/articles.test.js
[split.api.verify] /Users/kevinsjoberg/code/testing-workshop/api/tests/integration/articles.test.js
[split.e2e.verify] nps executing: node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold" --prefix "[{name}]" --names "e2e.loadDatabase,build" 'nps e2e.loadDatabase' 'nps build' && concurrently --kill-others --success first --prefix-colors "bgGreen.bold,bgBlue.bold,bgMagenta.bold,bgCyan.bold" --prefix "[{name}]" --names "client,cypress,mongo,api" "nps e2e.run.client" "nps e2e.run.cypress" "nps e2e.run.mongo" "nps e2e.run.api"
[split.client.verify] [client.test] nps executing: node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold" --prefix "[{name}]" --names "client.test.unit,client.test.integration" 'nps client.test.unit' 'nps client.test.integration'
[split.client.verify] [client.demo] nps executing: node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold" --prefix "[{name}]" --names "client.demo.unit.single,client.demo.integration.single" 'nps client.demo.unit.single' 'nps client.demo.integration.single'
[split.api.verify] [api.test] nps executing: node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold" --prefix "[{name}]" --names "api.test.unit,api.test.integration" 'nps api.test.unit' 'nps api.test.integration'
[split.api.verify] [api.demo] nps executing: node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold" --prefix "[{name}]" --names "api.demo.unit.single,api.demo.integration.single" 'nps api.demo.unit.single' 'nps api.demo.integration.single'
[split.e2e.verify] [build] nps executing: node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold" --prefix "[{name}]" --names "build.api,build.client" 'nps build.api' 'nps build.client'
[split.e2e.verify] [e2e.loadDatabase] nps executing: node node_modules/cross-env/dist/bin/cross-env.js MONGO_PORT=27018 MONGO_PATH=./.e2e/mongo-db MONGODB_URI="mongodb://localhost:27018/conduit" node ./scripts/load-database.js
[split.client.verify] [client.test] [client.test.unit] nps executing: cd client && npm start test.unit --silent && cd ..
[split.api.verify] [api.test] [api.test.unit] nps executing: cd api && npm start test.unit --silent && cd ..
[split.client.verify] [client.test] [client.test.unit] /bin/sh: line 0: cd: client: No such file or directory
[split.client.verify] [client.test] [client.test.unit] The script called "client.test.unit" which runs "cd client && npm start test.unit --silent && cd .." failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
[split.client.verify] [client.test] [client.test.integration] nps executing: cd client && npm start test.integration --silent && cd ..
[split.client.verify] [client.test] [client.test.unit] nps client.test.unit exited with code 1
[split.client.verify] [client.test] --> Sending SIGTERM to other processes..
[split.api.verify] [api.test] [api.test.integration] nps executing: echo nps mongo.stop && nps mongo.stop &>/dev/null || true && concurrently --kill-others --success first --prefix "[{name}]" --names dev.mongo.silent,dev.api,api.test.integration "nps dev.mongo.silent" " sleep 2 && cd api && npm start test.integration --silent && cd .. "
[split.client.verify] [client.test] [client.test.integration] /bin/sh: line 0: cd: client: No such file or directory
[split.api.verify] [api.test] [api.test.unit] /bin/sh: line 0: cd: api: No such file or directory
[split.api.verify] [api.test] [api.test.unit] The script called "api.test.unit" which runs "cd api && npm start test.unit --silent && cd .." failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
[split.client.verify] [client.test] [client.test.integration] The script called "client.test.integration" which runs "cd client && npm start test.integration --silent && cd .." failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
[split.client.verify] [client.test] [client.test.integration] nps client.test.integration exited with code null
[split.client.verify] [client.demo] [client.demo.unit.single] nps executing: cd client && npm start demo.unit --silent && cd ..
[split.client.verify] [client.test] The script called "client.test" which runs "node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold" --prefix "[{name}]" --names "client.test.unit,client.test.integration" 'nps client.test.unit' 'nps client.test.integration'" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
[split.client.verify] [client.test] nps client.test exited with code 1
[split.client.verify] --> Sending SIGTERM to other processes..
[split.client.verify] [client.demo] [client.demo.unit.single] /bin/sh: line 0: cd: client: No such file or directory
[split.client.verify] [client.demo] [client.demo.unit.single] The script called "client.demo.unit.single" which runs "cd client && npm start demo.unit --silent && cd .." failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
[split.client.verify] [client.demo] [client.demo.unit.single] nps client.demo.unit.single exited with code 1
[split.client.verify] [client.demo] --> Sending SIGTERM to other processes..
[split.api.verify] [api.test] [api.test.integration] nps mongo.stop
[split.api.verify] [api.demo] [api.demo.unit.single] nps executing: cd api && npm start demo.unit --silent && cd ..
[split.api.verify] [api.demo] [api.demo.unit.single] /bin/sh: line 0: cd: api: No such file or directory
[split.api.verify] [api.test] [api.test.unit] nps api.test.unit exited with code 1
[split.api.verify] [api.test] --> Sending SIGTERM to other processes..
[split.api.verify] [api.demo] [api.demo.unit.single] The script called "api.demo.unit.single" which runs "cd api && npm start demo.unit --silent && cd .." failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
[split.api.verify] [api.demo] [api.demo.unit.single] nps api.demo.unit.single exited with code 1
[split.api.verify] [api.demo] --> Sending SIGTERM to other processes..
[split.api.verify] [api.demo] [api.demo.integration.single] nps api.demo.integration.single exited with code null
[split.api.verify] [api.demo] The script called "api.demo" which runs "node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold" --prefix "[{name}]" --names "api.demo.unit.single,api.demo.integration.single" 'nps api.demo.unit.single' 'nps api.demo.integration.single'" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
[split.api.verify] [api.demo] nps api.demo exited with code 1
[split.api.verify] --> Sending SIGTERM to other processes..
[split.e2e.verify] [e2e.loadDatabase] stopping mongod with `mongo admin --eval "db.shutdownServer()" --port 27018 &>/dev/null` (in case it is running)
[split.api.verify] [api.test] [api.test.integration] nps api.test.integration exited with code null
[split.api.verify] [api.test] The script called "api.test" which runs "node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold" --prefix "[{name}]" --names "api.test.unit,api.test.integration" 'nps api.test.unit' 'nps api.test.integration'" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
[split.client.verify] [client.demo] [client.demo.integration.single] nps client.demo.integration.single exited with code null
[split.api.verify] [api.test] nps api.test exited with code 1
[split.client.verify] [client.demo] nps client.demo exited with code null
[split.api.verify] The script called "split.api.verify" which runs "node node_modules/rimraf/bin.js api-final && split-guide generate --no-clean --templates-dir other/templates/api --exercises-dir node_modules/.tmp/api --exercises-final-dir api && node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold" --prefix "[{name}]" --names "api.test,api.demo" 'nps api.test' 'nps api.demo' && nps split.api" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
[split.client.verify] The script called "split.client.verify" which runs "node node_modules/rimraf/bin.js client-final && split-guide generate --no-clean --templates-dir other/templates/client --exercises-dir node_modules/.tmp/client --exercises-final-dir client && node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold" --prefix "[{name}]" --names "client.test,client.demo" 'nps client.test' 'nps client.demo' && nps split.client" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
[split.api.verify] nps split.api.verify exited with code 1
--> Sending SIGTERM to other processes..
[split.client.verify] nps split.client.verify exited with code 1
[split.e2e.verify] [build] [build.api] nps executing: cd api && npm start build --silent
[split.e2e.verify] [build] [build.client] nps executing: cd client && npm start build --silent
[split.e2e.verify] [build] [build.api] /bin/sh: line 0: cd: api: No such file or directory
[split.e2e.verify] [build] [build.client] /bin/sh: line 0: cd: client: No such file or directory
[split.e2e.verify] [build] [build.api] The script called "build.api" which runs "cd api && npm start build --silent" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
[split.e2e.verify] [build] [build.client] The script called "build.client" which runs "cd client && npm start build --silent" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
[split.e2e.verify] [build] [build.api] nps build.api exited with code 1
[split.e2e.verify] [build] --> Sending SIGTERM to other processes..
[split.e2e.verify] [build] [build.client] nps build.client exited with code 1
[split.e2e.verify] [build] The script called "build" which runs "node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold" --prefix "[{name}]" --names "build.api,build.client" 'nps build.api' 'nps build.client'" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
[split.e2e.verify] [build] nps build exited with code 1
[split.e2e.verify] --> Sending SIGTERM to other processes..
[split.e2e.verify] [e2e.loadDatabase] starting mongod with `mongod --dbpath ./.e2e/mongo-db --port 27018 &>/dev/null`

Since the setup failed, starting the server does not work either.

npm start dev

Outputs:


> [email protected] start /Users/kevinsjoberg/code/testing-workshop
> nps "dev"

nps executing: node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold,bgGreen.bold" --prefix "[{name}]" --names "dev.mongo,dev.client,dev.api" 'nps dev.mongo' 'nps dev.client' 'nps dev.api'
[dev.mongo] nps executing: nps mongo
[dev.api] nps executing: cd api && npm start dev --silent
[dev.client] nps executing: cd client && npm start dev --silent
[dev.api] /bin/sh: line 0: cd: api: No such file or directory
[dev.api] The script called "dev.api" which runs "cd api && npm start dev --silent" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
[dev.client] /bin/sh: line 0: cd: client: No such file or directory
[dev.client] The script called "dev.client" which runs "cd client && npm start dev --silent" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
[dev.api] nps dev.api exited with code 1
--> Sending SIGTERM to other processes..
[dev.client] nps dev.client exited with code 1
[dev.mongo] nps dev.mongo exited with code null
The script called "dev" which runs "node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold,bgGreen.bold" --prefix "[{name}]" --names "dev.mongo,dev.client,dev.api" 'nps dev.mongo' 'nps dev.client' 'nps dev.api'" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `nps "dev"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/kevinsjoberg/.npm/_logs/2018-04-24T09_30_48_888Z-debug.log

Suggested solution:

I'm not sure what's going on. It looks like a problem with paths since it expects us to be able to do cd api and cd client but it errors out with no such file or directory.

MongoError: not authorized on conduit to execute command { dropDatabase: 1, writeConcern: { w: 1 }

Environment info:

  • mongo version (v3.4.5):
  • node version (v8.1.3):
  • npm version (5.0.3):
  • yarn version (v0.27.5):

Problem description:

hi @kentcdodds i've been following your course at frontendmasters and got an error when try tu run npm run setup

i think is related with the mongo but i don't know what to do about this

i've got this corresponding error

stopping mongod with `mongo admin --eval "db.shutdownServer()" --port 27017 &>/dev/null` (in case it is running)
starting mongod with `mongod --dbpath /Users/Semmiverian/Documents/Learning/Testing JavaScript Applications (feat. React and Redux)/testing-workshop/.mongo-db --port 27017 &>/dev/null`
/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `mongod --dbpath /Users/Semmiverian/Documents/Learning/Testing JavaScript Applications (feat. React and Redux)/testing-workshop/.mongo-db --port 27017 &>/dev/null'
generating and inserting data with `cd api && ./node_modules/.bin/babel-node scripts/generate`
connected. dropping everything
there was an error inserting things!
{ MongoError: not authorized on conduit to execute command { dropDatabase: 1, writeConcern: { w: 1 } }
    at Function.MongoError.create (/Users/Semmiverian/Documents/Learning/Testing JavaScript Applications (feat. React and Redux)/testing-workshop/api/node_modules/mongodb-core/lib/error.js:31:11)
    at /Users/Semmiverian/Documents/Learning/Testing JavaScript Applications (feat. React and Redux)/testing-workshop/api/node_modules/mongodb-core/lib/connection/pool.js:483:72
    at authenticateStragglers (/Users/Semmiverian/Documents/Learning/Testing JavaScript Applications (feat. React and Redux)/testing-workshop/api/node_modules/mongodb-core/lib/connection/pool.js:429:16)
    at Connection.messageHandler (/Users/Semmiverian/Documents/Learning/Testing JavaScript Applications (feat. React and Redux)/testing-workshop/api/node_modules/mongodb-core/lib/connection/pool.js:463:5)
    at Socket.<anonymous> (/Users/Semmiverian/Documents/Learning/Testing JavaScript Applications (feat. React and Redux)/testing-workshop/api/node_modules/mongodb-core/lib/connection/connection.js:319:22)
    at emitOne (events.js:115:13)
    at Socket.emit (events.js:210:7)
    at addChunk (_stream_readable.js:252:12)
    at readableAddChunk (_stream_readable.js:239:11)
    at Socket.Readable.push (_stream_readable.js:197:10)
    at TCP.onread (net.js:589:20)
  name: 'MongoError',
  message: 'not authorized on conduit to execute command { dropDatabase: 1, writeConcern: { w: 1 } }',
  ok: 0,
  errmsg: 'not authorized on conduit to execute command { dropDatabase: 1, writeConcern: { w: 1 } }',
  code: 13,
  codeName: 'Unauthorized' }
stopping mongod process with `mongo admin --eval "db.shutdownServer()" --port 27017 &>/dev/null`

thanks for the help and the course man you help me a lot ๐Ÿ‘

Access to Mondodb data

Environment info:

  • mongo version (v3.4.2):
  • node version (v7.8.0):
  • npm version (v4.2.0):
  • yarn version (v0.27.5):

Problem description:

I reached the Integration test exercise where we make api calls to the Mongo database for articles. I do not have access to the Mongo db data. How do I do this so that I can proceed with the integration test exercises?
I also tried the command I saw in another post to seed the data using the command "node ./scripts/load-database" to the db but got a problem connecting to Mongodb.
Thanks
screen shot 2017-08-11 at 5 16 38 pm

screen shot 2017-08-11 at 4 59 30 pm

screen shot 2017-08-11 at 4 50 21 pm

Suggested solution:

Local Storage error when running tests

Environment info:

  • node version (node --version): 8.11.3

  • npm version (npm --version): 6.2.0

  • yarn version (yarn --version): 1.7.0

  • jest version (npx jest --version): 22.4.4

Problem description:
On fem-2018 branch. When I run the simple react tests, I get the error SecurityError: localStorage is not available for opaque origins.

Commands run:
npm run setup

npm run react:test

Here is the output from running the test:

 FAIL   react  other/simple-react/__tests__/item-list.js
  โ— Test suite failed to run

    SecurityError: localStorage is not available for opaque origins

      at Window.get localStorage [as localStorage] (../../node_modules/jsdom/lib/jsdom/browser/Window.js:257:15)
          at Array.forEach (<anonymous>)

 FAIL   react  other/simple-react/__tests__/item-list.todo.js
  โ— Test suite failed to run

    SecurityError: localStorage is not available for opaque origins

      at Window.get localStorage [as localStorage] (../../node_modules/jsdom/lib/jsdom/browser/Window.js:257:15)
          at Array.forEach (<anonymous>)

Suggested solution:

Doing some googling around, I found this thread: jsdom/jsdom#2304
Adding a testURL to jest.config.js seemed to fix the problem.

module.exports = {
  displayName: 'react',
  testURL: 'http://localhost',
}

Happy to open a PR for this, if this is something that is reproducible.

Today I Learned client - cannot load initial data

Environment info:

  • node version (node --version): v10.13.0
  • npm version (npm --version): 6.4.1
  • yarn version (yarn --version): 1.9.4

Problem description:

I was trying to get the "Today I Learned" client to run on my machine, however, I ran into a couple of issues which I am not sure are related. When I run npm run dev inside of my /client the development server opens up but, I do not see any randomly generated posts.

screen shot 2018-12-05 at 11 08 52 pm

Here is what I am seeing in the console -

screen shot 2018-12-05 at 11 11 03 pm

I ran the npm run setup --silent and everything looks great until the E2E script. I am getting the following error -

{ Error: Command failed: npm run cy:run
[test:e2e]     at makeError (/Users/ssiwako/Documents/frontend-masters/testing-workshop/node_modules/start-server-and-test/node_modules/execa/index.js:174:9)
[test:e2e]     at Promise.all.then.arr (/Users/ssiwako/Documents/frontend-masters/testing-workshop/node_modules/start-server-and-test/node_modules/execa/index.js:278:16)
[test:e2e]     at <anonymous>
[test:e2e]     at process._tickCallback (internal/process/next_tick.js:189:7)
[test:e2e]   code: 1,
[test:e2e]   stdout: null,
[test:e2e]   stderr: null,
[test:e2e]   failed: true,
[test:e2e]   signal: null,
[test:e2e]   cmd: 'npm run cy:run',
[test:e2e]   timedOut: false,
[test:e2e]   killed: false }
[test:e2e] start-server-and-test exit code 1
[test:e2e] Error: start-server-and-test exit code 1
[test:e2e]     at ChildProcess.proc.on (/Users/ssiwako/Documents/frontend-masters/testing-workshop/node_modules/as-a/src/run-command.js:38:23)
[test:e2e]     at emitTwo (events.js:126:13)
[test:e2e]     at ChildProcess.emit (events.js:214:7)
[test:e2e]     at maybeClose (internal/child_process.js:915:16)
[test:e2e]     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
[test:e2e] [client] 
[test:e2e] [client] INFO: Gracefully shutting down. Please wait...
[test:e2e] [server] npm run start:server --silent exited with code 0
[test:e2e] [client] npm run start:client --silent exited with code 0
[test:e2e] npm run test:e2e:run --silent exited with code 255

As aforementioned, I am not sure if this is the reason why the "Today I Learned" client isn't working.

Failed test after running client editor test

Seem this error after running npm run test:client

 FAIL   client  client/src/screens/__tests__/editor.todo.js
  โ— Test suite failed to run

    Requires Babel "^7.0.0-0", but was loaded with "6.26.3". If you are sure you have a compatible version of @babel/core, it islikely that something in your build process is loading the wrong version. Inspect the stack trace of this error to look for the first entry that doesn't mention "@babel/core" or "babel-core" to see what is calling Babel. (While processing preset: "/Users/huchenme/playground/testing-workshop/client/node_modules/babel-preset-react-app/index.js")

It is working if I downgrade react-scripts to version1

Calculator configuration could not pass test with cypress run

Hi Kent,

I couldn't get the calculator test to pass when running with cypress run.
It fails with the error: "Error: Unable to find an element with the text: /^1$/."

When I look at the screen shots, it was showing a list of files in dist folder instead of the calculator app and hence the error message.

To fix this, I updated the start command in other/configuration/calculator/package.json to:

scripts:{
"start": "serve --port 8080"
}

Question - Integration testing performance/scalability

First of all, this is not a bug report or anything so feel free to close this if you want to keep this only for bug reports. Second, thanks for sharing this code here, there is a lot to learn from this on how to setup testing on different levels.

Now my question is, how 'scalable' is the integration testing setup with Jest? I had a similar setup with a medium sized application and started running in to performance issues quite soon. Because Jest compiles every test on it's own and you include the complete application from inside the test file it means that, let's say you have 20 different pages/views in your application, each with their own integration test file your application gets compiled 20 times when you run your tests. This made my tests slow and unusable and was only getting worse with each line of code I added.

Do you have any ideas or recommendations about how to scale the integration tests when your application grows? I can only find trivial examples of a setup like this so I'm curious if someone tackled this for medium/large sized applications.

challenge 5: port conflict when attempting to run the tests against running app

Environment info:

  • mongo version (mongod --version):
  • node version (node --version):
  • npm version (npm --version):
  • yarn version (yarn --version):

Problem description:

When the app is running (through npm start dev), if you try to run the integration tests the process end with error: eaddrinuse: 3000.
Suggested solution:

I looked at the startServer() module and tried changing the port specified, as well as changing the port in articles.test.js:

const api = axios.create({
  baseURL: 'http://localhost:3000/api',
})

but it didn't seem to help. When I run the mongo service only with npm start mongo the tests run fine against it.

Windows : Auth test fail due to Cypress timing out

Environment info:

  • Operating system : Windows 10 Pro, Version 1709, OS Build : 16299.192.
  • Windows insiders : No. Running on stable builds.
  • node version (node --version): v8.9.4
  • npm version (npm --version): v5.6.0
  • yarn version (yarn --version): v1.3.2

Problem description:

Reference #49

[test:e2e]   authentication
    1) should allow users to register
    2) should allow existing users to login
[test:e2e]
[test:e2e]   authentication
    3) should allow existing users to login
[test:e2e]
[test:e2e]
[test:e2e]   0 passing (10s)
[test:e2e]   3 failing
[test:e2e]
[test:e2e]   1) authentication should allow users to register:
[test:e2e]      CypressError: Timed out retrying: expected 'http://localhost:8001/' to equal 'http://localhost:8001\r/'
[test:e2e]       at Object.cypressErr (http://localhost:8001/__cypress/runner/cypress_runner.js:65969:11)
[test:e2e]       at Object.throwErr (http://localhost:8001/__cypress/runner/cypress_runner.js:65934:18)
[test:e2e]       at Object.throwErrByPath (http://localhost:8001/__cypress/runner/cypress_runner.js:65961:17)
[test:e2e]       at retry (http://localhost:8001/__cypress/runner/cypress_runner.js:60073:16)
[test:e2e]       at http://localhost:8001/__cypress/runner/cypress_runner.js:52591:18
[test:e2e]       at tryCatcher (http://localhost:8001/__cypress/runner/cypress_runner.js:6268:23)
[test:e2e]       at Promise._settlePromiseFromHandler (http://localhost:8001/__cypress/runner/cypress_runner.js:4290:31)
[test:e2e]       at Promise._settlePromise (http://localhost:8001/__cypress/runner/cypress_runner.js:4347:18)
[test:e2e]       at Promise._settlePromise0 (http://localhost:8001/__cypress/runner/cypress_runner.js:4392:10)
[test:e2e]       at Promise._settlePromises (http://localhost:8001/__cypress/runner/cypress_runner.js:4467:18)
[test:e2e]       at Async._drainQueue (http://localhost:8001/__cypress/runner/cypress_runner.js:1200:16)
[test:e2e]       at Async._drainQueues (http://localhost:8001/__cypress/runner/cypress_runner.js:1210:10)
[test:e2e]       at Async.drainQueues (http://localhost:8001/__cypress/runner/cypress_runner.js:1084:14)
[test:e2e]
[test:e2e]   2) authentication should allow existing users to login:
[test:e2e]      CypressError: cy.request() failed on:
[test:e2e]
/auth/registerp://localhost:3001/api
[test:e2e]
[test:e2e] The response we received from your web server was:
[test:e2e]
[test:e2e]   > 404: Not Found
[test:e2e]
[test:e2e] This was considered a failure because the status code was not '2xx' or '3xx'.
[test:e2e]
[test:e2e] If you do not want status codes to cause failures pass the option: 'failOnStatusCode: false'
[test:e2e]
[test:e2e] -----------------------------------------------------------
[test:e2e]
[test:e2e] The request we sent was:
[test:e2e]
[test:e2e] Method: POST
/auth/register: http://localhost:3001/api
[test:e2e] Headers: {
[test:e2e]   "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Cypress/1.4.1 Chrome/53.0.2785.143 Electron/1.4.6 Safari/537.36",
[test:e2e]   "accept": "*/*",
[test:e2e]   "accept-encoding": "gzip, deflate",
[test:e2e]   "content-type": "application/json",
[test:e2e]   "content-length": 55
[test:e2e] }
[test:e2e] Body: {"username":"Alexis_Koch","password":"YbJ_u0zGHqQECin"}
[test:e2e]
[test:e2e] -----------------------------------------------------------
[test:e2e]
[test:e2e] The response we got was:
[test:e2e]
[test:e2e] Status: 404 - Not Found
[test:e2e] Headers: {
[test:e2e]   "x-powered-by": "Express",
[test:e2e]   "access-control-allow-origin": "*",
[test:e2e]   "content-security-policy": "default-src 'self'",
[test:e2e]   "x-content-type-options": "nosniff",
[test:e2e]   "content-type": "text/html; charset=utf-8",
[test:e2e]   "content-length": "160",
[test:e2e]   "date": "Fri, 02 Feb 2018 14:59:25 GMT",
[test:e2e]   "connection": "close"
[test:e2e] }
[test:e2e] Body: <!DOCTYPE html>
[test:e2e] <html lang="en">
[test:e2e] <head>
[test:e2e] <meta charset="utf-8">
[test:e2e] <title>Error</title>
[test:e2e] </head>
[test:e2e] <body...
[test:e2e]
[test:e2e]       at Object.cypressErr (http://localhost:8001/__cypress/runner/cypress_runner.js:65969:11)
[test:e2e]       at Object.throwErr (http://localhost:8001/__cypress/runner/cypress_runner.js:65934:18)
[test:e2e]       at Object.throwErrByPath (http://localhost:8001/__cypress/runner/cypress_runner.js:65961:17)
[test:e2e]       at http://localhost:8001/__cypress/runner/cypress_runner.js:58366:20
[test:e2e]       at tryCatcher (http://localhost:8001/__cypress/runner/cypress_runner.js:6268:23)
[test:e2e]       at Promise._settlePromiseFromHandler (http://localhost:8001/__cypress/runner/cypress_runner.js:4290:31)
[test:e2e]       at Promise._settlePromise (http://localhost:8001/__cypress/runner/cypress_runner.js:4347:18)
[test:e2e]       at Promise._settlePromise0 (http://localhost:8001/__cypress/runner/cypress_runner.js:4392:10)
[test:e2e]       at Promise._settlePromises (http://localhost:8001/__cypress/runner/cypress_runner.js:4471:18)
[test:e2e]       at Async._drainQueue (http://localhost:8001/__cypress/runner/cypress_runner.js:1200:16)
[test:e2e]       at Async._drainQueues (http://localhost:8001/__cypress/runner/cypress_runner.js:1210:10)
[test:e2e]       at Async.drainQueues (http://localhost:8001/__cypress/runner/cypress_runner.js:1084:14)
[test:e2e]
[test:e2e]   3) authentication should allow existing users to login:
[test:e2e]      CypressError: cy.request() failed on:
[test:e2e]
/auth/registerp://localhost:3001/api
[test:e2e]
[test:e2e] The response we received from your web server was:
[test:e2e]
[test:e2e]   > 404: Not Found
[test:e2e]
[test:e2e] This was considered a failure because the status code was not '2xx' or '3xx'.
[test:e2e]
[test:e2e] If you do not want status codes to cause failures pass the option: 'failOnStatusCode: false'
[test:e2e]
[test:e2e] -----------------------------------------------------------
[test:e2e]
[test:e2e] The request we sent was:
[test:e2e]
[test:e2e] Method: POST
/auth/register: http://localhost:3001/api
[test:e2e] Headers: {
[test:e2e]   "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Cypress/1.4.1 Chrome/53.0.2785.143 Electron/1.4.6 Safari/537.36",
[test:e2e]   "accept": "*/*",
[test:e2e]   "accept-encoding": "gzip, deflate",
[test:e2e]   "content-type": "application/json",
[test:e2e]   "content-length": 58
[test:e2e] }
[test:e2e] Body: {"username":"Darren_Volkman","password":"LBvfwpIOwrmhm8L"}
[test:e2e]
[test:e2e] -----------------------------------------------------------
[test:e2e]
[test:e2e] The response we got was:
[test:e2e]
[test:e2e] Status: 404 - Not Found
[test:e2e] Headers: {
[test:e2e]   "x-powered-by": "Express",
[test:e2e]   "access-control-allow-origin": "*",
[test:e2e]   "content-security-policy": "default-src 'self'",
[test:e2e]   "x-content-type-options": "nosniff",
[test:e2e]   "content-type": "text/html; charset=utf-8",
[test:e2e]   "content-length": "160",
[test:e2e]   "date": "Fri, 02 Feb 2018 14:59:26 GMT",
[test:e2e]   "connection": "close"
[test:e2e] }
[test:e2e] Body: <!DOCTYPE html>
[test:e2e] <html lang="en">
[test:e2e] <head>
[test:e2e] <meta charset="utf-8">
[test:e2e] <title>Error</title>
[test:e2e] </head>
[test:e2e] <body...
[test:e2e]
[test:e2e]       at Object.cypressErr (http://localhost:8001/__cypress/runner/cypress_runner.js:65969:11)
[test:e2e]       at Object.throwErr (http://localhost:8001/__cypress/runner/cypress_runner.js:65934:18)
[test:e2e]       at Object.throwErrByPath (http://localhost:8001/__cypress/runner/cypress_runner.js:65961:17)
[test:e2e]       at http://localhost:8001/__cypress/runner/cypress_runner.js:58366:20
[test:e2e]       at tryCatcher (http://localhost:8001/__cypress/runner/cypress_runner.js:6268:23)
[test:e2e]       at Promise._settlePromiseFromHandler (http://localhost:8001/__cypress/runner/cypress_runner.js:4290:31)
[test:e2e]       at Promise._settlePromise (http://localhost:8001/__cypress/runner/cypress_runner.js:4347:18)
[test:e2e]       at Promise._settlePromise0 (http://localhost:8001/__cypress/runner/cypress_runner.js:4392:10)
[test:e2e]       at Promise._settlePromises (http://localhost:8001/__cypress/runner/cypress_runner.js:4471:18)
[test:e2e]       at Async._drainQueue (http://localhost:8001/__cypress/runner/cypress_runner.js:1200:16)
[test:e2e]       at Async._drainQueues (http://localhost:8001/__cypress/runner/cypress_runner.js:1210:10)
[test:e2e]       at Async.drainQueues (http://localhost:8001/__cypress/runner/cypress_runner.js:1084:14)
[test:e2e]
[test:e2e]
[test:e2e]
[test:e2e]
[test:e2e]   (Tests Finished)
[test:e2e]
[test:e2e]   - Tests:           3
[test:e2e]   - Passes:          0
[test:e2e]   - Failures:        3
[test:e2e]   - Pending:         0
[test:e2e]   - Duration:        9 seconds
[test:e2e]   - Screenshots:     3
[test:e2e]   - Video Recorded:  true
[test:e2e]   - Cypress Version: 1.4.1
[test:e2e]
[test:e2e]
[test:e2e]   (Screenshots)
[test:e2e]
[test:e2e]   - C:\Users\night\Development\testing-workshop\cypress\screenshots\authentication -- should allow users to register.png (1280x720)
[test:e2e]   - C:\Users\night\Development\testing-workshop\cypress\screenshots\authentication -- should allow existing users to login.png (1280x720)
[test:e2e]   - C:\Users\night\Development\testing-workshop\cypress\screenshots\authentication -- should allow existing users to login.png (1280x720)
[test:e2e]
[test:e2e]
[test:e2e]   (Video)
[test:e2e]
[test:e2e]   - Started processing:   Compressing to 32 CRF
[test:e2e]   - Finished processing:  C:\Users\night\Development\testing-workshop\cypress\videos\kjt42.mp4 (8 seconds)
[test:e2e]
[test:e2e]
[test:e2e]   (All Done)
[test:e2e]
[test:e2e] npm-run-all exit code 1
[test:e2e] Error: npm-run-all exit code 1
[test:e2e]     at ChildProcess.proc.on (C:\Users\night\Development\testing-workshop\node_modules\as-a\src\run-command.js:38:23)
[test:e2e]     at emitTwo (events.js:126:13)
[test:e2e]     at ChildProcess.emit (events.js:214:7)
[test:e2e]     at ChildProcess.cp.emit (C:\Users\night\Development\testing-workshop\node_modules\as-a\node_modules\cross-spawn\lib\enoent.js:40:29)
[test:e2e]     at maybeClose (internal/child_process.js:925:16)
[test:e2e]     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
[test:e2e] npm run test:e2e:run --silent exited with code 4294967295

Suggested solution:

Typo in 'other' file (Challenge 1)

Environment info:

  • mongo version (mongod --version):
  • node version (node --version):
  • npm version (npm --version):
  • yarn version (yarn --version):

Problem description:

Hey there! I was going to submit a PR, but I had already cloned the repo and gone thru the setup and pushed to my own repo so... I didn't want to go through that setup again. The bug I found is really small so I'm just submitting it here.

Line 29 of other/start.html:
// (because input1.value and input2.value will always be stirngs)

Suggested solution:

should be:
// (because input1.value and input2.value will always be strings)

Thanks for the great course!

Document how to setup a VM for cypress

I'd really like to have some sort of quick list of steps people could follow to set up a VM that has the project all ready to go and cypress installed. But I'm not very good at this kind of thing. Anyone wanna help with this? Vagrant seems like a good idea...

Issue with ex 2 starting code

Environment info:

  • mongo version (mongod --version):
  • node version (node --version):
  • npm version (npm --version):
  • yarn version (yarn --version):

Problem description:

Hey there! Also noticed that for ex. 2, the starting code I had for the test file (__tests__/get-token-from-header.js) was different than the video - it was mostly completed already (though I was able to add a little following the video.) A screenshot is attached showing what I started with there.

Suggested solution:

I'm not sure what's going on - I started with a fresh clone of the project repo and ran the setup steps and have been able to follow along so far. Maybe a past commit/PR to the repo got things out of whack?

screenshot from 2017-07-04 13-10-42

Test localstorage in E2E tests

This isn't working and neither is this. I'm not sure what I'm doing wrong.

If you want to help. Follow the setup instructions in the README.md (hopefully it's clear, if it's not please let me know!). Then run npm start e2e. You can also run npm start e2e.dev and various other scripts (run npm start help to see them all).

Thanks!

nps e2e.run.cypress exited with code 0

Environment info:

  • mongo version (3.4.3):
  • node version (6.10.2):
  • npm version (3.10.10):
  • yarn version (0.21.3):

Problem description:
I was interested in checking out Cypress. I thought I would see if I could get this to run on Docker using Ubuntu 16. Therefore this is probably a very low priority issue. I ran into the following issue. I was wondering if this is an easy fix that someone could suggest a way around.

I did receive the following when I started the npm setup script:

๐ŸŽ‰  Congrats! Your system is setup properly
You should be good to install and run things.

During the Cypress part though it got messy:

[api.test] [api.test.unit]
[api.test] [api.test.unit] Test Suites: 3 passed, 3 total
[api.test] [api.test.unit] Tests: 1 skipped, 18 passed, 19 total
[api.test] [api.test.unit] Snapshots: 0 total
[api.test] [api.test.unit] Time: 84.629s
[api.test] [api.test.unit] Ran all test suites.
[api.test] [api.test.unit] nps api.test.unit exited with code 0
[lint]
[lint] /projects/testing-workshop/api/src/models/tests/article.js
[lint] 42:6 warning Unexpected disabled test jest/no-disabled-tests
[lint]
[lint] โœ– 1 problem (0 errors, 1 warning)
[lint]
[lint] nps lint exited with code 0
[e2e] [build] [build.client] Compiled successfully.
[e2e] [build] [build.client]
[e2e] [build] [build.client] File sizes after gzip:
[e2e] [build] [build.client]
[e2e] [build] [build.client] 88.49 KB build/static/js/main.3e7c3325.js
[e2e] [build] [build.client]
[e2e] [build] [build.client] The project was built assuming it is hosted at the server root.
[e2e] [build] [build.client] To override this, specify the homepage in your package.json.
[e2e] [build] [build.client] For example, add this to build it for GitHub Pages:
[e2e] [build] [build.client]
[e2e] [build] [build.client] "homepage": "http://myname.github.io/myapp",
[e2e] [build] [build.client]
[e2e] [build] [build.client] The build folder is ready to be deployed.
[e2e] [build] [build.client] You may serve it with a static server:
[e2e] [build] [build.client]
[e2e] [build] [build.client] yarn global add serve
[e2e] [build] [build.client] serve -s build
[e2e] [build] [build.client]
[e2e] [build] [build.client] nps build.client exited with code 0
[e2e] [build] nps build exited with code 0
[e2e] [api] nps executing: node ./scripts/e2e-api
[e2e] [mongo] nps executing: node ./scripts/e2e-mongo
[e2e] [client] nps executing: node ./scripts/e2e-client
[e2e] [cypress] nps executing: node ./scripts/e2e-cypress
[e2e] [api] ๐Ÿ”‘ starting api server: npm start --silent
[e2e] [mongo] ๐Ÿ”‘ starting mongodb: mongod --dbpath /projects/testing-workshop/.e2e/mongo-db --port 27018
[e2e] [client] ๐Ÿ”‘ starting client server: npm start --silent
[e2e] [cypress]
[e2e] [cypress] Cypress was not found: Installing a fresh copy.
[e2e] [cypress]
[e2e] [cypress]
[e2e] [cypress]
[e2e] [cypress]
[e2e] [cypress] - Finished Installing /root/.cypress/Cypress (version: 0.19.1)
[e2e] [cypress] โ˜  shutting down cypress
[e2e] [cypress] nps e2e.run.cypress exited with code 0
[e2e] --> Sending SIGTERM to other processes..
[e2e] [client] Terminated
[e2e] [client] nps e2e.run.client exited with code 143
[e2e] [mongo] nps e2e.run.mongo exited with code null
[e2e] [api] nps e2e.run.api exited with code null
[e2e] nps e2e exited with code 0

Errors in `npm run setup`

Environment info:

  • mongo version (mongod --version): 3.4.5
  • node version (node --version): 8.1.3
  • npm version (npm --version): 5.0.3
  • yarn version (yarn --version): 0.24.6

Problem description:

Tried to run npm run setup but got errors:

[split.api.verify] [api.test] [api.test.integration] [dev.api] The script called "test.integration" which runs "jest --config=tests/jest.config.integration.json --coverage" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.4/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code

[split.api.verify] [api.test] [api.test.integration] The script called "api.test.integration" which runs "echo nps mongo.stop && nps mongo.stop &>/dev/null || true && concurrently --kill-others --success first --prefix "[{name}]" --names dev.mongo.silent,dev.api,api.test.integration "nps dev.mongo.silent" " sleep 2 && cd api && npm start test.integration --silent && cd .. "" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code

'[split.api.verify] [api.test] The script called "api.test" which runs "node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold" --prefix "[{name}]" --names "api.test.unit,api.test.integration" 'nps api.test.unit' 'nps api.test.integration'" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code`

[split.api.verify] The script called "split.api.verify" which runs "node node_modules/rimraf/bin.js api-final && split-guide generate --no-clean --templates-dir other/templates/api --exercises-dir node_modules/.tmp/api --exercises-final-dir api && node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold" --prefix "[{name}]" --names "api.test,api.demo" 'nps api.test' 'nps api.demo' && nps split.api" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code

[split.e2e.verify] nps split.e2e.verify exited with code null The script called "validate" which runs "nps lint && node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold,bgGreen.bold" --prefix "[{name}]" --names "split.api.verify,split.client.verify,split.e2e.verify" 'nps split.api.verify' 'nps split.client.verify' 'nps split.e2e.verify'" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code

Suggested solution:

Something wrong with my config? Perhaps a PATH issue? No idea, really.
Here is the results of running echo $PATH. You'll see I added /src/local/bin/mongod which is the result of running which mongod.
/usr/local/bin/mongod:/Users/matthewepler/.nvm/versions/node/v8.1.3/bin:/Users/matthewepler/go/bin:/Users/matthewepler/.yarn/bin:/usr/local/heroku/bin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/usr/local/MacGPG2/bin:/Applications/Wireshark.app/Contents/MacOS

Simplify mocking

Lots of feedback that the instruction on mocks was too complicated.

  1. Change the way it's presented (maybe make it more progressive like the "whats-a-test" stuff)
  2. Change the way axios is used so it doesn't create an instance and instead uses axios directly

Cypress.addParentCommand depecrated. Multiple other issues with running the Cypress tests.

Environment info:

Running on Ubuntu 16.04

  • node version (node --version): v8.11.1
  • npm version (npm --version): 5.6.0
  • yarn version (yarn --version): 1.6.0

Problem description:

I'm enrolled in the Testing Javascript Applications (ft. React and Redux) course on FEM.

I'm currently trying to follow along with the videos on end-to-end testing. I am on Ubuntu 16.04 and was able to get Cypress to install and work. But when I click on 'run all tests', it waits a while and outputs this error:-

Uncaught CypressError: Cypress.addParentCommand(...) has been removed and replaced by:

Cypress.Commands.add(...)

Instead of indicating 'parent', 'child', or 'dual' commands, you pass an options object
to describe the requirements around the previous subject. You can also enforce specific
subject types such as requiring the subject to be a DOM element.

To rewrite this custom command you'd likely write:

Cypress.Commands.add('[object Object]', function(){...})

https://on.cypress.io/custom-command-interface-changed

This error originated from your test code, not from Cypress.

When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.

Cypress could not associate this error to any specific test.

We dynamically generated a new test to display this failure.

Check your console for the stack trace or click this message to see where it originated from.
```

Suggested solution:

I tried to follow along the error and update stuff, but it results in other errors that are difficult to interpret as a beginner, so I couldn't try to diagnose further.

I think Cypress has updated its API or something and the code in this app needs to be updated to reflect their changes. Kindly do so.

<!-- ideas are welcome! -->

[dev.api] [nodemon] app crashed - waiting for file changes before starting...; Unhandled Rejection (TypeError)

Environment info:

  • mongo version (mongod --version): 3.4.4
  • node version (node --version): 6.11.0
  • npm version (npm --version): 5.0.3
  • yarn version (yarn --version): 0.24.6

Problem description:

I'm on Mac OS Sierra
I've tried to run sudo npm run setup --silent and firstly I have "Congrats" but then I have all these errors beginning with the error after the third 'waiting...'. When I go further with the setup instructions and write npm start dev (the same problem when I run sudo npm start dev.api), then my server starts but I got error: [dev.api] [nodemon] app crashed - waiting for file changes before starting... (I pasted the code underneath). When I go to the localhost:8080 I am immediately directed to the http://localhost:8080/#/ where I got an error:

Unhandled Rejection (TypeError): Cannot read property 'data' of [undefined].
(> 34 | action.payload = error.response.data)

The code when I run sudo npm run setup --silent

๐ŸŽ‰  Congrats! Your system is setup properly
You should be good to install and run things.
๐Ÿ“ฆ  Installing dependencies via yarn --force --ignore-platform --ignore-engines
๐Ÿ”‘  starting install in /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master
yarn install v0.24.6
[1/4] ๐Ÿ”  Resolving packages...
[2/4] ๐Ÿšš  Fetching packages...
[3/4] ๐Ÿ”—  Linking dependencies...
warning "[email protected]" has unmet peer dependency "babel-core@^6.0.0".
[4/4] ๐Ÿ“ƒ  Rebuilding all packages...
success Saved lockfile.
โœจ  Done in 4.86s.
๐ŸŽ‰  finished installing dependencies in "/Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master"
๐Ÿ”‘  starting install in /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/api
yarn install v0.24.6
[1/4] ๐Ÿ”  Resolving packages...
[2/4] ๐Ÿšš  Fetching packages...
[3/4] ๐Ÿ”—  Linking dependencies...
[4/4] ๐Ÿ“ƒ  Rebuilding all packages...
[3/3] โ  unicode: GET unicode.org:80/Public/UNIDATA/UnicodeData.txt
[-/3] โ  waiting...
[-/3] โ  waiting...
[-/3] โ  waiting...
error /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/api/node_modules/unicode: Command failed.
Exit code: 1
Command: sh
Arguments: -c node install.js
Directory: /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/api/node_modules/unicode
Output:
try to read file /usr/share/unicode/UnicodeData.txt โ€ฆ
/usr/share/unicode/UnicodeData.txt not found.
try to read file /usr/share/unicode-data/UnicodeData.txt โ€ฆ
/usr/share/unicode-data/UnicodeData.txt not found.
try to read file UnicodeData.txt โ€ฆ
UnicodeData.txt not found.
try to download โ€ฆ
GET unicode.org:80/Public/UNIDATA/UnicodeData.txt
request timed out.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
๐Ÿ’€  error installing dependencies in "/Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/api"
stopping mongod with `mongo admin --eval "db.shutdownServer()" --port 27017 &>/dev/null` (in case it is running)
starting mongod with `mongod --dbpath /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/.mongo-db --port 27017 &>/dev/null`
generating and inserting data with `cd api && ./node_modules/.bin/babel-node scripts/generate`
module.js:471
    throw err;
    ^

Error: Cannot find module 'unicode/category/So'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at symbols (/Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/api/node_modules/slug/slug.js:6:16)
    at /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/api/node_modules/slug/slug.js:199:5
    at Object.<anonymous> (/Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/api/node_modules/slug/slug.js:212:2)
    at Module._compile (module.js:570:32)
    at Module._extensions..js (module.js:579:10)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/api/node_modules/babel-register/lib/node.js:152:7)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/api/src/models/article.js:3:1)
stopping mongod process with `mongo admin --eval "db.shutdownServer()" --port 27017 &>/dev/null`
nps executing: nps lint && node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold,bgGreen.bold" --prefix "[{name}]" --names "split.api.verify,split.client.verify,split.e2e.verify" 'nps split.api.verify' 'nps split.client.verify' 'nps split.e2e.verify'
nps executing: eslint . --cache
[split.api.verify] nps executing: node node_modules/rimraf/bin.js api-final && split-guide generate --no-clean --templates-dir other/templates/api --exercises-dir node_modules/.tmp/api --exercises-final-dir api && node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold" --prefix "[{name}]" --names "api.test,api.demo" 'nps api.test' 'nps api.demo' && nps split.api
[split.client.verify] nps executing: node node_modules/rimraf/bin.js client-final && split-guide generate --no-clean --templates-dir other/templates/client --exercises-dir node_modules/.tmp/client --exercises-final-dir client && node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold" --prefix "[{name}]" --names "client.test,client.demo" 'nps client.test' 'nps client.demo' && nps split.client
[split.e2e.verify] nps executing: node node_modules/rimraf/bin.js cypress-final && split-guide generate --no-clean --templates-dir other/templates/cypress --exercises-dir node_modules/.tmp/cypress --exercises-final-dir cypress && nps e2e && nps split.e2e
[split.e2e.verify] Saved 4 files:
[split.e2e.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/node_modules/.tmp/cypress/.eslintrc
[split.e2e.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/cypress/.eslintrc
[split.e2e.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/node_modules/.tmp/cypress/e2e/users_spec.js
[split.e2e.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/cypress/e2e/users_spec.js
[split.client.verify] Saved 17 files:
[split.client.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/node_modules/.tmp/client/.eslintrc
[split.client.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/client/.eslintrc
[split.client.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/node_modules/.tmp/client/demo/unit/__tests__/customer-list.js
[split.client.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/client/demo/unit/__tests__/customer-list.js
[split.client.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/node_modules/.tmp/client/demo/unit/__tests__/toggle.js
[split.client.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/client/demo/unit/__tests__/toggle.js
[split.client.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/node_modules/.tmp/client/src/reducers/__tests__/article.js
[split.client.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/client/src/reducers/__tests__/article.js
[split.client.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/node_modules/.tmp/client/src/screens/__tests__/__snapshots__/editor.js.snap
[split.client.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/client/src/screens/__tests__/__snapshots__/editor.js.snap
[split.client.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/node_modules/.tmp/client/src/screens/__tests__/editor.js
[split.client.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/client/src/screens/__tests__/editor.js
[split.client.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/client/tests/integration/__mocks__/axios.js
[split.client.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/node_modules/.tmp/client/tests/integration/login.test.js
[split.client.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/client/tests/integration/login.test.js
[split.client.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/node_modules/.tmp/client/tests/integration/register.test.js
[split.client.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/client/tests/integration/register.test.js
[split.api.verify] Saved 28 files:
[split.api.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/node_modules/.tmp/api/.eslintrc
[split.api.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/api/.eslintrc
[split.api.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/node_modules/.tmp/api/demo/integration/__tests__/users.js
[split.api.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/api/demo/integration/__tests__/users.js
[split.api.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/node_modules/.tmp/api/demo/unit/__tests__/get-age.js
[split.api.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/api/demo/unit/__tests__/get-age.js
[split.api.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/node_modules/.tmp/api/demo/unit/__tests__/make-me-a-sandwich.js
[split.api.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/api/demo/unit/__tests__/make-me-a-sandwich.js
[split.api.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/node_modules/.tmp/api/demo/unit/__tests__/sum.js
[split.api.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/api/demo/unit/__tests__/sum.js
[split.api.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/node_modules/.tmp/api/demo/unit/get-age.js
[split.api.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/api/demo/unit/get-age.js
[split.api.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/node_modules/.tmp/api/demo/unit/sum.js
[split.api.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/api/demo/unit/sum.js
[split.api.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/node_modules/.tmp/api/src/models/__tests__/user.js
[split.api.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/api/src/models/__tests__/user.js
[split.api.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/node_modules/.tmp/api/src/models/user.js
[split.api.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/api/src/models/user.js
[split.api.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/node_modules/.tmp/api/src/routes/utils/__tests__/arrayify.js
[split.api.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/api/src/routes/utils/__tests__/arrayify.js
[split.api.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/node_modules/.tmp/api/src/routes/utils/__tests__/get-token-from-header.js
[split.api.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/api/src/routes/utils/__tests__/get-token-from-header.js
[split.api.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/node_modules/.tmp/api/src/routes/utils/arrayify.js
[split.api.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/api/src/routes/utils/arrayify.js
[split.api.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/node_modules/.tmp/api/src/routes/utils/get-token-from-header.js
[split.api.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/api/src/routes/utils/get-token-from-header.js
[split.api.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/node_modules/.tmp/api/tests/integration/articles.test.js
[split.api.verify] /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/api/tests/integration/articles.test.js
[split.e2e.verify] nps executing: node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold" --prefix "[{name}]" --names "e2e.loadDatabase,build" 'nps e2e.loadDatabase' 'nps build' && concurrently --kill-others --success first --prefix-colors "bgGreen.bold,bgBlue.bold,bgMagenta.bold,bgCyan.bold" --prefix "[{name}]" --names "client,cypress,mongo,api" "nps e2e.run.client" "nps e2e.run.cypress" "nps e2e.run.mongo" "nps e2e.run.api"
[split.api.verify] [api.test] nps executing: node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold" --prefix "[{name}]" --names "api.test.unit,api.test.integration" 'nps api.test.unit' 'nps api.test.integration'
[split.api.verify] [api.demo] nps executing: node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold" --prefix "[{name}]" --names "api.demo.unit.single,api.demo.integration.single" 'nps api.demo.unit.single' 'nps api.demo.integration.single'
[split.client.verify] [client.test] nps executing: node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold" --prefix "[{name}]" --names "client.test.unit,client.test.integration" 'nps client.test.unit' 'nps client.test.integration'
[split.client.verify] [client.demo] nps executing: node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold" --prefix "[{name}]" --names "client.demo.unit.single,client.demo.integration.single" 'nps client.demo.unit.single' 'nps client.demo.integration.single'
[split.e2e.verify] [e2e.loadDatabase] nps executing: node node_modules/cross-env/dist/bin/cross-env.js MONGO_PORT=27018 MONGO_PATH=./.e2e/mongo-db MONGODB_URI="mongodb://localhost:27018/conduit" node ./scripts/load-database.js
[split.e2e.verify] [build] nps executing: node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold" --prefix "[{name}]" --names "build.api,build.client" 'nps build.api' 'nps build.client'
[split.api.verify] [api.demo] [api.demo.unit.single] nps executing: cd api && npm start demo.unit --silent && cd ..
[split.api.verify] [api.test] [api.test.integration] nps executing: echo nps mongo.stop && nps mongo.stop &>/dev/null || true && concurrently --kill-others --success first --prefix "[{name}]" --names dev.mongo.silent,dev.api,api.test.integration "nps dev.mongo.silent" " sleep 2 && cd api && npm start test.integration --silent && cd .. "
[split.client.verify] [client.test] [client.test.integration] nps executing: cd client && npm start test.integration --silent && cd ..
[split.e2e.verify] [e2e.loadDatabase] stopping mongod with `mongo admin --eval "db.shutdownServer()" --port 27018 &>/dev/null` (in case it is running)
[split.api.verify] [api.demo] [api.demo.integration.single] nps executing: cd api && npm start demo.integration --silent && cd ..
[split.client.verify] [client.demo] [client.demo.integration.single] nps executing: cd client && npm start demo.integration --silent && cd ..
[split.api.verify] [api.test] [api.test.unit] nps executing: cd api && npm start test.unit --silent && cd ..
[split.client.verify] [client.test] [client.test.unit] nps executing: cd client && npm start test.unit --silent && cd ..
[split.api.verify] [api.test] [api.test.integration] nps mongo.stop
[split.client.verify] [client.demo] [client.demo.unit.single] nps executing: cd client && npm start demo.unit --silent && cd ..
[split.e2e.verify] [e2e.loadDatabase] starting mongod with `mongod --dbpath ./.e2e/mongo-db --port 27018 &>/dev/null`
[split.e2e.verify] [build] [build.api] nps executing: cd api && npm start build --silent
[split.e2e.verify] [build] [build.client] nps executing: cd client && npm start build --silent
[split.api.verify] [api.demo] [api.demo.unit.single] nps executing: jest --config=demo/unit/jest.config.json
[split.api.verify] [api.demo] [api.demo.integration.single] nps executing: jest --config=demo/integration/jest.config.json
[split.client.verify] [client.test] [client.test.unit] nps executing: jest --config=tests/jest.config.unit.json --coverage
[split.client.verify] [client.demo] [client.demo.unit.single] nps executing: jest --config=demo/unit/jest.config.json
[split.client.verify] [client.demo] [client.demo.integration.single] nps executing: echo "no integration demo"
[split.client.verify] [client.test] [client.test.integration] nps executing: jest --config=tests/jest.config.integration.json --coverage
[split.client.verify] [client.test] [client.test.unit] /bin/sh: jest: command not found
[split.client.verify] [client.test] [client.test.integration] /bin/sh: jest: command not found
[split.client.verify] [client.test] [client.test.integration] The script called "test.integration" which runs "jest --config=tests/jest.config.integration.json --coverage" failed with exit code 127 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
[split.client.verify] [client.demo] [client.demo.integration.single] no integration demo
[split.client.verify] [client.test] [client.test.unit] The script called "test.unit" which runs "jest --config=tests/jest.config.unit.json --coverage" failed with exit code 127 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
[split.client.verify] [client.test] [client.test.integration] The script called "client.test.integration" which runs "cd client && npm start test.integration --silent && cd .." failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
[split.client.verify] [client.test] [client.test.unit] The script called "client.test.unit" which runs "cd client && npm start test.unit --silent && cd .." failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
[split.client.verify] [client.demo] [client.demo.integration.single] nps client.demo.integration.single exited with code 0
[split.client.verify] [client.test] [client.test.integration] nps client.test.integration exited with code 1
[split.client.verify] [client.test] --> Sending SIGTERM to other processes..
[split.client.verify] [client.demo] [client.demo.unit.single] /bin/sh: jest: command not found
[split.client.verify] [client.demo] [client.demo.unit.single] The script called "demo.unit" which runs "jest --config=demo/unit/jest.config.json" failed with exit code 127 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
[split.client.verify] [client.test] [client.test.unit] nps client.test.unit exited with code 1
[split.client.verify] [client.demo] [client.demo.unit.single] The script called "client.demo.unit.single" which runs "cd client && npm start demo.unit --silent && cd .." failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
[split.client.verify] [client.test] The script called "client.test" which runs "node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold" --prefix "[{name}]" --names "client.test.unit,client.test.integration" 'nps client.test.unit' 'nps client.test.integration'" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
[split.client.verify] [client.demo] [client.demo.unit.single] nps client.demo.unit.single exited with code 1
[split.client.verify] [client.test] nps client.test exited with code 1
[split.client.verify] --> Sending SIGTERM to other processes..
[split.client.verify] [client.demo] The script called "client.demo" which runs "node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold" --prefix "[{name}]" --names "client.demo.unit.single,client.demo.integration.single" 'nps client.demo.unit.single' 'nps client.demo.integration.single'" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
[split.client.verify] [client.demo] nps client.demo exited with code 1
[split.client.verify] The script called "split.client.verify" which runs "node node_modules/rimraf/bin.js client-final && split-guide generate --no-clean --templates-dir other/templates/client --exercises-dir node_modules/.tmp/client --exercises-final-dir client && node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold" --prefix "[{name}]" --names "client.test,client.demo" 'nps client.test' 'nps client.demo' && nps split.client" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
[split.client.verify] nps split.client.verify exited with code 1
--> Sending SIGTERM to other processes..
[split.api.verify] [api.test] [api.test.unit] nps executing: jest --config=tests/jest.config.unit.json --coverage
[split.api.verify] [api.test] [api.test.integration] [dev.mongo.silent] nps executing: nps mongo.silent
[split.e2e.verify] [build] [build.api] nps executing: node node_modules/rimraf/bin.js dist && babel --copy-files --out-dir dist --ignore __tests__,__mocks__ src
[split.e2e.verify] [build] [build.client] nps executing: react-scripts build
[split.api.verify] [api.test] [api.test.unit] nps api.test.unit exited with code null
[split.api.verify] [api.test] --> Sending SIGTERM to other processes..
[split.api.verify] [api.test] [api.test.integration] [dev.mongo.silent] nps dev.mongo.silent exited with code null
[split.api.verify] [api.test] [api.test.integration] --> Sending SIGTERM to other processes..
[split.api.verify] [api.test] [api.test.integration] [dev.api]  sleep 2 && cd api && npm start test.integration --silent && cd ..  exited with code null
[split.api.verify] [api.test] [api.test.integration] nps api.test.integration exited with code null
[split.api.verify] [api.test] nps api.test exited with code null
[split.api.verify] --> Sending SIGTERM to other processes..
[split.api.verify] [api.demo] [api.demo.integration.single] nps api.demo.integration.single exited with code null
[split.api.verify] [api.demo] --> Sending SIGTERM to other processes..
[split.e2e.verify] [e2e.loadDatabase] nps e2e.loadDatabase exited with code null
[split.e2e.verify] --> Sending SIGTERM to other processes..
[split.e2e.verify] [build] [build.api] nps build.api exited with code null
[split.e2e.verify] [build] --> Sending SIGTERM to other processes..
[split.api.verify] [api.demo] [api.demo.unit.single] nps api.demo.unit.single exited with code null
[split.api.verify] [api.demo] nps api.demo exited with code null
[split.api.verify] nps split.api.verify exited with code null
[split.e2e.verify] [build] [build.client] Creating an optimized production build...
[split.e2e.verify] [build] [build.client] Compiled with warnings.
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/index.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/store.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/app.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/reducer.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/middleware.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/screens/app.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/screens/editor.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/screens/login.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/screens/profile.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/screens/profile-favorites.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/screens/register.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/screens/settings.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/screens/article/index.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/screens/home/index.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/reducers/article.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/reducers/common.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/reducers/article-list.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/reducers/auth.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/reducers/editor.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/reducers/profile.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/reducers/home.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/reducers/profile-favorites.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/reducers/settings.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/shared/agent.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/shared/components/header.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/shared/components/list-errors.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/shared/containers/profile.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/screens/article/article-meta.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/screens/article/comment-container.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/screens/home/banner.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/screens/home/main-view.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/screens/home/tags.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/shared/components/article-list.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/screens/article/comment-input.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/screens/article/comment-list.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/screens/article/article-actions.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/shared/components/article-preview.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/shared/components/list-paginati
[split.e2e.verify] on.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/screens/article/comment.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] ./src/screens/article/delete-button.js
[split.e2e.verify] [build] [build.client]   Line 1:  Definition for rule 'jsx-a11y/alt-text' was not found  jsx-a11y/alt-text
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] Search for the keywords to learn more about each warning.
[split.e2e.verify] [build] [build.client] To ignore, add // eslint-disable-next-line to the line before.
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] File sizes after gzip:
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client]   91.12 KB  build/static/js/main.99932159.js
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] The project was built assuming it is hosted at the server root.
[split.e2e.verify] [build] [build.client] To override this, specify the homepage in your package.json.
[split.e2e.verify] [build] [build.client] For example, add this to build it for GitHub Pages:
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client]   "homepage" : "http://myname.github.io/myapp",
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] The build folder is ready to be deployed.
[split.e2e.verify] [build] [build.client] You may serve it with a static server:
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client]   yarn global add serve
[split.e2e.verify] [build] [build.client]   serve -s build
[split.e2e.verify] [build] [build.client] 
[split.e2e.verify] [build] [build.client] nps build.client exited with code null
[split.e2e.verify] [build] nps build exited with code null
[split.e2e.verify] nps split.e2e.verify exited with code null
The script called "validate" which runs "nps lint && node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold,bgGreen.bold" --prefix "[{name}]" --names "split.api.verify,split.client.verify,split.e2e.verify" 'nps split.api.verify' 'nps split.client.verify' 'nps split.e2e.verify'" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code

The output when I run sudo npm start dev.api

nps is executing `dev.mongo`: nps mongo
nps is executing `mongo`: mkdirp .mongo-db && nps mongo.start
nps is executing `mongo.start`: mongod --dbpath "/Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/.mongo-db"
2017-06-16T12:45:02.255+0200 I CONTROL  [initandlisten] MongoDB starting : pid=10136 port=27017 dbpath=/Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/.mongo-db 64-bit host=MBP-Szymon.bn.org.pl
2017-06-16T12:45:02.255+0200 I CONTROL  [initandlisten] db version v3.4.4
2017-06-16T12:45:02.255+0200 I CONTROL  [initandlisten] git version: 888390515874a9debd1b6c5d36559ca86b44babd
2017-06-16T12:45:02.255+0200 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2l  25 May 2017
2017-06-16T12:45:02.255+0200 I CONTROL  [initandlisten] allocator: system
2017-06-16T12:45:02.255+0200 I CONTROL  [initandlisten] modules: none
2017-06-16T12:45:02.255+0200 I CONTROL  [initandlisten] build environment:
2017-06-16T12:45:02.255+0200 I CONTROL  [initandlisten]     distarch: x86_64
2017-06-16T12:45:02.255+0200 I CONTROL  [initandlisten]     target_arch: x86_64
2017-06-16T12:45:02.255+0200 I CONTROL  [initandlisten] options: { storage: { nps executing: cd api && npm start dev --silent
nps executing: nodemon --watch ./src --exec babel-node ./src
[nodemon] 1.11.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/api/src/**/*
[nodemon] starting `babel-node ./src`
module.js:471
    throw err;
    ^

Error: Cannot find module 'unicode/category/So'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at symbols (/Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/api/node_modules/slug/slug.js:6:16)
    at /Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/api/node_modules/slug/slug.js:199:5
    at Object.<anonymous> (/Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/api/node_modules/slug/slug.js:212:2)
    at Module._compile (module.js:570:32)
    at Module._extensions..js (module.js:579:10)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/api/node_modules/babel-register/lib/node.js:152:7)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/szymonhernik/Documents/CODE/FrontendMasters/Tests_JS/testing-workshop-master/api/src/models/article.js:3:1)
[nodemon] app crashed - waiting for file changes before starting...

Suggested solution:

I have no idea how to help myself...

Old MongoDB path hardcoded on Windows

Environment info:

Windows 10, x64

  • mongo version (mongod --version): 3.4.2
  • node version (node --version): 7.4.0
  • npm version (npm --version): 4.0.5
  • yarn version (yarn --version): 0.20.3

Problem description:

  • Ran npm run setup
  • Received an error when it tried to verify my mongo installation:
The system cannot find the path specified.
there was an error determining your mongo version
{ Error: Command failed: "C:/Program Files/MongoDb/Server/3.2/bin/mongod.exe" --version
The system cannot find the path specified.

verify.js is looking for a hardcoded mongo path at line 74.

Suggested solution:

Not too sure, Windows is pretty tricky for stuff like this.

SyntaxError: Unexpected token import

Environment info:

  • node version (node --version): 8.11.3
  • npm version (npm --version): 5.6.0
  • yarn version (yarn --version): 1.5.1

Problem description:

Unable to write any unit tests because:
npm run setup --silent
npm run test:react
In other/simple-react/__tests__/item-list.todo.js, I added import React from 'react'
output from jest:

/testing-workshop/other/simple-react/__tests__/item-list.todo.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import React from 'react';

SyntaxError: Unexpected token import

This error is also thrown during npm run setup --silent along with

/testing-workshop/client/test/setup-test-framework.js: Using `babel-preset-react-app` requires that you specify `NODE_ENV` or `BABEL_ENV` environment variables. Valid values are "development", "test", and "production". Instead, received: "staging". (While processing: "/testing-workshop/client/node_modules/babel-preset-react-app/index.js")

I tried running NODE_ENV=development and NODE_ENV=production. Output from those commands were differnent, but npm run test:react` fails with the same error.

Suggested solution:

setup also solves exercise 01

Coming from FEM
https://frontendmasters.com/courses/testing-javascript/

Environment info:

  • node version (node --version): v8.11.1
  • npm version (npm --version): 5.6.0
  • yarn version (yarn --version): 1.6.0 (I'm using npm like the workshop)

Problem description:
Setup doesn't work, or solves exercise 01.

Scenario A:

git clone https://github.com/kentcdodds/testing-workshop.git
cd testing-workshop
npm run setup --silent
git checkout fem
npm run dev # (works)
npm run start api.unit # throws nps not found

Scenario B:

git clone https://github.com/kentcdodds/testing-workshop.git
cd testing-workshop
git checkout fem # notice this has been moved BEFORE setup
npm run setup --silent
npm run dev # works
npm run start api.unit # works

But exercise 01 is already solved, and I'm guessing others as well.

// api/src/routes/utils/__tests__/get-token-from-header.js
import getTokenFromHeader from '../get-token-from-header'

test('getTokenFromHeader returns null if there is no token', () => {
  const result = getTokenFromHeader({headers: {}})
  expect(result).toBe(null)
})

test('getTokenFromHeader returns the token from the headers', () => {
  const token = 'hi.mom!'
  const authHeader = `Token ${token}`
  const req = {
    headers: {
      authorization: authHeader,
    },
  }

  const result = getTokenFromHeader(req)
  expect(result).toBe(token)
})
test('I submitted my elaboration and feedback', () => {
  const submitted = true
  expect(true).toBe(submitted)
})

To clarify, I haven't touche a single line of code yet.

running git diff yields the following:

	deleted:    api-final/.eslintrc
	deleted:    api-final/demo/integration/__tests__/users.js
	deleted:    api-final/demo/unit/__tests__/get-age.js
	deleted:    api-final/demo/unit/__tests__/make-me-a-sandwich.js
	deleted:    api-final/demo/unit/__tests__/sum.js
	deleted:    api-final/demo/unit/get-age.js
	deleted:    api-final/demo/unit/sum.js
	deleted:    api-final/src/models/__tests__/user.js
	deleted:    api-final/src/models/user.js
	deleted:    api-final/src/routes/utils/__tests__/arrayify.js
	deleted:    api-final/src/routes/utils/__tests__/get-token-from-header.js
	deleted:    api-final/src/routes/utils/arrayify.js
	deleted:    api-final/src/routes/utils/get-token-from-header.js
	deleted:    api-final/tests/integration/articles.test.js
	modified:   api/demo/integration/__tests__/users.js
	modified:   api/demo/unit/__tests__/get-age.js
	modified:   api/demo/unit/__tests__/make-me-a-sandwich.js
	modified:   api/demo/unit/__tests__/sum.js
	modified:   api/demo/unit/get-age.js
	modified:   api/demo/unit/sum.js
	modified:   api/src/models/__tests__/user.js
	modified:   api/src/models/user.js
	modified:   api/src/routes/utils/__tests__/arrayify.js
	modified:   api/src/routes/utils/__tests__/get-token-from-header.js
	modified:   api/src/routes/utils/arrayify.js
	modified:   api/tests/integration/articles.test.js
	deleted:    cypress-final/.eslintrc
	deleted:    cypress-final/e2e/users_spec.js
	modified:   cypress/.eslintrc
	modified:   cypress/e2e/users_spec.js

Schedule

Hey friends ๐Ÿ‘‹

There are 5 things that we'll be doing during this workshop:

  • API Unit Tests
  • API Integration Tests
  • Client Unit Tests
  • Client Integration Tests
  • E2E Tests

I'm pretty solid on the general order: Unit -> Integration -> E2E

But I'm unsure of whether I should do both the API tests together then both the Client tests together, or if I should do both Unit tests together and both the Integration tests together. So I have two options. Please respond with the respective emoji:

โค๏ธ

  1. API Unit Tests
  2. API Integration Tests
  3. Client Unit Tests
  4. Client Integration Tests
  5. E2E Tests

๐ŸŽ‰

  1. API Unit Tests
  2. Client Unit Tests
  3. API Integration Tests
  4. Client Integration Tests
  5. E2E Tests

Thanks!

Changing axios instance defaults after its created seem buggy

seem to alter other instances as well

const authApi = axios.create({
    baseURL
});
authApi.defaults.headers.common.Authorization = `Bearer ${registeredUser.token}`;

works

const authApi = axios.create({
    baseURL,
    headers: {Authorization: `Bearer ${registeredUser.token}`}
});

initial npm run setup --silent returns numerous errors

Environment info:

  • mongo version (mongod --version): v3.4.9
  • node version (node --version): v8.4.0
  • npm version (npm --version): 5.3.0
  • yarn version (yarn --version): 1.0.1

Problem description:

I ran npm run setup --silent in a clean testing-workshop repo cloned from master. Numerous errors came back during the setup.

e.g.

"The script called "demo.integration" which runs "jest --config=demo/integration/jest.config.json" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.4/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code"

"[api.demo.integration.single] The script called "api.demo.integration.single" which runs "cd api && npm start demo.integration --silent && cd .." failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code"

"The script called "api.demo" which runs "node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold" --prefix "[{name}]" --names "api.demo.unit.single,api.demo.integration.single" 'nps api.demo.unit.single' 'nps api.demo.integration.single'" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code"

"The script called "split.api.verify" which runs "node node_modules/rimraf/bin.js api-final && split-guide generate --no-clean --templates-dir other/templates/api --exercises-dir node_modules/.tmp/api --exercises-final-dir api && node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold" --prefix "[{name}]" --names "api.test,api.demo" 'nps api.test' 'nps api.demo' && nps split.api" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code"

"The script called "validate" which runs "nps lint && node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold,bgGreen.bold" --prefix "[{name}]" --names "split.api.verify,split.client.verify,split.e2e.verify" 'nps split.api.verify' 'nps split.client.verify' 'nps split.e2e.verify'" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code"

Suggested solution:

[test:coverage] Unable to process function body node type: ArrowFunctionExpression

Environment info:

Tested in 2 systems:

Macbook Pro with 10.11.6 (El Capitan)

  • node version (node --version): 8.9.4
  • npm version (npm --version): 5.6.0
  • yarn version (yarn --version): 1.3.2

PC HP Touchsmart 600 with Windows 10

  • node version (node --version): 8.9.4
  • npm version (npm --version): 5.6.0

Problem description:

When running `test:coverage, I get this messages:
[test:coverage] Unable to process function body node type: ArrowFunctionExpression
[test:coverage] Unable to process function body node type: ArrowFunctionExpression
.....................................

Test are apparently completed (test results show all tests passed)

Suggested solution:

Looks like it's related to this...
istanbuljs/istanbuljs#119

Incorrect 'fem' branch file tree

Problem description:

fem branch does not have file tree structure as shown in FEM workshop videos.

Suggested solution:

Either update fem branch to correct file tree structure, or eliminate suggestion in README.md for FEM users to use the 'fem' branch instead of 'master'.

Project Testers and feedback needed!

Hey folks ๐Ÿ‘‹

I have a few needs for this project!

  1. Test to make sure it works on various machines/environments (should take just a few minutes) ๐ŸŽ๐Ÿ’จ
  2. Feedback on the content of the workshop (a bit more of a commitment) ๐Ÿข๐Ÿ’จ

Project testing

I could use a hand making sure this project can run on anyone's computer and is intuitive to set up. If there is a problem with your environment, this project should hopefully provide enough context for you to fix the problem on your own.

I especially need testers on Windows and Linux machines because I work exclusively on a Mac ๐ŸŽ.

Instructions:

I'm not going to explain how to set up the project in this issue. Please just follow the instructions on the README. If something's unclear or you experience issues, please file a new issue about itโ—๏ธ If everything goes well for you, please add an emoji reaction to this comment of ๐Ÿ‘. Thanks so much!

Feedback

After you've set up the project, if you'd like to go through some of the tests, please do so. Note that the testing is not yet split up for exercises/quizzes/workshoppy things yet. It's all just tests like a normal app would be. In the next few weeks I'll be splitting things up to make them conducive to the workshop experience.

Instructions:

Because this workshop is instructor led, there are no instructions on how all the scripts work. So just pull up the root package.json and look at the available scripts. Hopefully that should be enough to get you going. The most important scripts though are:

  • npm run test to run the client/server unit/integration tests in watch mode
  • npm run test:e2e to run the cypress tests in development mode

If anything is unclear ๐Ÿค” to you about how things work or why I made certain decisions, or if you disagree ๐Ÿ™… with some of my decisions, please feel free to file an issue and make suggestions or ask questions. I make no promises I'll follow your suggestions, or even take the time to justify my position (I'm very limited on my time). I'll try though :)

Thanks! ๐Ÿ™

Thank you so much for taking the time to help me out with this! I'll be giving part of this workshop at Assert(js) later this month. Then I'll be giving it in March in San Francisco (details forthcoming), and in April for Frontend Masters! ๐Ÿ•ถ

[npm run test:e2e:run] CypressError: Timed out retrying: expected 'http://localhost:8001/login' to equal 'http://localhost:8001/'

Environment info:

Macbook Pro with 10.11.6 (El Capitan)
node version (node --version): 8.9.4
npm version (npm --version): 5.6.0
yarn version (yarn --version): 1.3.2

Also tested in a PC with Windows 10 without errors.

Problem description:

When I run npm run test:e2e:run, I get this error first and then some more.

$ npm run test:e2e:run

> [email protected] pretest:e2e:run /Users/aiglesias/Coding/react/testing-workshop
> npm run build --silent

[server] src/auth.js -> dist/auth.js
[server] src/controllers/auth.js -> dist/controllers/auth.js
[server] src/controllers/posts.js -> dist/controllers/posts.js
[server] src/controllers/users.js -> dist/controllers/users.js
[server] src/db.js -> dist/db.js
[server] src/index.js -> dist/index.js
[server] src/routes/auth.js -> dist/routes/auth.js
[server] src/routes/index.js -> dist/routes/index.js
[server] src/routes/posts.js -> dist/routes/posts.js
[server] src/routes/users.js -> dist/routes/users.js
[server] src/start.js -> dist/start.js
[server] npm run build:server --silent exited with code 0
[client] Creating an optimized production build...
[client] Compiled successfully.
[client]
[client] File sizes after gzip:
[client]
[client]   71.01 KB  build/static/js/main.c199a80a.js
[client]   390 B     build/static/css/main.580cbb02.css
[client]
[client] The project was built assuming it is hosted at the server root.
[client] You can control this with the homepage field in your package.json.
[client] For example, add this to build it for GitHub Pages:
[client]
[client]   "homepage" : "http://myname.github.io/myapp",
[client]
[client] The build folder is ready to be deployed.
[client] You may serve it with a static server:
[client]
[client]   npm install -g serve
[client]   serve -s build
[client]
[client] Find out more about deployment here:
[client]
[client]   http://bit.ly/2vY88Kr
[client]
[client] Built the bundle with browser support for >1%, last 4 versions, Firefox ESR, not ie < 11.
[client] npm run build:client --silent exited with code 0

> [email protected] test:e2e:run /Users/aiglesias/Coding/react/testing-workshop
> as-a E2E npm-run-all --parallel --race start:core cy:run


> [email protected] cy:run /Users/aiglesias/Coding/react/testing-workshop
> cypress run


> [email protected] start:core /Users/aiglesias/Coding/react/testing-workshop
> concurrently --names "server,client" --prefix "[{name}]" --prefix-colors "bgCyan.reset.bold,bgGreen.reset.bold" "npm run start:server --silent" "npm run start:client --silent"

[client] serve: Running on port 8001
[server] Listening on port 3001

Started video recording: /Users/aiglesias/Coding/react/testing-workshop/cypress/videos/kjkln.mp4

  (Tests Starting)

  authentication
    โœ“ should allow users to register (4715ms)
    1) should allow existing users to login

  authentication
    โœ“ should allow existing users to login (7810ms)


  2 passing (28s)
  1 failing

  1) authentication should allow existing users to login:
     CypressError: Timed out retrying: expected 'http://localhost:8001/login' to equal 'http://localhost:8001/'
      at Object.cypressErr (http://localhost:8001/__cypress/runner/cypress_runner.js:65859:11)
      at Object.throwErr (http://localhost:8001/__cypress/runner/cypress_runner.js:65824:18)
      at Object.throwErrByPath (http://localhost:8001/__cypress/runner/cypress_runner.js:65851:17)
      at retry (http://localhost:8001/__cypress/runner/cypress_runner.js:59963:16)
      at http://localhost:8001/__cypress/runner/cypress_runner.js:52481:18
      at tryCatcher (http://localhost:8001/__cypress/runner/cypress_runner.js:6268:23)
      at Promise._settlePromiseFromHandler (http://localhost:8001/__cypress/runner/cypress_runner.js:4290:31)
      at Promise._settlePromise (http://localhost:8001/__cypress/runner/cypress_runner.js:4347:18)
      at Promise._settlePromise0 (http://localhost:8001/__cypress/runner/cypress_runner.js:4392:10)
      at Promise._settlePromises (http://localhost:8001/__cypress/runner/cypress_runner.js:4467:18)
      at Async._drainQueue (http://localhost:8001/__cypress/runner/cypress_runner.js:1200:16)
      at Async._drainQueues (http://localhost:8001/__cypress/runner/cypress_runner.js:1210:10)
      at Async.drainQueues (http://localhost:8001/__cypress/runner/cypress_runner.js:1084:14)


  (Tests Finished)

  - Tests:           3
  - Passes:          2
  - Failures:        1
  - Pending:         0
  - Duration:        28 seconds
  - Screenshots:     1
  - Video Recorded:  true
  - Cypress Version: 1.4.1


  (Screenshots)

  - /Users/aiglesias/Coding/react/testing-workshop/cypress/screenshots/authentication -- should allow existing users to login.png (1280x720)


  (Video)

  - Started processing:   Compressing to 32 CRF
  - Finished processing:  /Users/aiglesias/Coding/react/testing-workshop/cypress/videos/kjkln.mp4 (26 seconds)


  (All Done)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] cy:run: `cypress run`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] cy:run script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/aiglesias/.npm/_logs/2018-02-02T17_24_23_397Z-debug.log
[server] npm run start:server --silent exited with code null
[client] npm run start:client --silent exited with code null
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start:core: `concurrently --names "server,client" --prefix "[{name}]" --prefix-colors "bgCyan.reset.bold,bgGreen.reset.bold" "npm run start:server --silent" "npm run start:client --silent"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start:core script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/aiglesias/.npm/_logs/2018-02-02T17_24_23_738Z-debug.log
ERROR: "cy:run" exited with 1.
npm-run-all exit code 1
Error: npm-run-all exit code 1
    at ChildProcess.proc.on (/Users/aiglesias/Coding/react/testing-workshop/node_modules/as-a/src/run-command.js:38:23)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 255
npm ERR! [email protected] test:e2e:run: `as-a E2E npm-run-all --parallel --race start:core cy:run`
npm ERR! Exit status 255
npm ERR!
npm ERR! Failed at the [email protected] test:e2e:run script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/aiglesias/.npm/_logs/2018-02-02T17_24_23_841Z-debug.log

Suggested solution:

Issue installing/running on Windows 10

Problem description:
Install process cmd results: https://gist.github.com/samiff/ea037fe173405ae3e864a2bd824dd579
Following along from this FEM video.

I'm able to run npm start dev eventually and the site loads up, but no API data loads because the database has been created but empty. I'm a new developer used to dealing with scripts from a package.json, so I'm unsure where to troubleshoot from here. Could the following be part of the problem?

generating and inserting data with `cd api && ./node_modules/.bin/babel-node scripts/generate`
'.' is not recognized as an internal or external command,
operable program or batch file.

[HELP]: Test setup

Hey friends! I could use some help getting the setup for this thing tested! If you could please follow the instructions in the README and let me know:

  1. Are they clear?
  2. Does it work? (If not, please file an issue for the issue you're seeing)
  3. What system are you on?
  4. How could it be improved?

Thanks!

"npm dev start" fails with errors on Windows 10 Pro

I was just testing with Windows 10 Pro as requested by Kent on Twitter.

Environment info:

  • mongo version (mongod --version): 3.4.3
  • node version (node --version): 6.10.2
  • npm version (npm --version): 4.4.4
  • yarn version (yarn --version): Not installed.

Problem description:

This is the output from the dev server startup:

[dev.mongo] The script called "mongo.start" which runs "mongod --dbpath D:\tmp\Kent Dodd's Test\testing-workshop\.mongo-db" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
[dev.mongo] The script called "mongo" which runs "mkdirp .mongo-db && echo nps mongo.start && nps mongo.start > NUL" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
[dev.api] Listening on port 3000
[dev.api]
[dev.api] events.js:160
[dev.api]       throw er; // Unhandled 'error' event
[dev.api]       ^
[dev.api] MongoError: failed to connect to server [localhost:27017] on first connect [MongoError: connect ECONNREFUSED 127.0.0.1:27017]
[dev.api]     at Pool.<anonymous> (D:\tmp\Kent Dodd's Test\testing-workshop\api\node_modules\mongodb-core\lib\topologies\server.js:327:35)
[dev.api]     at emitOne (events.js:96:13)
[dev.api]     at Pool.emit (events.js:188:7)
[dev.api]     at Connection.<anonymous> (D:\tmp\Kent Dodd's Test\testing-workshop\api\node_modules\mongodb-core\lib\connection\pool.js:274:12)
[dev.api]     at Connection.g (events.js:291:16)
[dev.api]     at emitTwo (events.js:106:13)
[dev.api]     at Connection.emit (events.js:191:7)
[dev.api]     at Socket.<anonymous> (D:\tmp\Kent Dodd's Test\testing-workshop\api\node_modules\mongodb-core\lib\connection\connection.js:177:49)
[dev.api]     at Socket.g (events.js:291:16)
[dev.api]     at emitOne (events.js:96:13)
[dev.api]     at Socket.emit (events.js:188:7)
[dev.api]     at emitErrorNT (net.js:1281:8)
[dev.api]     at _combinedTickCallback (internal/process/next_tick.js:80:11)
[dev.api]     at process._tickDomainCallback (internal/process/next_tick.js:128:9)
[dev.api] [nodemon] app crashed - waiting for file changes before starting...
[dev.client] Compiled successfully!
[dev.client]
[dev.client] The app is running at:
[dev.client]
[dev.client]   http://localhost:8080/
[dev.client]
[dev.client] Note that the development build is not optimized.
[dev.client] To create a production build, use yarn run build.
[dev.client]
[dev.mongo]
[dev.mongo] โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
[dev.mongo] โ”‚                     npm update check failed                     โ”‚
[dev.mongo] โ”‚               Try running with sudo or get access               โ”‚
[dev.mongo] โ”‚              to the local update config store via               โ”‚
[dev.mongo] โ”‚ sudo chown -R $USER:$(id -gn $USER) C:\Users\s.molinari\.config โ”‚
[dev.mongo] โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
[dev.mongo] The script called "dev.mongo" which runs "npm start mongo --silent" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
[dev.mongo] nps dev.mongo exited with code 1
--> Sending SIGTERM to other processes..
[dev.client] nps dev.client exited with code 1
[dev.api] nps dev.api exited with code 1
The script called "dev" which runs "node node_modules\concurrently\src\main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold,bgGreen.bold" --prefix "[{name}]" --names "dev.mongo,dev.client,dev.api" "nps dev.mongo" "nps dev.client" "nps dev.api"" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `nps "dev"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'nps "dev"'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the testing-workshop package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     nps "dev"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs testing-workshop
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls testing-workshop
npm ERR! There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\s.molinari\AppData\Roaming\npm-cache\_logs\2017-04-11T18_52_21_155Z-debug.log

This is the info from the debug log:

0 info it worked if it ends with ok
1 verbose cli [ 'D:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\s.molinari\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'start',
1 verbose cli   'dev' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 silly lifecycle [email protected]~prestart: no script for prestart, continuing
7 info lifecycle [email protected]~start: [email protected]
8 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~start: PATH: C:\Users\s.molinari\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin;D:\tmp\Kent Dodd's Test\testing-workshop\node_modules\.bin;C:\Users\s.molinari\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\s.molinari\bin;D:\Programme\Cmdr\vendor\conemu-maximus5\ConEmu\Scripts;D:\Programme\Cmdr\vendor\conemu-maximus5;D:\Programme\Cmdr\vendor\conemu-maximus5\ConEmu;C:\Program Files\Docker\Docker\Resources\bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\OpenVPN\bin;C:\Program Files (x86)\Common Files\Acronis\SnapAPI;C:\Program Files (x86)\GNU\GnuPG\pub;C:\ProgramData\ComposerSetup\bin;C:\server\bin\php;C:\server\bin\php\PEAR;C:\Program Files\Microsoft Network Monitor 3;C:\Program Files (x86)\QuickTime\QTSystem;D:\Programme\Git\mingw64\bin;C:\HashiCorp\Vagrant\bin;D:\wamp64\bin\php\php7.0.10;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit;C:\Python27;C:\Program Files\Microsoft SQL Server\110\Tools\Binn;C:\Program Files\Microsoft SQL Server\120\Tools\Binn;C:\Program Files\MongoDB\Server\3.4\bin;C:\Program Files (x86)\Skype\Phone;D:\Program Files\nodejs;C:\server\php\bin;C:\packer;D:\Programme\Git\mingw64\bin;C:\Users\s.molinari\AppData\Local\Microsoft\WindowsApps;C:\Users\s.molinari\AppData\Local\atom\bin;D:\wamp64\bin\php\php7.0.10;C:\Python27;C:\Users\s.molinari\AppData\Roaming\npm;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl
10 verbose lifecycle [email protected]~start: CWD: D:\tmp\Kent Dodd's Test\testing-workshop
11 silly lifecycle [email protected]~start: Args: [ '/d /s /c', 'nps "dev"' ]
12 silly lifecycle [email protected]~start: Returned: code: 1  signal: null
13 info lifecycle [email protected]~start: Failed to exec start script
14 verbose stack Error: [email protected] start: `nps "dev"`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (C:\Users\s.molinari\AppData\Roaming\npm\node_modules\npm\lib\utils\lifecycle.js:279:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:191:7)
14 verbose stack     at ChildProcess.<anonymous> (C:\Users\s.molinari\AppData\Roaming\npm\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:191:7)
14 verbose stack     at maybeClose (internal/child_process.js:886:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid [email protected]
16 verbose cwd D:\tmp\Kent Dodd's Test\testing-workshop
17 verbose Windows_NT 10.0.14393
18 verbose argv "D:\\Program Files\\nodejs\\node.exe" "C:\\Users\\s.molinari\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start" "dev"
19 verbose node v6.10.2
20 verbose npm  v4.4.4
21 error code ELIFECYCLE
22 error errno 1
23 error [email protected] start: `nps "dev"`
23 error Exit status 1
24 error Failed at the [email protected] start script 'nps "dev"'.
24 error Make sure you have the latest version of node.js and npm installed.
24 error If you do, this is most likely a problem with the testing-workshop package,
24 error not with npm itself.
24 error Tell the author that this fails on your system:
24 error     nps "dev"
24 error You can get information on how to open an issue for this project with:
24 error     npm bugs testing-workshop
24 error Or if that isn't available, you can get their info via:
24 error     npm owner ls testing-workshop
24 error There is likely additional logging output above.
25 verbose exit [ 1, true ]

Suggested solution:

Looks like the app didn't get MongoDB started. If I have some time, I'll try to dig a bit deeper.

Scott

ReferenceError in master branch for test:react

Environment info:

  • node version (node --version): 8.11.1
  • npm version (npm --version): 5.6.0
  • yarn version (yarn --version): 1.5.1

Problem description: Just starting the new FEM React Testing course, when running npm run test:react for the very first test, I get an error about an unknown plugin "syntax-dynamic-import".

 FAIL   react  other\simple-react\__tests__\item-list.todo.js
  โ— Test suite failed to run

    ReferenceError: Unknown plugin "syntax-dynamic-import" specified in "C:\\workspace\\react\\testing-workshop\\other\\configuration\\calculator.solution\\.babelrc.js" at 0, attempted to resolve relative to "C:\\workspace\\react\\testing-workshop\\other\\configuration\\calculator.solution" (While processing preset: "C:\\workspace\\react\\testing-workshop\\other\\configuration\\calculator.solution\\.babelrc.js")

      at ../../node_modules/babel-core/lib/transformation/file/options/option-manager.js:180:17
          at Array.map (<anonymous>)
      at Function.normalisePlugins (../../node_modules/babel-core/lib/transformation/file/options/option-manager.js:158:20)
      at OptionManager.mergeOptions (../../node_modules/babel-core/lib/transformation/file/options/option-manager.js:234:36)
      at ../../node_modules/babel-core/lib/transformation/file/options/option-manager.js:265:14
      at ../../node_modules/babel-core/lib/transformation/file/options/option-manager.js:323:22
          at Array.map (<anonymous>)
      at OptionManager.resolvePresets (../../node_modules/babel-core/lib/transformation/file/options/option-manager.js:275:20)
      at OptionManager.mergePresets (../../node_modules/babel-core/lib/transformation/file/options/option-manager.js:264:10)
      at OptionManager.mergeOptions (../../node_modules/babel-core/lib/transformation/file/options/option-manager.js:249:14)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        2.096s
Ran all test suites related to changed files.

Continuing on - I don't see any of the 4 babel plugins found in \other\configuration\calculator.solution\.babelrc.js, so I added them myself. This time, a different error comes up after running npm run test:react

 FAIL   react  other\simple-react\__tests__\item-list.todo.js
  โ— Test suite failed to run

    ReferenceError: [BABEL] C:\workspace\react\testing-workshop\other\simple-react\__tests__\item-list.todo.js: Unknown option: C:\workspace\react\testing-workshop\node_modules\react\index.js.Children. Check out http://babeljs.io/docs/usage/options/ for more information about options.

    A common cause of this error is the presence of a configuration options object without the corresponding preset name. Example:

    Invalid:
      `{ presets: [{option: value}] }`
    Valid:
      `{ presets: [['presetName', {option: value}]] }`

    For more detailed information on preset configuration, please see https://babeljs.io/docs/en/plugins#pluginpresets-options. (While processing preset: "C:\\workspace\\react\\testing-workshop\\node_modules\\react\\index.js") (While processing preset: "C:\\workspace\\react\\testing-workshop\\other\\configuration\\calculator.solution\\.babelrc.js")

      at Logger.error (../../node_modules/babel-core/lib/transformation/file/logger.js:41:11)
      at OptionManager.mergeOptions (../../node_modules/babel-core/lib/transformation/file/options/option-manager.js:226:20)
      at ../../node_modules/babel-core/lib/transformation/file/options/option-manager.js:265:14
      at ../../node_modules/babel-core/lib/transformation/file/options/option-manager.js:323:22
          at Array.map (<anonymous>)
      at OptionManager.resolvePresets (../../node_modules/babel-core/lib/transformation/file/options/option-manager.js:275:20)
      at OptionManager.mergePresets (../../node_modules/babel-core/lib/transformation/file/options/option-manager.js:264:10)
      at OptionManager.mergeOptions (../../node_modules/babel-core/lib/transformation/file/options/option-manager.js:249:14)
      at ../../node_modules/babel-core/lib/transformation/file/options/option-manager.js:265:14
      at ../../node_modules/babel-core/lib/transformation/file/options/option-manager.js:323:22

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        3.412s
Ran all test suites related to changed files.

Not sure what to do - any guidance would be appreciated!

Errors on Node v9.3

Environment info:

  • node version (node --version): 9.3.0
  • npm version (npm --version): 5.6.0
  • yarn version (yarn --version): -

Problem description:

This is related to #49. ๐Ÿ™‚

I'm getting this when I run npm run setup --silent

โฏ npm run setup --silent
There is an issue with your system.
  - Your version of node (9.3.0) does not satisfy the desired range of ^8.4.0. Please install a version within the range. You can use http://git.io/nvm or https://github.com/coreybutler/nvm-windows to make changing your version of node easier.

If you don't care about these warnings, go ahead and install dependencies with `node ./scripts/install`

Also on a related note, The README says any node version 8.9.4 and npm version 5.6.0. However, verify.js still points to 8.4+ and 5.4.1+ respectively. Not sure if it's a biggie, but still a discrepancy between the the verifier and the README. ๐Ÿ˜„

Server not getting started on `yarn start dev`

Environment info:

  • mongo version (mongod --version): 3.4.10
  • node version (node --version): 8.6.0
  • npm version (npm --version): 5.3.0
  • yarn version (yarn --version): 1.2.1

Problem description:

While running yarn start dev the server did not get started and I got this stack trace

yarn run v1.2.1
$ nps dev
nps executing: node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold,bgGreen.bold" --prefix "[{name}]" --names "dev.mongo,dev.client,dev.api" 'nps dev.mongo' 'nps dev.client' 'nps dev.api'
[dev.client] nps executing: cd client && npm start dev --silent
[dev.mongo] nps executing: nps mongo
[dev.api] nps executing: cd api && npm start dev --silent
[dev.mongo] nps executing: mkdirp .mongo-db && nps mongo.start
[dev.mongo] nps executing: mongod --dbpath "/Users/anandpandey/Documents/Learning/React/testing-workshop/.mongo-db"
[dev.api] nps executing: nodemon --watch ./src --exec babel-node ./src
[dev.mongo] 2017-11-20T12:56:14.756+0530 I CONTROL  [initandlisten] MongoDB starting : pid=37652 port=27017 dbpath=/Users/anandpandey/Documents/Learning/React/testing-workshop/.mongo-db 64-bit host=Anands-MacBook-Pro.local
[dev.mongo] 2017-11-20T12:56:14.757+0530 I CONTROL  [initandlisten] db version v3.4.10
[dev.mongo] 2017-11-20T12:56:14.757+0530 I CONTROL  [initandlisten] git version: 078f28920cb24de0dd479b5ea6c66c644f6326e9
[dev.mongo] 2017-11-20T12:56:14.757+0530 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2m  2 Nov 2017
[dev.mongo] 2017-11-20T12:56:14.757+0530 I CONTROL  [initandlisten] allocator: system
[dev.mongo] 2017-11-20T12:56:14.757+0530 I CONTROL  [initandlisten] modules: none
[dev.mongo] 2017-11-20T12:56:14.757+0530 I CONTROL  [initandlisten] build environment:
[dev.mongo] 2017-11-20T12:56:14.757+0530 I CONTROL  [initandlisten]     distarch: x86_64
[dev.mongo] 2017-11-20T12:56:14.757+0530 I CONTROL  [initandlisten]     target_arch: x86_64
[dev.mongo] 2017-11-20T12:56:14.757+0530 I CONTROL  [initandlisten] options: { storage: { dbPath: "/Users/anandpandey/Documents/Learning/React/testing-workshop/.mongo-db" } }
[dev.mongo] 2017-11-20T12:56:14.758+0530 I -        [initandlisten] Detected data files in /Users/anandpandey/Documents/Learning/React/testing-workshop/.mongo-db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
[dev.mongo] 2017-11-20T12:56:14.758+0530 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=3584M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
[dev.mongo] 2017-11-20T12:56:14.759+0530 E STORAGE  [initandlisten] WiredTiger error (13) [1511162774:759664][37652:0x7fffd5e343c0], file:WiredTiger.wt, connection: /Users/anandpandey/Documents/Learning/React/testing-workshop/.mongo-db/WiredTiger.turtle: handle-open: open: Permission denied
[dev.client] nps executing: node node_modules/cross-env/dist/bin/cross-env.js PORT=8080 react-scripts start
[dev.mongo] 2017-11-20T12:56:14.770+0530 I -        [initandlisten] Assertion: 28595:13: Permission denied src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 276
[dev.mongo] 2017-11-20T12:56:14.770+0530 I STORAGE  [initandlisten] exception in initAndListen: 28595 13: Permission denied, terminating
[dev.mongo] 2017-11-20T12:56:14.770+0530 I NETWORK  [initandlisten] shutdown: going to close listening sockets...
[dev.mongo] 2017-11-20T12:56:14.770+0530 I NETWORK  [initandlisten] removing socket file: /tmp/mongodb-27017.sock
[dev.mongo] 2017-11-20T12:56:14.770+0530 I NETWORK  [initandlisten] shutdown: going to flush diaglog...
[dev.mongo] 2017-11-20T12:56:14.771+0530 I CONTROL  [initandlisten] now exiting
[dev.mongo] 2017-11-20T12:56:14.771+0530 I CONTROL  [initandlisten] shutting down with code:100
[dev.mongo] The script called "mongo.start" which runs "mongod --dbpath "/Users/anandpandey/Documents/Learning/React/testing-workshop/.mongo-db"" failed with exit code 100 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
[dev.mongo] The script called "mongo" which runs "mkdirp .mongo-db && nps mongo.start" failed with exit code 100 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
[dev.mongo] The script called "dev.mongo" which runs "nps mongo" failed with exit code 100 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
[dev.mongo] nps dev.mongo exited with code 100
--> Sending SIGTERM to other processes..
[dev.api] nps dev.api exited with code null
[dev.client] nps dev.client exited with code null
The script called "dev" which runs "node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors "bgBlue.bold,bgMagenta.bold,bgGreen.bold" --prefix "[{name}]" --names "dev.mongo,dev.client,dev.api" 'nps dev.mongo' 'nps dev.client' 'nps dev.api'" failed with exit code 1 https://github.com/kentcdodds/nps/blob/v5.0.5/other/ERRORS_AND_WARNINGS.md#failed-with-exit-code
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Suggested solution:

Try running sudo yarn start dev

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.