{"id":23346344,"url":"https://github.com/tuckn/wshjest","last_synced_at":"2026-04-24T23:32:49.547Z","repository":{"id":40621562,"uuid":"264100435","full_name":"tuckn/WshJest","owner":"tuckn","description":"The testing module for WSH (Windows Script Host).","archived":false,"fork":false,"pushed_at":"2024-01-08T22:28:26.000Z","size":230,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-10T13:05:56.044Z","etag":null,"topics":["jscript","testing","windows","wsf","wsh"],"latest_commit_sha":null,"homepage":"https://tuckn.net/docs/WshJest/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tuckn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["tuckn"],"patreon":"tuckn","open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2020-05-15T05:03:20.000Z","updated_at":"2024-06-27T09:33:28.000Z","dependencies_parsed_at":"2025-02-13T19:33:13.548Z","dependency_job_id":"a10a646e-6f66-4f60-b33a-aef5206bf102","html_url":"https://github.com/tuckn/WshJest","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/tuckn/WshJest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuckn%2FWshJest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuckn%2FWshJest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuckn%2FWshJest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuckn%2FWshJest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tuckn","download_url":"https://codeload.github.com/tuckn/WshJest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuckn%2FWshJest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32245148,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T13:21:15.438Z","status":"ssl_error","status_checked_at":"2026-04-24T13:21:15.005Z","response_time":64,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jscript","testing","windows","wsf","wsh"],"created_at":"2024-12-21T07:13:32.071Z","updated_at":"2026-04-24T23:32:49.534Z","avatar_url":"https://github.com/tuckn.png","language":"JavaScript","funding_links":["https://github.com/sponsors/tuckn","https://patreon.com/tuckn"],"categories":[],"sub_categories":[],"readme":"# WshJest\n\nThe testing module for [WSH][url1]. I thought to name this module \"Test\", But I chose \"Jest\". Because \"Test\" is a frequently used name, and \"T\" and \"J\" look similar. On the other hand, this module is just a bit like [Jest](https://jestjs.io/).\n\n[url1]: https://docs.microsoft.com/ja-jp/previous-versions/windows/scripting/cc364455(v=msdn.10)?redirectedfrom=MSDN \"Windows Script Host\"\n\n## Operating environment\n\nWorks on JScript in Windows.\n\n## Installation\n\n(1) Create a directory of your WSH project.\n\n```console\nD:\\\u003e mkdir MyWshProject\nD:\\\u003e cd MyWshProject\n```\n\n(2) Download and unzip this ZIP or Use the bellowing `git` command.\n\n```console\n\u003e git clone https://github.com/tuckn/WshJest.git ./WshModules/WshJest\nor\n\u003e git submodule add https://github.com/tuckn/WshJest.git ./WshModules/WshJest\n```\n\nNow, The file structure is as\n\n```console\nD:\\MyWshProject\\\n├─ MyScript.js \u003c- Your JScript code will be written in this.\n└─ WshModules\\\n    └─ WshJest\\\n        └─ dist\\\n          └─ app.js\n```\n\n## Usage\n\n(1) If you want to test *MyScript.js*, create a new .wsf file and .js file for testing.\n\n```console\nD:\\MyWshProject\\\n├─ Test.wsf  \u003c- Create this (Package file)\n├─ MyScript.js\n├─ MyScript.test.js \u003c- Create this (Test code)\n└─ WshModules\\\n    └─ WshJest\\\n        └─ dist\\\n          └─ app.js\n```\n\n(2) Write the above _Test.wsf_. For example, the following content\n\n```xml\n\u003cpackage\u003e\n  \u003cjob id = \"run\"\u003e\n    \u003cscript language=\"JScript\" src=\"./MyScript.js\"\u003e\u003c/script\u003e\n    \u003cscript language=\"JScript\" src=\"./WshModules/WshJest/dist/app.js\"\u003e\u003c/script\u003e\n    \u003cscript language=\"JScript\" src=\"./MyScript.test.js\"\u003e\u003c/script\u003e\n  \u003c/job\u003e\n\u003c/package\u003e\n```\n\nNote that _.\\WshJest\\dist\\app.js_ should be placed above your test .js file.\nI recommend this WSH file (.wsf) encoding to be UTF-8 [BOM, CRLF].\n\n(3) Now, Your JScript (_MyModule.test.js_) can use the testing functions.\n`describe`, `test`, and `expect`.\nFor example,\n\n```js\ndescribe('MyScript', function () {\n  test('Values', function () {\n    // Compare primitive values or referential identity of object instances.\n    expect(myVal1).toBe('MY_CONST_VAL');\n    // Check an item that is in an array .\n    expect(myVal2).toContain(2);\n  });\n\n  test('Functions', function () {\n    // Check a variable that is undefined.\n    expect(myFunc1(3)).toBeUndefined();\n    // Check a function throws when it is called.\n    expect(function () { myFunc1(null); }).toThrowError();\n  });\n});\n```\n\n(4) Run the test with cscript.exe.\n\n```console\n\u003e cscript //nologo .\\Test.wsf\n\n----------------------------\nMyScript\n  √ Values (0ms 2exp)\n  √ Functions (0ms 2exp)\n\nTests: 4 passed, 4 total\n```\n\n### Specifying test name\n\nCan use the argument `-t` or `--testNamePattern`.\n\n```console\n\u003e cscript //nologo .\\Test.wsf -t \"Values\"\n\n----------------------------\nMyScript\n  √ Values (0ms 2exp)\n\nTests: 2 skipped, 2 passed, 4 total\n```\n\nThis string is to be specified as RegExp. e.g. `\"\\w+Functions$\"`.\n\nNote that if you use `^` in the Command-Prompt, you need to escape it at the caret itself.\nFor example,\n\n```console\n\u003e cscript //nologo .\\Test.wsf -t \"^^MyFooBar\"\n```\n\n### Expect Method Examples\n\n#### toBe, not.toBe\n\n`toBe` is `if (A === B)`, `not.toBe` is `if (A !== B)`.\n\n```js\ndescribe('Expect Methods', function () {\n  test('Be', function () {\n    expect(undefined).toBe(undefined); // √\n    expect(null).toBe(null); // √\n\n    expect(undefined).toBe(null); // ×\n    expect(undefined).not.toBe(null); // √\n\n    // String\n    expect('MY_CONST_VAL').toBe('MY_CONST_VAL'); // √\n    expect('my_const_val').toBe('MY_CONST_VAL'); // ×\n    expect('my_const_val').not.toBe('MY_CONST_VAL'); // √\n\n    // Array\n    var arrA = [1];\n    var arrB = [1];\n    var arrC = arrB;\n    expect([1]).toBe([1]); // ×\n    expect([1]).toBe(arrA); // ×\n    expect(arrA).toBe(arrA); // √\n    expect(arrA).toBe(arrB); // ×\n    expect(arrB).toBe(arrC); // √\n\n    // Object\n    var obj1 = { a: 'A' };\n    var obj2 = { a: 'A' };\n    var obj3 = obj2;\n    expect({ a: 'A' }).toBe({ a: 'A' }); // ×\n    expect({ a: 'A' }).toBe(obj1); // ×\n    expect(obj1).toBe(obj1); // √\n    expect(obj1).toBe(obj2); // ×\n    expect(obj2).toBe(obj3); // √\n  });\n```\n\n#### toDefined, toBeUndefined\n\n```js\ndescribe('Expect Methods', function () {\n  test('Defined', function () {\n    var obj = { a: 'A' };\n\n    // toBeDefined\n    expect(undefined).toBeDefined(); // ×\n    expect(null).toBeDefined(); // √\n    expect('').toBeDefined(); // √\n    expect(obj).toBeUndefined(); // √\n    expect(obj.a).toBeUndefined(); // √\n    expect(obj.b).toBeUndefined(); // ×\n\n    // toBeUndefined\n    expect(undefined).toBeUndefined(); // √\n    expect(null).toBeUndefined(); // ×\n    expect('').toBeUndefined(); // ×\n    expect(obj).toBeUndefined(); // ×\n    expect(obj.a).toBeUndefined(); // ×\n    expect(obj.b).toBeUndefined(); // √\n  });\n```\n\n#### toEqual, not.toEqual\n\n```js\ndescribe('Expect Methods', function () {\n  test('Equal', function () {\n    expect(undefined).toEqual(undefined); // √\n    expect(null).toEqual(null); // √\n\n    expect(undefined).toEqual(null); // ×\n    expect(undefined).not.toEqual(null); // √\n\n    // String\n    expect('MY_CONST_VAL').toEqual('MY_CONST_VAL'); // √\n    expect('my_const_val').toEqual('MY_CONST_VAL'); // ×\n    expect('my_const_val').not.toEqual('MY_CONST_VAL'); // √\n\n    // Array\n    var arrA = [1];\n    var arrB = [1];\n    var arrC = arrB;\n    expect([1]).toEqual([1]); // √\n    expect([1]).toEqual(arrA); // √\n    expect(arrA).toEqual(arrA); // √\n    expect(arrA).toEqual(arrB); // √\n    expect(arrB).toEqual(arrC); // √\n    expect([1, 2]).toEqual([1]); // ×\n\n    // Object\n    var obj1 = { a: 'A' };\n    var obj2 = { a: 'A' };\n    var obj3 = obj2;\n    expect({ a: 'A' }).toEqual({ a: 'A' }); // √\n    expect({ a: 'A' }).toEqual(obj1); // √\n    expect(obj1).toEqual(obj1); // √\n    expect(obj1).toEqual(obj2); // √\n    expect(obj2).toEqual(obj3); // √\n    expect({ a: 'A', b: 'B' }).toEqual({ a: 'A' }); // ×\n  });\n```\n\n#### toContain, not.toContain\n\nUse for String and Array.\n\n```js\ndescribe('Expect Methods', function () {\n  test('Contain', function () {\n    expect(undefined).toContain(undefined); // throw a error\n    expect(null).toContain(null); // throw a Error\n\n    // String\n    expect('MY_CONST_VAL').toContain('CONST_VAL'); // √\n    expect('MY_CONST_VAL').toContain('MY'); // √\n    expect('MY_CONST_VAL').toContain('my'); // ×\n    expect('MY_CONST_VAL').not.toContain('Another_val'); // √\n\n    // Array\n    var arr1 = [1];\n    expect([arr1, 2]).toContain(arr1); // √\n\n    expect([1, 2]).toContain(1); // √\n    expect([1, 2]).toContain([1]); // ×\n    expect([[1], 2]).toContain([1]); // ×\n\n    expect([1, { b: 'B' }]).toContain({ b: 'B' }); // ×\n    var objB = { b: 'B' };\n    expect([1, objB]).toContain(objB); // √\n\n    // Object -\u003e All of them to be failed\n    expect({ a: 'A', b: 'B' }).toContain({ a: 'A' }); // ×\n    expect({ a: 'A' }).toContain({ a: 'A' }); // ×\n    expect({ a: 'A' }).toContain('a'); // ×\n    expect({ a: 'A' }).toContain('A'); // ×\n  });\n```\n\n#### toContainEqual, not.toContainEqual\n\nUse for Array.\n\n```js\ndescribe('Expect Methods', function () {\n  test('ContainEqual', function () {\n    expect(undefined).toContainEqual(undefined); // throw a error\n    expect(null).toContainEqual(null); // throw a Error\n\n    // String -\u003e All of them to be failed\n    expect('MY_CONST_VAL').toContainEqual('MY'); // ×\n    expect('MY_CONST_VAL').toContainEqual('MY_CONST_VAL'); // ×\n    expect('MY_CONST_VAL').not.toContainEqual('MY_CONST_VAL'); // √\n\n    // Array\n    expect([1, 2]).toContainEqual(1); // √\n    expect([1, 2]).toContainEqual([1]); // ×\n    expect([[1], 2]).toContainEqual([1]); // √\n    expect([1, { b: 'B' }]).toContainEqual({ b: 'B' }); // √\n\n    // Object -\u003e All of them to be failed\n    expect({ a: 'A', b: 'B' }).toContainEqual({ a: 'A' }); // ×\n    expect({ a: 'A' }).toContainEqual({ a: 'A' }); // ×\n    expect({ a: 'A' }).toContainEqual('a'); // ×\n    expect({ a: 'A' }).toContainEqual('A'); // ×\n  });\n```\n\n#### Other methods\n\n```js\ndescribe('Expect Methods', function () {\n  test('others', function () {\n    // toThrowError\n    expect(new Error).toThrowError(); // √\n    expect(function () { undefinedFunc(); }).toThrowError(); // √\n\n    // @TODO\n    // toBeNaN, toBeGreaterThan, toBeTruthy, toHaveLength\n  });\n```\n\n## Documentation\n\nSee all specifications [here](https://assets.tuckn.net/docs/WshJest).\n\n## Example of Use\n\n- [WshFileSystem](https://github.com/tuckn/WshFileSystem/blob/master/src/FileSystem.test.js)\n- [WshPath](https://github.com/tuckn/WshPath/blob/master/src/Path.test.js)\n- [WshUtil](https://github.com/tuckn/WshUtil/blob/master/src/Util.test.js)\n\n## License\n\nMIT\n\nCopyright (c) 2020 [Tuckn](https://github.com/tuckn)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftuckn%2Fwshjest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftuckn%2Fwshjest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftuckn%2Fwshjest/lists"}