Skip to content

Commit 2208e6b

Browse files
committed
Add ts-node test
1 parent cad31f3 commit 2208e6b

File tree

6 files changed

+62
-214
lines changed

6 files changed

+62
-214
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"parcel": "^1.12.4",
5454
"rollup": "^2.4.0",
5555
"rollup-plugin-svg": "^2.0.0",
56+
"ts-node": "^8.8.2",
5657
"typescript": "^3.8.3",
5758
"webpack": "^4.42.1",
5859
"yaspeller": "^6.1.0",

test/fixtures/ts-node/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
let { lib } = require('lib')
2+
3+
lib()

test/fixtures/ts-node/package.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"private": true,
3+
"name": "ts-runner"
4+
}

test/fixtures/ts-node/tsconfig.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"compilerOptions": {
3+
"lib": ["es2015"]
4+
}
5+
}

test/index.test.js

+9
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,15 @@ if (ciJob() === 1) {
191191
await exec('npx tsc --build ' + join(runner, 'tsconfig.json'))
192192
})
193193

194+
it('works with ts-node', async () => {
195+
let [lib, runner] = await copyDirs('lib', 'ts-node')
196+
await processDir(lib)
197+
await replaceConsole(lib)
198+
await exec(`yarn add lib@${ lib }`, { cwd: runner })
199+
let { stdout } = await exec('npx ts-node ' + join(runner, 'index.ts'))
200+
expect(stdout).toEqual('cjs d\ncjs a\ncjs b\ncjs c\ncjs lib\n')
201+
})
202+
194203
it('works with modules in webpack', async () => {
195204
let [lib, clientLib, client] = await copyDirs('lib', 'client-lib', 'client')
196205
await processDir(lib)

0 commit comments

Comments
 (0)