Skip to content

Commit

Permalink
Add ts-node test
Browse files Browse the repository at this point in the history
  • Loading branch information
ai committed Apr 10, 2020
1 parent cad31f3 commit 2208e6b
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 214 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"parcel": "^1.12.4",
"rollup": "^2.4.0",
"rollup-plugin-svg": "^2.0.0",
"ts-node": "^8.8.2",
"typescript": "^3.8.3",
"webpack": "^4.42.1",
"yaspeller": "^6.1.0",
Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/ts-node/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
let { lib } = require('lib')

lib()
4 changes: 4 additions & 0 deletions test/fixtures/ts-node/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"private": true,
"name": "ts-runner"
}
5 changes: 5 additions & 0 deletions test/fixtures/ts-node/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"compilerOptions": {
"lib": ["es2015"]
}
}
9 changes: 9 additions & 0 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,15 @@ if (ciJob() === 1) {
await exec('npx tsc --build ' + join(runner, 'tsconfig.json'))
})

it('works with ts-node', async () => {
let [lib, runner] = await copyDirs('lib', 'ts-node')
await processDir(lib)
await replaceConsole(lib)
await exec(`yarn add lib@${ lib }`, { cwd: runner })
let { stdout } = await exec('npx ts-node ' + join(runner, 'index.ts'))
expect(stdout).toEqual('cjs d\ncjs a\ncjs b\ncjs c\ncjs lib\n')
})

it('works with modules in webpack', async () => {
let [lib, clientLib, client] = await copyDirs('lib', 'client-lib', 'client')
await processDir(lib)
Expand Down
Loading

0 comments on commit 2208e6b

Please sign in to comment.