Javascript 打字脚本/笑话不';我不认识网络工作者
我正在尝试将Web Workers与Typescript结合使用。我有一个具有以下结构的项目:Javascript 打字脚本/笑话不';我不认识网络工作者,javascript,typescript,jestjs,web-worker,Javascript,Typescript,Jestjs,Web Worker,我正在尝试将Web Workers与Typescript结合使用。我有一个具有以下结构的项目: __tests__ | | test.ts --- src | | something.ts | someelse.ts --- jest.config.js package.json tsconfig.json tsconfig.json { "compileOnSave": true, "compilerOptions": { "module": "commonjs",
__tests__
|
| test.ts
---
src
|
| something.ts
| someelse.ts
---
jest.config.js
package.json
tsconfig.json
tsconfig.json
{
"compileOnSave": true,
"compilerOptions": {
"module": "commonjs",
"esModuleInterop": true,
"target": "es6",
"noImplicitAny": false,
"moduleResolution": "node",
"sourceMap": true,
"outDir": "dist",
"baseUrl": ".",
"lib": ["webworker", "es2015", "scripthost"]
},
"exclude": [
"node_modules"
]
}
{
"name": "test-ts",
"version": "1.0.0",
"main": "main.ts",
"scripts": {
"test": "jest"
},
"author": "",
"dependencies": {
"@types/node": "^13.1.0",
"awesome-typescript-loader": "^5.2.1",
"typescript": "^3.7.4",
"webpack": "^4.41.4",
"worker-loader": "^2.0.0"
},
"devDependencies": {
"@types/jest": "^24.0.24",
"jest": "^24.9.0",
"ts-jest": "^24.2.0"
}
}
package.json
{
"compileOnSave": true,
"compilerOptions": {
"module": "commonjs",
"esModuleInterop": true,
"target": "es6",
"noImplicitAny": false,
"moduleResolution": "node",
"sourceMap": true,
"outDir": "dist",
"baseUrl": ".",
"lib": ["webworker", "es2015", "scripthost"]
},
"exclude": [
"node_modules"
]
}
{
"name": "test-ts",
"version": "1.0.0",
"main": "main.ts",
"scripts": {
"test": "jest"
},
"author": "",
"dependencies": {
"@types/node": "^13.1.0",
"awesome-typescript-loader": "^5.2.1",
"typescript": "^3.7.4",
"webpack": "^4.41.4",
"worker-loader": "^2.0.0"
},
"devDependencies": {
"@types/jest": "^24.0.24",
"jest": "^24.9.0",
"ts-jest": "^24.2.0"
}
}
jest.config.js
module.exports = {
"roots": [
"<rootDir>"
],
"testMatch": [
"**/__tests__/**/*.+(ts|tsx|js)",
"**/?(*.)+(spec|test).+(ts|tsx|js)"
],
"transform": {
"^.+\\.(ts|tsx)$": "ts-jest"
},
}
有什么问题吗?有没有一种方法可以将Jest Transfile TS转换为JavaScript,以便它能够识别工人类
谢谢。这方面有什么更新吗?