mochitest-test.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // Parent config file for all mochitest files.
  2. "use strict";
  3. module.exports = {
  4. env: {
  5. browser: true,
  6. },
  7. // All globals made available in the test environment.
  8. globals: {
  9. // SpecialPowers is injected into the window object via SimpleTest.js
  10. SpecialPowers: false,
  11. XPCNativeWrapper: false,
  12. },
  13. overrides: [
  14. {
  15. env: {
  16. // Ideally we wouldn't be using the simpletest env here, but our uses of
  17. // js files mean we pick up everything from the global scope, which could
  18. // be any one of a number of html files. So we just allow the basics...
  19. "mozilla/simpletest": true,
  20. },
  21. files: ["*.js"],
  22. },
  23. ],
  24. plugins: ["mozilla", "@microsoft/sdl"],
  25. rules: {
  26. // No using of insecure url, so no http urls
  27. "@microsoft/sdl/no-insecure-url": [
  28. "error",
  29. {
  30. exceptions: [
  31. "^http:\\/\\/mochi\\.test?.*",
  32. "^http:\\/\\/mochi\\.xorigin-test?.*",
  33. "^http:\\/\\/localhost?.*",
  34. "^http:\\/\\/127\\.0\\.0\\.1?.*",
  35. // Exempt xmlns urls
  36. "^http:\\/\\/www\\.w3\\.org?.*",
  37. "^http:\\/\\/www\\.mozilla\\.org\\/keymaster\\/gatekeeper?.*",
  38. // Exempt urls that start with ftp or ws.
  39. "^ws:?.*",
  40. "^ftp:?.*",
  41. ],
  42. varExceptions: ["insecure?.*"],
  43. },
  44. ],
  45. "mozilla/import-content-task-globals": "error",
  46. "mozilla/import-headjs-globals": "error",
  47. "mozilla/mark-test-function-used": "error",
  48. // Turn off no-define-cc-etc for mochitests as these don't have Cc etc defined in the
  49. // global scope.
  50. "mozilla/no-define-cc-etc": "off",
  51. "no-shadow": "error",
  52. },
  53. };