dead-claudia / thallium

A simple, extensible JavaScript test framework (work in progress)
18 stars 4 forks source link

Windows issues #38

Closed ghost closed 7 years ago

ghost commented 7 years ago

Whatever I do, and whatever I try. I can't run Thallium on Windows. I think I tried everything possible, but here is a few errors:

Error: Cannot find module 'thallium' from 'thallium\test'

This error occur when I try to run a locale test in the Thallium folder itself / because I figured this can't be run globally, and NPM isn't updated yet.

I then tried to load 'index.js' from root, but still it can't find Thallium :(

I can't run this from other folders or globally, so I only try to get tests working in the Thallium folder itself.

After more experimenting I got this error too:

Suggestion [3,General]: The command thallium was not found, but does exist in the current location. Windows PowerShell does not load commands from the current location by default. If you trust this command, instead type: ".\thallium"

The tests runs just fine. The issue is only to get Thallium working as a test runner.

One time I managed to get it running - no idea how many attempts I used for that - but then I ended up running the tests (I guess), but then there was no reporter output.

Last weeks I have been stuck on this messag now:

Error: Cannot find module 'thallium' from '....'

We spoke on chat regarding this, and I tried everything that we discussed and even more.

dead-claudia commented 7 years ago

This error occur when I try to run a locale test in the Thallium folder itself / because I figured this can't be run globally, and NPM isn't updated yet.

I was hoping on publishing 0.3 by the end of this week (hopefully earlier). The documentation is pretty much finished (it just needs pushed); I just need to write the long changelog and smoke test a npm install /path/to/my/local/repo, since I decided to pull a small-scale Angular 2. πŸ˜„

The issue is only to get Thallium working as a test runner.

Yeah...the runner working is pretty important. It's hard to run tests with a runner that never finds anything. πŸ˜‰

dead-claudia commented 7 years ago

Oh, and could you try the latest master? I've made several substantial updates recently.

ghost commented 7 years ago

@isiahmeadows I did try the master, and I installed it globally now from the Thallium folder. First thing I discovered it's never telling me if a file exist or not.

// file doesn't exist, but I try to lunch it
tl isiah.meadows

// output

Error: Cannot find module 'thallium' from 'C:\xampp4\htdocs\thallium\isiah.meadows.js'

If I try with a file that exist say foo.js,

tl foo.js

// output

Error: Cannot find module 'thallium' from 'C:\xampp4\htdocs\thallium\foo.js'

Same error messages I allways get :)

The content of foo.js is this:

"use strict";

// Load the necessary modules
const t = require("thallium");
const assert = require("thallium/assert");

// Define the tests
t.test("testing", () => {
    t.test("things work", () => {
        const myValue = "string";
        const yourValue = "string";

        assert.equal(myValue, yourValue);
    });
});

// `tl` runs the tests automatically

Taken from your updated documentation.

Conclusion on this is that I still get the same errors as I have got the last 3 weeks.

ghost commented 7 years ago

I tried prev examples from the CMD. When I try to add it to the package.json and run globally

 "scripts": {
     "foo": "tl foo.js"
  },

npm run foo

I get the same messages as before.

If I try to run the locale version of Thallium from package.json, I get the same error message.

ghost commented 7 years ago

@isiahmeadows Other things I tried

and a bunch of other things.

Message:

Error: Cannot find module 'thallium' from '...'

Whatever I do, this will not work at all. And crazy enough. I'm getting the same error message over and over again, even if the file doesn't exist. Wrong path or what ever I do wrong - with purpose.

ghost commented 7 years ago

Need to add that If I avoid installing this global and try to run it from package.json, I will get this error message:

'tl' is not recognized as an internal or external command,
operable program or batch file.

As a workaround for that, I can change package.json so it looks like this

"scripts": {
"foo": "node bin/tl.js test/foo.js"
 }

npm run foo

Then I'm ending up with this error message:

Error: Cannot find module 'thallium' from 'C:\xampp4\htdocs\thallium\test\foo.js'
ghost commented 7 years ago

@isiahmeadows I know followed your instructions step by step - found here: https://github.com/isiahmeadows/thallium/blob/master/docs/getting-started.md

Expected result:

$ tl

testing
    βœ“ things work

The result I get

$ tl

Error: Cannot find module 'thallium' from 'C:\xampp4\htdocs\thallium\test'
    at node_modules\thallium\node_modules\resolve\lib\async.js:46:17
    at process (node_modules\thallium\node_modules\resolve\lib\async.js:173:43)
    at ondir (node_modules\thallium\node_modules\resolve\lib\async.js:188:17)
    at load (node_modules\thallium\node_modules\resolve\lib\async.js:69:43)
    at onex (node_modules\thallium\node_modules\resolve\lib\async.js:92:31)
    at node_modules\thallium\node_modules\resolve\lib\async.js:22:47
    at FSReqWrap.oncomplete (fs.js:111:15)```
dead-claudia commented 7 years ago

What's the stack trace for those exceptions? It appears reproducible across platforms (this is all in platform-agnostic code), so I should be able to repro it within the next week or so.

On Wed, Oct 26, 2016, 04:45 zubuzon notifications@github.com wrote:

Need to add if you haven't installed this global and try to run it from package.json, I will get this error message:

'tl' is not recognized as an internal or external command, operable program or batch file.

β€” You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/isiahmeadows/thallium/issues/38#issuecomment-256285922, or mute the thread https://github.com/notifications/unsubscribe-auth/AERrBLfLtn8bwcydWSHPiqnCCZ0fO8Qcks5q3xMigaJpZM4KfyeW .

ghost commented 7 years ago

@isiahmeadows The errors starts in this module:

 else loadNodeModules(x, y, function (err, n, pkg) {
        console.log(core)
        if (err) cb(err)
        else if (n) cb(null, n, pkg)
        else if (core[x]) return cb(null, x);
        else cb(new Error("Cannot find module '" + x + "' from '" + y + "'"))
    });
 console.log(core[x])

// undefined

Console.log output

{ assert: true,
  buffer_ieee754: true,
  buffer: true,
  child_process: true,
  cluster: true,
  console: true,
  constants: true,
  crypto: true,
  _debugger: true,
  dgram: true,
  dns: true,
  domain: true,
  events: true,
  freelist: true,
  fs: true,
  http: true,
  https: true,
  _linklist: true,
  module: true,
  net: true,
  os: true,
  path: true,
  punycode: true,
  querystring: true,
  readline: true,
  repl: true,
  stream: true,
  string_decoder: true,
  sys: true,
  timers: true,
  tls: true,
  tty: true,
  url: true,
  util: true,
  vm: true,
  zlib: true }

The console.log output is from the core.json file.

So the CLI and this function module.exports = function resolve (x, opts, cb) is the issue here.

ghost commented 7 years ago

@isiahmeadows I tried your new changes.

Error: Cannot find module 'thallium'
    at Function.Module._resolveFilename (module.js:472:15)
    at Function.Module._load (module.js:420:25)
    at Module.require (module.js:500:17)
    at Object.exports.load (\npm\node_modules\thallium\lib\cli\util.js:53:14)
    at loadMod (\npm\node_modules\thallium\lib\cli\loader.js:268:45)
    at \npm\node_modules\thallium\lib\cli\loader.js:278:28
    at process._tickCallback (internal/process/next_tick.js:103:7)
    at Module.runMain (module.js:609:11)
    at run (bootstrap_node.js:382:7)
    at startup (bootstrap_node.js:137:9)

The error message have changed. But still I can not run it locally or globally.

dead-claudia commented 7 years ago

As discussed in Gitter, it was an issue with thallium not being installed locally. I edited the docs to be a little clearer about this. Closing.