[tansaku@Samuels-MBP:~/tmp ]$
→ mkdir node_tests_rep3
[tansaku@Samuels-MBP:~/tmp ]$
→ cd node_tests_rep3
[tansaku@Samuels-MBP:~/tmp/node_tests_rep3 ]$
→ npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.
See `npm help json` for definitive documentation on these fields
and exactly what they do.
Use `npm install <pkg> --save` afterwards to install a package and
save it as a dependency in the package.json file.
Press ^C at any time to quit.
name: (node_tests_rep3)
version: (1.0.0)
description:
entry point: (index.js)
test command: mocha test/**/*.js
git repository:
keywords:
author:
license: (ISC)
About to write to /Users/tansaku/tmp/node_tests_rep3/package.json:
{
"name": "node_tests_rep3",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "mocha test/**/*.js"
},
"author": "",
"license": "ISC"
}
Is this ok? (yes)
[tansaku@Samuels-MBP:~/tmp/node_tests_rep3 ]$
→ mkdir test lib
[tansaku@Samuels-MBP:~/tmp/node_tests_rep3 ]$
→ ls
lib package.json test
[tansaku@Samuels-MBP:~/tmp/node_tests_rep3 ]$
→ touch test/test_spec.js
[tansaku@Samuels-MBP:~/tmp/node_tests_rep3 ]$
→ touch lib/test.js
[tansaku@Samuels-MBP:~/tmp/node_tests_rep3 ]$
→ npm install mocha chai
node_tests_rep3@1.0.0 /Users/tansaku/tmp/node_tests_rep3
├─┬ chai@4.1.2
│ ├── assertion-error@1.0.2
│ ├── check-error@1.0.2
│ ├── deep-eql@3.0.1
│ ├── get-func-name@2.0.0
│ ├── pathval@1.1.0
│ └── type-detect@4.0.3
└─┬ mocha@3.5.2
├── browser-stdout@1.3.0
├─┬ commander@2.9.0
│ └── graceful-readlink@1.0.1
├─┬ debug@2.6.8
│ └── ms@2.0.0
├── diff@3.2.0
├── escape-string-regexp@1.0.5
├─┬ glob@7.1.1
│ ├── fs.realpath@1.0.0
│ ├─┬ inflight@1.0.6
│ │ └── wrappy@1.0.2
│ ├── inherits@2.0.3
│ ├─┬ minimatch@3.0.4
│ │ └─┬ brace-expansion@1.1.8
│ │ ├── balanced-match@1.0.0
│ │ └── concat-map@0.0.1
│ ├── once@1.4.0
│ └── path-is-absolute@1.0.1
├── growl@1.9.2
├── he@1.1.1
├── json3@3.3.2
├─┬ lodash.create@3.1.1
│ ├─┬ lodash._baseassign@3.2.0
│ │ ├── lodash._basecopy@3.0.1
│ │ └─┬ lodash.keys@3.1.2
│ │ ├── lodash._getnative@3.9.1
│ │ ├── lodash.isarguments@3.1.0
│ │ └── lodash.isarray@3.0.4
│ ├── lodash._basecreate@3.0.3
│ └── lodash._isiterateecall@3.0.9
├─┬ mkdirp@0.5.1
│ └── minimist@0.0.8
└─┬ supports-color@3.1.2
└── has-flag@1.0.0
npm WARN node_tests_rep3@1.0.0 No description
npm WARN node_tests_rep3@1.0.0 No repository field.
[tansaku@Samuels-MBP:~/tmp/node_tests_rep3 ]$
→ subl .
[tansaku@Samuels-MBP:~/tmp/node_tests_rep3 ]$
→ npm test
> node_tests_rep3@1.0.0 test /Users/tansaku/tmp/node_tests_rep3
> mocha test/**/*.js
/Users/tansaku/tmp/node_tests_rep3/test/test_spec.js:4
describe('Athletic reps'()=>{
^^^^^^^^^^^^^^^
SyntaxError: Unexpected string
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
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 /Users/tansaku/tmp/node_tests_rep3/node_modules/mocha/lib/mocha.js:231:27
at Array.forEach (native)
at Mocha.loadFiles (/Users/tansaku/tmp/node_tests_rep3/node_modules/mocha/lib/mocha.js:228:14)
at Mocha.run (/Users/tansaku/tmp/node_tests_rep3/node_modules/mocha/lib/mocha.js:514:10)
at Object.<anonymous> (/Users/tansaku/tmp/node_tests_rep3/node_modules/mocha/bin/_mocha:480:18)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:504:3
npm ERR! Test failed. See above for more details.
[tansaku@Samuels-MBP:~/tmp/node_tests_rep3 ]$
→ npm test
> node_tests_rep3@1.0.0 test /Users/tansaku/tmp/node_tests_rep3
> mocha test/**/*.js
/Users/tansaku/tmp/node_tests_rep3/test/test_spec.js:1
(function (exports, require, module, __filename, __dirname) { const expect = rqeuire('chai').expect
^
ReferenceError: rqeuire is not defined
at Object.<anonymous> (/Users/tansaku/tmp/node_tests_rep3/test/test_spec.js:1:93)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
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 /Users/tansaku/tmp/node_tests_rep3/node_modules/mocha/lib/mocha.js:231:27
at Array.forEach (native)
at Mocha.loadFiles (/Users/tansaku/tmp/node_tests_rep3/node_modules/mocha/lib/mocha.js:228:14)
at Mocha.run (/Users/tansaku/tmp/node_tests_rep3/node_modules/mocha/lib/mocha.js:514:10)
at Object.<anonymous> (/Users/tansaku/tmp/node_tests_rep3/node_modules/mocha/bin/_mocha:480:18)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:504:3
npm ERR! Test failed. See above for more details.
[tansaku@Samuels-MBP:~/tmp/node_tests_rep3 ]$
→ npm test
> node_tests_rep3@1.0.0 test /Users/tansaku/tmp/node_tests_rep3
> mocha test/**/*.js
Athletic reps
✓ should get less painful
1 passing (7ms)
[tansaku@Samuels-MBP:~/tmp/node_tests_rep3 ]$
→ npm test
> node_tests_rep3@1.0.0 test /Users/tansaku/tmp/node_tests_rep3
> mocha test/**/*.js
Athletic reps
1) should get less painful
0 passing (10ms)
1 failing
1) Athletic reps should get less painful:
AssertionError: expected 'more' to equal 'less'
+ expected - actual
-more
+less
at Context.it (test/test_spec.js:6:21)
npm ERR! Test failed. See above for more details.
[tansaku@Samuels-MBP:~/tmp/node_tests_rep3 ]$
→ npm test
> node_tests_rep3@1.0.0 test /Users/tansaku/tmp/node_tests_rep3
> mocha test/**/*.js
Athletic reps
✓ should get less painful
1 passing (7ms)
Created
September 11, 2017 08:24
-
-
Save tansaku/c311c996cc1521dceea0c0852849e9ca to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment