stevekane / promise-it-wont-hurt

A Workshopper module that teaches you to use promises in javascript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exercise 2 - Fulfill a Promise - breaks when add require('es6-promise');

discdiver opened this issue · comments

Instructions say:

Then, in the main file in your app, add the following line:

require('es6-promise');

Leads to:

if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) {
^

TypeError: P.resolve is not a function
at lib$es6$promise$polyfill$$polyfill (/Users/kathleenhale/javascriptapps/nodeapps/node_modules/es6-promise/dist/es6-promise.js:935:49)
at Object. (/Users/kathleenhale/javascriptapps/nodeapps/node_modules/es6-promise/dist/es6-promise.js:957:5)
at Object. (/Users/kathleenhale/javascriptapps/nodeapps/node_modules/es6-promise/dist/es6-promise.js:958:4)
at Module._compile (module.js:397:26)
at Object.Module._extensions..js (module.js:404:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (/Users/kathleenhale/javascriptapps/nodeapps/promises2.js:1:63)
✗ Expected execution time: 429±100ms. Submission execution time: 129ms.

Remove the require and it passes.

Running node v5.4.1

Packages installed with Promise It Won't Hurt:

─┬ promise-it-wont-hurt@1.0.0-alpha.2
├─┬ @timothygu/workshopper@2.7.4
│ ├─┬ @timothygu/terminal-menu@2.1.2
│ │ ├── charm@1.0.1
│ │ ├─┬ duplexer2@0.1.4
│ │ │ └─┬ readable-stream@2.1.4
│ │ │ └── buffer-shims@1.0.0
│ │ ├── inherits@2.0.1
│ │ ├── resumer@0.0.0
│ │ └── visualwidth@0.1.0
│ ├─┬ chalk@0.4.0
│ │ ├── ansi-styles@1.0.0
│ │ ├── has-color@0.1.7
│ │ └── strip-ansi@0.1.1
│ ├─┬ colors-tmpl@0.1.1
│ │ └── colors@0.6.2
│ ├─┬ i18n-core@1.3.3
│ │ ├── mustache@0.8.2
│ │ └── sprintf@0.1.5
│ ├── map-async@0.1.1
│ ├── mkdirp@0.3.5
│ ├─┬ msee@0.1.2
│ │ ├─┬ cardinal@0.5.0
│ │ │ ├── ansicolors@0.2.1
│ │ │ └─┬ redeyed@0.5.0
│ │ │ └── esprima-fb@12001.1.0-dev-harmony-fb
│ │ ├── marked@0.3.5
│ │ ├─┬ nopt@2.1.2
│ │ │ └── abbrev@1.0.9
│ │ └── xtend@2.1.2
│ ├─┬ optimist@0.6.1
│ │ ├── minimist@0.0.10
│ │ └── wordwrap@0.0.3
│ ├── visualwidth@0.0.1
│ └── xtend@3.0.0
├─┬ @timothygu/workshopper-wrappedexec@0.1.5
│ ├── after@0.8.1
│ └─┬ xtend@2.1.2
│ └── object-keys@0.4.0
├── es6-promise@3.2.1
├── node-uuid@1.4.7
├─┬ q-io@1.13.2
│ ├─┬ collections@0.2.2
│ │ └── weak-map@1.0.0
│ ├── mime@1.3.4
│ ├── mimeparse@0.1.4
│ ├── q@1.4.1
│ ├── qs@1.2.2
│ └── url2@0.0.0
├─┬ random-word@1.0.2
│ ├─┬ meow@3.7.0
│ │ ├─┬ camelcase-keys@2.1.0
│ │ │ └── camelcase@2.1.1
│ │ ├── decamelize@1.2.0
│ │ ├─┬ loud-rejection@1.5.0
│ │ │ ├─┬ currently-unhandled@0.4.1
│ │ │ │ └── array-find-index@1.0.1
│ │ │ └── signal-exit@3.0.0
│ │ ├── map-obj@1.0.1
│ │ ├── minimist@1.2.0
│ │ ├─┬ normalize-package-data@2.3.5
│ │ │ ├── hosted-git-info@2.1.5
│ │ │ ├─┬ is-builtin-module@1.0.0
│ │ │ │ └── builtin-modules@1.1.1
│ │ │ ├── semver@5.2.0
│ │ │ └─┬ validate-npm-package-license@3.0.1
│ │ │ ├─┬ spdx-correct@1.0.2
│ │ │ │ └── spdx-license-ids@1.2.1
│ │ │ └─┬ spdx-expression-parse@1.0.2
│ │ │ └── spdx-exceptions@1.0.4
│ │ ├── object-assign@4.1.0
│ │ ├─┬ read-pkg-up@1.0.1
│ │ │ ├─┬ find-up@1.1.2
│ │ │ │ ├── path-exists@2.1.0
│ │ │ │ └─┬ pinkie-promise@2.0.1
│ │ │ │ └── pinkie@2.0.4
│ │ │ └─┬ read-pkg@1.1.0
│ │ │ ├─┬ load-json-file@1.1.0
│ │ │ │ ├── graceful-fs@4.1.4
│ │ │ │ ├─┬ parse-json@2.2.0
│ │ │ │ │ └─┬ error-ex@1.3.0
│ │ │ │ │ └── is-arrayish@0.2.1
│ │ │ │ ├── pify@2.3.0
│ │ │ │ └─┬ strip-bom@2.0.0
│ │ │ │ └── is-utf8@0.2.1
│ │ │ └── path-type@1.1.0
│ │ ├─┬ redent@1.0.0
│ │ │ ├─┬ indent-string@2.1.0
│ │ │ │ └─┬ repeating@2.0.1
│ │ │ │ └─┬ is-finite@1.0.1
│ │ │ │ └── number-is-nan@1.0.0
│ │ │ └─┬ strip-indent@1.0.1
│ │ │ └── get-stdin@4.0.1
│ │ └── trim-newlines@1.0.0
│ ├─┬ unique-random-array@1.0.0
│ │ └── unique-random@1.0.0
│ └── word-list@1.0.1
├─┬ shasum@1.0.2
│ ├─┬ json-stable-stringify@0.0.1
│ │ └── jsonify@0.0.0
│ └── sha.js@2.4.5
├─┬ workshopper-exercise@2.7.0
│ ├─┬ chalk@1.1.3
│ │ ├── ansi-styles@2.2.1
│ │ ├── escape-string-regexp@1.0.5
│ │ ├─┬ has-ansi@2.0.0
│ │ │ └── ansi-regex@2.0.0
│ │ ├── strip-ansi@3.0.1
│ │ └── supports-color@2.0.0
│ ├── i18n-core@2.1.1
│ ├─┬ split@1.0.0
│ │ └── through@2.3.8
│ ├─┬ through2@2.0.1
│ │ ├─┬ readable-stream@2.0.6
│ │ │ ├── core-util-is@1.0.2
│ │ │ ├── isarray@1.0.0
│ │ │ ├── process-nextick-args@1.0.7
│ │ │ ├── string_decoder@0.10.31
│ │ │ └── util-deprecate@1.0.2
│ │ └── xtend@4.0.1
│ ├── tuple-stream@0.0.2
│ ├─┬ wcstring@2.1.1
│ │ ├── varsize-string@2.2.2
│ │ └── wcsize@1.0.0
│ └── xtend@4.0.1
└─┬ workshopper-timer@1.0.0
└─┬ bl@1.1.2
└── readable-stream@2.0.6

Immediately above it:

for this workshopper, a promise implementation will be automatically supplied if none is available.

but either way I'll fix it.