作为 node 和 ts-node 的新手,我正在努力弄清楚如何从这个开源项目运行测试——https: //github.com/pocesar/node-stratum(它们是 .ts 文件)。我安装了“typescript”和“ts-node”......
localhost:node-stratum satishp$ npm install -g typescript
/usr/local/bin/tsc -> /usr/local/lib/node_modules/typescript/bin/tsc
/usr/local/bin/tsserver -> /usr/local/lib/node_modules/typescript/bin/tsserver
+ typescript@2.7.2
added 1 package in 2.974s
localhost:node-stratum satishp$ npm install -g ts-node
/usr/local/bin/ts-node -> /usr/local/lib/node_modules/ts-node/dist/bin.js
+ ts-node@5.0.1
added 17 packages in 1.596s
但是当我去运行位于“test/tests.ts”目录中的测试时,我得到了以下错误
localhost:node-stratum satishp$ ts-node test/tests.ts
Error: Cannot find module '../lib'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/satishp/Documents/workspace/node-stratum/test/tests.ts:3:1)
at Module._compile (module.js:660:30)
at Module.m._compile (/usr/local/lib/node_modules/ts-node/src/index.ts:400:23)
at Module._extensions..js (module.js:671:10)
at Object.require.extensions.(anonymous function) [as .ts] (/usr/local/lib/node_modules/ts-node/src/index.ts:403:12)
at Module.load (module.js:573:32)
我还需要做些什么才能使测试文件正常运行吗?