Repository: peaceiris/actions-mdbook (language: rust)

Issue:
gha: Check whether did ncc or not
**Is your feature request related to a problem? Please describe.**
About `lib/index.js`

**Describe the solution you'd like**
Add a check step to the test workflow whether did `ncc` or not.

**Describe alternatives you've considered**
none.

**Additional context**
none.



Discussion / hints:

Fix patch:
diff --git a/lib/index.js b/lib/index.js
index 086f162..6ff1357 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -3510,7 +3510,7 @@ const get_latest_version_1 = __importDefault(__webpack_require__(307));
 const installer_1 = __importDefault(__webpack_require__(923));
 function run() {
     return __awaiter(this, void 0, void 0, function* () {
-        const dump = () => __awaiter(this, void 0, void 0, function* () {
+        const showVersion = () => __awaiter(this, void 0, void 0, function* () {
             yield exec.exec('mdbook --version');
         });
         try {
@@ -3520,7 +3520,7 @@ function run() {
                     return __awaiter(this, void 0, void 0, function* () {
                         console.log(`mdbook version: ${latestVersion} (${mdbookVersion})`);
                         yield installer_1.default(latestVersion);
-                        yield dump();
+                        yield showVersion();
                     });
                 }, function (error) {
                     core.setFailed(error);
@@ -3529,7 +3529,7 @@ function run() {
             else {
                 console.log(`mdbook version: ${mdbookVersion}`);
                 yield installer_1.default(mdbookVersion);
-                yield dump();
+                yield showVersion();
             }
         }
         catch (error) {
diff --git a/package.json b/package.json
index 29c7a0a..c5bcd61 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "actions-mdbook",
-  "version": "1.0.0",
+  "version": "1.0.1",
   "description": "GitHub Actions for mdBook",
   "main": "lib/index.js",
   "scripts": {
diff --git a/src/get-os.ts b/src/get-os.ts
index 85fc8a3..7358af5 100644
--- a/src/get-os.ts
+++ b/src/get-os.ts
@@ -5,7 +5,6 @@ export default function getOS(platform: string) {
     return 'apple-darwin';
   } else if (platform === 'win32') {
     return 'pc-windows-msvc';
-    // throw new Error("Windows is not supported");
   } else {
     throw new Error(`${platform} is not supported`);
   }
diff --git a/src/index.ts b/src/index.ts
index 1f36366..4b65ede 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -5,8 +5,7 @@ import installer from './installer';
 
 // most @actions toolkit packages have async methods
 async function run() {
-  const dump = async () => {
-    // Show version
+  const showVersion = async () => {
     await exec.exec('mdbook --version');
   };
 
@@ -18,7 +17,7 @@ async function run() {
         async function(latestVersion): Promise<void> {
           console.log(`mdbook version: ${latestVersion} (${mdbookVersion})`);
           await installer(latestVersion);
-          await dump();
+          await showVersion();
         },
         function(error) {
           core.setFailed(error);
@@ -27,7 +26,7 @@ async function run() {
     } else {
       console.log(`mdbook version: ${mdbookVersion}`);
       await installer(mdbookVersion);
-      await dump();
+      await showVersion();
     }
   } catch (error) {
     core.setFailed(error.message);


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 9c3b3ac..be9bc7f 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -45,6 +45,11 @@ jobs:
 
     - run: npm test
 
+    - name: Check ncc
+      run: |
+        npm run build
+        test -z "$(git status --short)"
+
     - name: Upload test coverage
       uses: actions/upload-artifact@v1
       with:
diff --git a/__tests__/get-os.test.ts b/__tests__/get-os.test.ts
index 9555046..0f1874f 100644
--- a/__tests__/get-os.test.ts
+++ b/__tests__/get-os.test.ts
@@ -8,9 +8,6 @@ describe('getOS', () => {
   });
 
   test('test exception', () => {
-    // expect(() => {
-    //   getOS("win32");
-    // }).toThrowError("Windows is not supported");
     expect(() => {
       getOS('centos');
     }).toThrowError('centos is not supported');
diff --git a/__tests__/get-url.test.ts b/__tests__/get-url.test.ts
index c654a84..2e17012 100644
--- a/__tests__/get-url.test.ts
+++ b/__tests__/get-url.test.ts
@@ -7,8 +7,10 @@ describe('getURL()', () => {
     const urlLinux: string = `${baseURL}-unknown-linux-gnu.tar.gz`;
     const urlMacOS: string = `${baseURL}-apple-darwin.tar.gz`;
     const urlWindows: string = `${baseURL}-pc-windows-msvc.zip`;
+    const urlMyOS: string = `${baseURL}-my-os.tar.gz`;
     expect(getURL('unknown-linux-gnu', '0.3.5')).toBe(urlLinux);
     expect(getURL('apple-darwin', '0.3.5')).toBe(urlMacOS);
     expect(getURL('pc-windows-msvc', '0.3.5')).toBe(urlWindows);
+    expect(getURL('unknown-linux-gnu', '0.3.5')).not.toBe(urlMyOS);
   });
 });