2018-10-11 admin


什么是intern,Intern. A next-generation code testing stack for JavaScript.



Software testing for humans

BrowserStack Status codecov Average time to resolve an issue Percentage of issues still open FOSSA Status

Intern logo

Intern is a complete test system for JavaScript designed to help you write and run consistent, high-quality test cases for your JavaScript libraries and applications. It can be used to test any JavaScript code.

  • Plain JavaScript code, in any module format (or no module format!)
  • Web pages generated by server-side languages (like Java, PHP, or Ruby)
  • Native or hybrid iOS, Android, and Firefox OS applications

Intern is minimally prescriptive and enforces only a basic set of best practices designed to ensure your tests stay maintainable over time. Its extensible architecture allows you to write custom test interfaces, executors, and reporters to influence how your tests run & easily integrate with your existing coding environment. Intern also comes with Grunt tasks so it can be quickly added to existing Grunt-based workflows, and is designed to work out-of-the-box with popular continuous integration services like Jenkins and Travis CI.

If you’re into name-dropping, Intern gets used every day by teams at Twitter, Stripe, Mozilla, IBM, Marriott, Philips, Zenput, Alfresco, Esri, HSBC, ING, Intuit, and more. It’s also the testing framework of choice for growing numbers of open-source projects.

<g-emoji class=“g-emoji” alias=“bulb” fallback-src=“”>💡</g-emoji> If you’re an Intern user who’s new to Intern 4, see the Changes from Intern 3 document for a summary of the major differences. For Intern 3 documentation, please see the Intern 3 README.

<g-emoji class=“g-emoji” alias=“bulb” fallback-src=“”>💡</g-emoji> Recently updated your browser and your WebDriver tests stopped working? You may need to pin your WebDriver versions.

Quick start

  1. Install from npm

    $ cd /my/project
    $ npm install intern
  2. Create an intern.json file in your project root.

      "suites": "tests/unit/**/*.js"
  3. Verify that your configuration works by running Intern and checking that no errors are output.

    $ ./node_modules/.bin/intern
  4. Start writing tests!

TypeScript setup

Intern installs a global variable that tests may not be aware of if nothing imports the base intern package. To ensure Intern’s types are loaded, add the following to your tsconfig.json:

    "compilerOptions": {
        "types": ["intern"]


Intern can run unit tests in most browsers that support ECMAScript 5, including mobile browsers on Android and iOS, and in Node 6+. Note that Internet Explorer 9 is currently not supported.

Intern’s self-tests run against IE 10 and 11, Firefox 33 and current, Chrome 38 and current, and Safari 9 and 10, as well as Node 6 and 8.

Intern can run functional tests using WebDriver-compatible applications and services, including Selenium, Appium, Selendroid. It has built-in support for cloud testing services from BrowserStack, CrossBrowserTesting, SauceLabs, and TestingBot.

More information

Get help

The best place to ask questions and get answers about Intern is Stack Overflow. Just tag your question with intern. If you have more immediate questions, or just want to chat with other people interested in Intern, join the Gitter room at theintern/intern. See the Help page for more information.


Intern is a JS Foundation project offered under the New BSD license.

FOSSA Status

© SitePen, Inc. and its contributors

Intern’s self-tests run on BrowserStack logo


转载请注明:文章转载自 JavaScript中文网 []



禁用Internet Explorer中的长运行脚本消息
Karascatman提出了一个问题:Disabling the long-running-script message in Internet Explorer,或许与您遇到的问题类似。 回答者Andy GaskellAndy E给出了该...
Why won&apos;t .filter() work in Internet Explorer 8?
aleJack Busch提出了一个问题:Why won’t .filter() work in Internet Explorer 8?,或许与您遇到的问题类似。 回答者Paulpro给出了该问题的处理方式: Array.filter()...
“控制台”是Internet Explorer的未定义错误。
Sebastian Zartneruser246114提出了一个问题:‘console’ is undefined error for Internet Explorer,或许与您遇到的问题类似。 回答者Communitykennytm给出...
grunt-contrib-internal是什么 什么是grunt-contrib-internal,Internal tasks for managing the grunt-contrib projects grunt-contri...
我怎样才能只使用JavaScript来访问Internet Explorer 11?
BoltClockdave1010提出了一个问题:How can I target only Internet Explorer 11 with JavaScript?,或许与您遇到的问题类似。 回答者 7 revs, 3 users 76...
为什么Internet Explorer在失败后在Ajax调用中不发送HTTP POST主体?
Jonathon FaustDodgyrabbit提出了一个问题:Why does Internet Explorer not send HTTP post body on Ajax call after failure?,或许与您遇到的问...
Internet Explorer 11检测
CommunityMiqdad Ali提出了一个问题:Internet Explorer 11 detection,或许与您遇到的问题类似。 回答者Royi Namir给出了该问题的处理方式: Edit 18 Nov 2016 This c...
我能在Internet Explorer中加载整个HTML文档到文档片段吗?
ddaAndy E提出了一个问题:Can I load an entire HTML document into a document fragment in Internet Explorer?,或许与您遇到的问题类似。 回答者Commu...
JSON是Internet Explorer中JavaScript中未定义的错误。
Dalenashishjmeshram提出了一个问题:‘JSON’ is undefined error in JavaScript in Internet Explorer,或许与您遇到的问题类似。 回答者CommunityDalen给出...
How to detect slow internet connections?
Starx提出了一个问题:How to detect slow internet connections?,或许与您遇到的问题类似。 回答者Sam Hanes给出了该问题的处理方式: You can start a timeout in a...