stringifyobjects.js 873 B

1234567891011121314151617181920
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. if (this.WScript && this.WScript.LoadScriptFile) { // Check for running in ch
  6. this.WScript.LoadScriptFile("..\\UnitTestFramework\\UnitTestFramework.js");
  7. }
  8. const tests = [
  9. {
  10. name: "Stringify error",
  11. body: function () {
  12. const err = new Error("message");
  13. assert.areEqual('{"description":"message","message":"message"}', JSON.stringify(err));
  14. }
  15. }
  16. ];
  17. testRunner.runTests(tests, { verbose: WScript.Arguments[0] != "summary" });