I am integrating e2e testing in my project. The project uses Typescript (2.6.1).
I have just installed Protractor (5.2.0) but no matter what I do Typescript cannot import anything from the Protractor module.
My tsconfig looks like this:
{
"compilerOptions": {
"target": "es5",
"module": "amd"
},
"exclude": [
"./spec",
"./node_modules",
"./bower_components"
]
}
My very simple try out test looks like this:
import { browser } from "protractor";
describe("test should run", () => {
it("should navigate to the page", () => {
});
});
I get the following error: TypeScript error: usermanagement/ts/controllers/RolesController.e2e.ts(1,25): error TS2307: Cannot find module 'protractor'.
Looking at the Protractor installation in my node_modules
folder I do find a reference to a typings file and the actual typings themselves. However Typescript simply does not 'see' them. Interestingly Typescript has no problem finding typings in the node_modules/@types
folder.
Anyone know what I am doing wrong?
In your tsconfig add:
"module": "commonjs"
This is the recommended config I mention here as well https://basarat.gitbooks.io/typescript/content/docs/quick/nodejs.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.