Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question: does the tests work in the package? #11

Closed
smartmouse opened this issue Feb 18, 2015 · 3 comments
Closed

question: does the tests work in the package? #11

smartmouse opened this issue Feb 18, 2015 · 3 comments

Comments

@smartmouse
Copy link

My node version is 0.12.0
My platform is windows 7
I perform npm install vm-browserify
and then cd node_modules/vm-browserify
Then I execute npm test

C:\Users\IBM_ADMIN\VMTest\node_modules\vm-browserify>npm test

[email protected] test C:\Users\IBM_ADMIN\VMTest\node_modules\vm-browserify
tap test/*.js

not ok test/vm.js ....................................... 0/5
Command: "C:\Program Files (x86)\nodejs\node.exe vm.js"
TAP version 13
not ok 1 ReferenceError: document is not defined
---
operator: error
expected:
actual: {}
stack:
ReferenceError:
"at NodeScript.Script.runInContext (C":
|
\Users\IBM_ADMIN\VMTest\node_modules\vm-browserify\index.js:56:18

        "at NodeScript.Script.runInNewContext (C":
                      |
          \Users\IBM_ADMIN\VMTest\node_modules\vm-browserify\index.js:110:2

)
"at Object.exports.(anonymous function).Script.(anonymous function)
[as runInNewContext](C": |
UsersIBM_ADMINVMTestnode_modulesvm-browserifyindex.js:122:2)
"at Test._cb (C":
|
\Users\IBM_ADMIN\VMTest\node_modules\vm-browserify\test\vm.js:7:1
)
"at Test.run (C":
|
\Users\IBM_ADMIN\VMTest\node_modules\vm-browserify\node_modules\t
pe\lib\test.js:53:14)
"at Immediate._onImmediate (C":
|
\Users\IBM_ADMIN\VMTest\node_modules\vm-browserify\node_modules\t
pe\lib\results.js:31:18)
"at processImmediate [as _immediateCallback](timers.js":
|
358:17)
...
not ok 2 ReferenceError: document is not defined
---
operator: error
expected:
actual: {}
stack:
ReferenceError:
"at NodeScript.Script.runInContext (C":
|
\Users\IBM_ADMIN\VMTest\node_modules\vm-browserify\index.js:56:18

        "at Object.exports.(anonymous function).Script.(anonymous function)

[as runInContext](C": |
UsersIBM_ADMINVMTestnode_modulesvm-browserifyindex.js:122:2)
"at Test._cb (C":
|
\Users\IBM_ADMIN\VMTest\node_modules\vm-browserify\test\vm.js:30:
)
"at Test.run (C":
|
\Users\IBM_ADMIN\VMTest\node_modules\vm-browserify\node_modules\t
pe\lib\test.js:57:14)
"at Test. (C":
|
\Users\IBM_ADMIN\VMTest\node_modules\vm-browserify\node_modules\t
pe\lib\results.js:45:20)
"at Test.g (events.js":
|
199:16)
"at Test.emit (events.js":
|
104:17)
"at Test.end (C":
|
\Users\IBM_ADMIN\VMTest\node_modules\vm-browserify\node_modules\t
pe\lib\test.js:107:27)
"at Immediate._onImmediate (C":
|
\Users\IBM_ADMIN\VMTest\node_modules\vm-browserify\node_modules\t
pe\lib\results.js:31:18)
...
not ok 3 plan != count
---
operator: fail
expected: 2
actual: 1
...
not ok 4 plan != count
---
operator: fail
expected: 6
actual: 1
...
not ok 5 test/vm.js
---
exit: 1
command: |
"C:\Program Files (x86)\nodejs\node.exe vm.js"
...

1..5
# tests 5
# fail  5

total ................................................... 0/5

not ok
npm ERR! Test failed. See above for more details.

What did I do wrong? any special set up?
Thanks in advance for your help

@jbeard4
Copy link

jbeard4 commented Aug 14, 2016

I wanted to bump this. I am encountering the same issue:

jbeard4@Jacobs-MacBook-Pro:~/workspace/scion/vm-browserify$ npm test

> [email protected] test /Users/jbeard4/workspace/scion/vm-browserify
> tap test/*.js

test/vm.js ............................................ 0/2
  not ok ReferenceError: document is not defined
    operator: error
    expected: null
    actual: {}
    stack:
      ReferenceError: >-
        document is not defined at NodeScript.Script.runInContext
        (/Users/jbeard4/workspace/scion/vm-browserify/index.js:56:18) at
        NodeScript.Script.runInNewContext
        (/Users/jbeard4/workspace/scion/vm-browserify/index.js:110:20) at
        Object.exports.(anonymous function).Script.(anonymous function) [as
        runInNewContext]
        (/Users/jbeard4/workspace/scion/vm-browserify/index.js:122:24) at Test._cb
        (/Users/jbeard4/workspace/scion/vm-browserify/test/vm.js:7:16) at Test.run
        (/Users/jbeard4/workspace/scion/vm-browserify/node_modules/tape/lib/test.js:53:14)
        at Immediate._onImmediate
        (/Users/jbeard4/workspace/scion/vm-browserify/node_modules/tape/lib/results.js:31:18)
        at processImmediate [as _immediateCallback] (timers.js:383:17)

  not ok ReferenceError: document is not defined
    operator: error
    expected: null
    actual: {}
    stack:
      ReferenceError: >-
        document is not defined at NodeScript.Script.runInContext
        (/Users/jbeard4/workspace/scion/vm-browserify/index.js:56:18) at
        Object.exports.(anonymous function).Script.(anonymous function) [as
        runInContext] (/Users/jbeard4/workspace/scion/vm-browserify/index.js:122:24)
        at Test._cb (/Users/jbeard4/workspace/scion/vm-browserify/test/vm.js:30:8)
        at Test.run
        (/Users/jbeard4/workspace/scion/vm-browserify/node_modules/tape/lib/test.js:53:14)
        at Test.<anonymous>
        (/Users/jbeard4/workspace/scion/vm-browserify/node_modules/tape/lib/results.js:45:20)
        at Test.g (events.js:260:16) at emitNone (events.js:67:13) at Test.emit
        (events.js:166:7) at Test.end
        (/Users/jbeard4/workspace/scion/vm-browserify/node_modules/tape/lib/test.js:107:27)
        at Test.run
        (/Users/jbeard4/workspace/scion/vm-browserify/node_modules/tape/lib/test.js:57:14)

total ................................................. 0/4


  0 passing (200.098ms)
  2 failing

npm ERR! Test failed.  See above for more details.

Any insight into this would be appreciated.

@jbeard4
Copy link

jbeard4 commented Aug 16, 2016

Upon further inspection, tests can be run as follows

browserify test/vm.js -o out.js -s vm

then create a host HTML file:

<html>
  <head>
    <script src="out.js"></script>
  </head>
</html>

And inspect the console log:

TAP version 13
out.js:5750 # vmRunInNewContext
out.js:5750 ok 1 should be equal
out.js:5750 ok 2 should be equal
out.js:5750 ok 3 should be equal
out.js:5750 ok 4 should be equal
out.js:5750 ok 5 should be equal
out.js:5750 ok 6 should be equal
out.js:5750 # vmRunInContext
out.js:5750 ok 7 should be equivalent
out.js:5750 ok 8 should be equivalent
out.js:5750 
out.js:5750 1..8
out.js:5750 # tests 8
out.js:5750 # pass  8
out.js:5750 
out.js:5750 # ok
out.js:5750 

Or, run in testling:

jbeard4@Jacobs-MBP:~/workspace/scion/vm-browserify$ browserify test/vm.js  | testling

TAP version 13
# vmRunInNewContext
ok 1 should be equal
ok 2 should be equal
ok 3 should be equal
ok 4 should be equal
ok 5 should be equal
ok 6 should be equal
# vmRunInContext
ok 7 should be equivalent
ok 8 should be equivalent

1..8
# tests 8
# pass  8

# ok

@goto-bus-stop
Copy link
Member

addressed by #21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants